Anonymous

Property talk:P2: Difference between revisions

From geokb
No edit summary
Line 14: Line 14:


<sparql tryit="1">
<sparql tryit="1">
PREFIX wd: <https://geokb.wikibase.cloud/entity/>
PREFIX geokbe: <https://geokb.wikibase.cloud/entity/>
PREFIX wdt: <https://geokb.wikibase.cloud/prop/direct/>
PREFIX geokbp: <https://geokb.wikibase.cloud/prop/direct/>


SELECT ?item ?itemLabel ?subclass_of ?subclass_ofLabel ?same_as  
SELECT ?item ?itemLabel ?subclass_of ?subclass_ofLabel ?same_as  
WHERE {
WHERE {
   ?item wdt:P2* wd:Q2 ; # Get all subclasses (transitively) starting from "entity" as the origin
   ?item geokbp:P2* geokbe:Q2 ; # Get all subclasses (transitively) starting from "entity" as the origin
         wdt:P2 ?subclass_of .
         geokbp:P2 ?subclass_of .
   OPTIONAL {
   OPTIONAL {
     ?item wdt:P84 ?same_as . # Get any same as declarations for the classification entities
     ?item geokbp:P84 ?same_as . # Get any same as declarations for the classification entities
   }
   }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }