Project:SPARQL/examples

From geokb
Revision as of 18:40, 7 August 2024 by Sky (talk | contribs) (Created page with "= Organizations = == Classification of organizations == <sparql tryit="1"> PREFIX wdt: <https://geokb.wikibase.cloud/prop/direct/> PREFIX wd: <https://geokb.wikibase.cloud/entity/> SELECT ?item ?itemLabel ?subclass_of ?subclass_ofLabel WHERE { { wd:Q50862 wdt:P2* ?item . ?item wdt:P2 ?subclass_of . } UNION { ?item wdt:P2* wd:Q50862 ; wdt:P2 ?subclass_of . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } </sparql>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Organizations

Classification of organizations

PREFIX wdt: <https://geokb.wikibase.cloud/prop/direct/>
PREFIX wd: <https://geokb.wikibase.cloud/entity/>

SELECT ?item ?itemLabel ?subclass_of ?subclass_ofLabel
WHERE {
  {
    wd:Q50862 wdt:P2* ?item .
    ?item wdt:P2 ?subclass_of .
  } UNION {
    ?item wdt:P2* wd:Q50862 ;
          wdt:P2 ?subclass_of .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}

Try it!