1

This question already has an answer here:

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?

marked as duplicate by albert, philshem, Community Oct 26 '15 at 20:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from datascience.stackexchange.com Oct 22 '15 at 23:22

This question came from our site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field.

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.