1

I am using the next query to get Athletes data from DBpedia

  SELECT * WHERE {

  ?player a <http://dbpedia.org/ontology/Athlete> .
  ?player foaf:name ?firstname .
  ?player foaf:surname ?lastname .
  ?player <http://dbpedia.org/ontology/country> ?birthplace .
  ?player <http://dbpedia.org/ontology/birthDate> ?birthDate .
  ?player <http://dbpedia.org/ontology/Person/height> ?height .
  ?player <http://dbpedia.org/ontology/Person/weight> ?weight .
}

but I only get about 300 records!!

Can anyone tell me what is the problem here?

4

I found the solution myself. I needed to make the last four attributes optional

  SELECT * WHERE {

  ?player a <http://dbpedia.org/ontology/Athlete> .
  ?player foaf:name ?firstname .
  ?player foaf:surname ?lastname .
  optional {?player <http://dbpedia.org/ontology/country> ?birthplace .}
  optional {?player <http://dbpedia.org/ontology/birthDate> ?birthDate .}
  optional {?player <http://dbpedia.org/ontology/Person/height> ?height .}
  optional {?player <http://dbpedia.org/ontology/Person/weight> ?weight .}
}

This returns all the records even when there are missing values.

  • 1
    If this solved your problem, please choose it also as a "best answer". – Tasos Oct 24 '15 at 15:39
1

Try

 SELECT (count(?player) as ?count) WHERE {

  ?player a <http://dbpedia.org/ontology/Athlete> .
  ?player foaf:name ?firstname .
  ?player foaf:surname ?lastname .
  ?player <http://dbpedia.org/ontology/country> ?birthplace .
  ?player <http://dbpedia.org/ontology/birthDate> ?birthDate .
  ?player <http://dbpedia.org/ontology/Person/height> ?height .
  ?player <http://dbpedia.org/ontology/Person/weight> ?weight .
 }

I guess there are only 283 matching results for this query.

Also check

SELECT (count(?player) as ?count) 
WHERE {
       ?player a <http://dbpedia.org/ontology/Athlete> .
      }

SELECT ?player 
WHERE {
       ?player a <http://dbpedia.org/ontology/Athlete> .
      }
  • Yes using my query I do not get all the existed Athletes in DBpedia – Abdulrahman Bres Oct 22 '15 at 16:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.