Anonymous

Main Page: Difference between revisions

From geokb
Line 298: Line 298:
WHERE {
WHERE {
   ?item wdt:P2* wd:Q5 . # subclass of, transitive "document"
   ?item wdt:P2* wd:Q5 . # subclass of, transitive "document"
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
</sparql>
We can build on the query for document classes to get document instances.
<sparql tryit="1">
PREFIX wd: <https://geokb.wikibase.cloud/entity/>
PREFIX wdt: <https://geokb.wikibase.cloud/prop/direct/>
SELECT ?item ?itemLabel
WHERE {
  ?classes wdt:P2* wd:Q5 . # subclass of, transitive "document"
  ?item wdt:P1 ?classes . # get entities that are instances of any of the classes
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
}