query-b97d084c608f1f16171c9215c333373f

rq turtle/ttl

Member of Parliament (Q16707842) where electoral district (P768) != constituency of the House of Commons (Q27971968)

Use at

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 DISTINCT ?who ?whoLabel ?constituency ?constituencyLabel {
  ?who p:P39 [ ps:P39 wd:Q16707842 ; pq:P768 ?constituency ] .
  FILTER NOT EXISTS { ?constituency wdt:P31 wd:Q27971968 }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?constituencyLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?constituency"):::projected v1("?constituencyLabel"):::projected v3("?who"):::projected a1((" ")) c8(["bd:serviceParam"]):::iri c4(["wd:Q16707842"]):::iri c2(["wd:Q27971968"]):::iri c10(["en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:direct/P31"--> e0c2 e0v1("?constituency"):::projected e0c2(["wd:Q27971968"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> c2 v2 --"p:direct/P31"--> c2 a1 --"p:statement/P39"--> c4 a1 --"p:qualifier/P768"--> v2 v3 --"p:P39"--> a1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end