query-79bece6a15c5120175b28c5bc98ab5fc

rq turtle/ttl

: (P131)located in the administrative territorial entity Every UK constituency now has one of the associated UK regions set on its TODO

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 ?territory ?territoryLabel (COUNT(?constituency) AS ?constituencies) {
  ?constituency wdt:P31 wd:Q27971968 .
  FILTER NOT EXISTS { ?constituency wdt:P576 [] }
  OPTIONAL { ?constituency wdt:P131 ?territory }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?territoryLabel ?territory

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?constituencies") v1("?constituency"):::projected v2("?territory"):::projected a1((" ")) c6(["bd:serviceParam"]):::iri c3(["wd:Q27971968"]):::iri c8(["en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P576"--> e0a1 e0v1("?constituency"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 v1 --"wdt:P576"--> a1 v1 --"wdt:P31"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end bind2[/"count(?constituency)"/] v1 --o bind2 bind2 --as--o v3