query-a9d27e795c36989453232665280f34cb
Missing UK MP records, by regionWhich UK regions do we still not have the current MP matched for:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?territory ?territoryLabel (COUNT(?constituency) AS ?constituencies)
((COUNT(?constituency) - COUNT(DISTINCT ?person)) AS ?missing) {
?constituency wdt:P31 wd:Q27971968 .
FILTER NOT EXISTS { ?constituency wdt:P576 [] }
OPTIONAL { ?constituency wdt:P131 ?territory }
OPTIONAL {
?person p:P39 [ ps:P39 wd:Q16707842; pq:P2937 wd:Q29974940 ; pq:P768 ?constituency ]
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?territoryLabel ?territory
ORDER BY ?missing
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?constituencies")
v2("?constituency"):::projected
v6("?missing")
v4("?person")
v3("?territory"):::projected
a1((" "))
a2((" "))
c6(["wd:Q16707842"]):::iri
c3(["wd:Q27971968"]):::iri
c14(["en"]):::literal
c8(["wd:Q29974940"]):::iri
c12(["bd:serviceParam"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:direct/P576"--> e0a1
e0v1("?constituency"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> a1
v2 --"p:direct/P576"--> a1
v2 --"p:direct/P31"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P131".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:statement/P39".-> c6
a2 --"p:qualifier/P2937"--> c8
a2 --"p:qualifier/P768"--> v2
v4 --"p:P39"--> a2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind4[/"count(?constituency)"/]
v2 --o bind4
bind4 --as--o v5
bind5[/" - "/]
null --o bind5
null --o bind5
bind5 --as--o v6