query-96d5531cf59b136f6aa313514593e228
New MPs records too, so I only made it through about the first 120 or results called. Other people joined in too over the next few days, and by yesterday we had all the new members, with most of the required fields set on their memberships: (P463)member of for their new mandate. This was rather slow progress, however, as in many cases I also had to tidy up their deprecated (P39)position held The UK had a general election at the end of last week. As the results were coming in, I was updating the winning candidates to add a new
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 ?item ?itemLabel ?constituencyLabel ?partyLabel ?electionLabel ?replacesLabel {
?item p:P39 ?positionStatement .
?positionStatement ps:P39 wd:Q16707842; pq:P2937 wd:Q29974940 .
MINUS { ?item p:P39 [ ps:P39 wd:Q16707842; pq:P2937 [ ^(wdt:P155+) wd:Q29974940 ] ] . }
OPTIONAL { ?positionStatement pq:P2715 ?election . }
OPTIONAL { ?positionStatement pq:P768 ?constituency . }
OPTIONAL { ?positionStatement pq:P102 ?party . }
OPTIONAL { ?positionStatement pq:P1365 ?replaces . }
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?constituency")
v3("?election")
v1("?item"):::projected
v5("?party")
v2("?positionStatement")
v6("?replaces")
a1((" "))
a2((" "))
c3(["wd:Q16707842"]):::iri
c14(["en"]):::literal
c5(["wd:Q29974940"]):::iri
c12(["bd:serviceParam"]):::iri
v1 --"p:P39"--> v2
v2 --"p:statement/P39"--> c3
v2 --"p:qualifier/P2937"--> c5
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
a1 --"p:statement/P39"--> c3
c5 --"p:direct/P155"--> a2
a1 --"p:qualifier/P2937"--> a2
v1 --"p:P39"--> a1
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P2715".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P768".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P102".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P1365".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end