0

Why does the following query:

SELECT ?item ?itemLabel ?o ?oLabel WHERE {
  ?item wdt:P31 wd:Q3918.
  ?item wdt:P131 ?o.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

not return https://www.wikidata.org/wiki/Q160302, when clearly this entity has a property P131: https://www.wikidata.org/wiki/Q160302#P131?

Including the OPTIONAL clause does:

SELECT ?item ?itemLabel ?o ?oLabel WHERE {
  ?item wdt:P31 wd:Q3918.
  OPTIONAL {?item wdt:P131 ?o.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

But why?

forgodsakehold
  • 870
  • 10
  • 26
  • 1
    scroll down on the page, the web UI shows 200 rows per page by default. Clearly, your query return more than 200 universities. You should see `"Showing 1 to 200 of 11254 rows"` – UninformedUser Mar 02 '19 at 14:44
  • 1
    And with an `OPTIONAL` it returns much more results, because it's an optional property, thus returns all universities with or without the value of the property. In total there are `13483` universities. Your example university is likely not shown on the first 200 rows you see because some others are randomly returned first. Note, there is no ordering on the resultset until you do this explicitly – UninformedUser Mar 02 '19 at 14:46

0 Answers0