query-c3f9a5ae6a6688f50b6f4a0473c809b3

rq turtle/ttl

Finding subclasses of country

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?class ?classLabel (COUNT(?item) AS ?items)
WHERE {
  ?class wdt:P279* wd:Q6256.
  OPTIONAL {?item wdt:P31 ?class.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?class ?classLabel
ORDER BY DESC(?items)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?class"):::projected v3("?item"):::projected v4("?items") c5(["bd:serviceParam"]):::iri c7(["en"]):::literal c2(["wd:Q6256"]):::iri v2 --"wdt:P279"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind1[/"count(?item)"/] v3 --o bind1 bind1 --as--o v4