query-3e7eecdaff3533564efb8f739d99c695
This finds all MPs who served in the current Parliament, and their terms in that Parliament. Note that a small number are "completed" terms - sometimes because the MP has left the House, sometimes because they have changed party and so have two terms, one for the old party and one for the new. We do not have to restrict ourselves to a single Parliament, however.
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ?person ?personLabel ?seatLabel ?partyLabel ?start ?electionLabel ?end ?causeLabel WHERE
{
?person wdt:P31 wd:Q5 . ?person p:P39 ?ps .
?ps ps:P39 ?term . ?term wdt:P279 wd:Q16707842 .
?ps pq:P580 ?start . ?ps pq:P4100 ?party . ?ps pq:P768 ?seat .
OPTIONAL { ?ps pq:P2715 ?election } .
OPTIONAL { ?ps pq:P582 ?end } .
OPTIONAL { ?ps pq:P1534 ?cause } .
FILTER(?start >= "1997-05-01T00:00:00Z"^^xsd:dateTime) .
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;
v9("?cause")
v7("?election")
v8("?end"):::projected
v5("?party")
v2("?person"):::projected
v3("?ps")
v6("?seat")
v1("?start"):::projected
v4("?term")
c7(["wd:Q16707842"]):::iri
c17(["en"]):::literal
c15(["bd:serviceParam"]):::iri
c3(["wd:Q5"]):::iri
f0[["?start >= '1997-05-01T00:00:00Z^^xsd:dateTime'"]]
f0 --> v1
v2 --"p:direct/P31"--> c3
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> v4
v4 --"p:direct/P279"--> c7
v3 --"p:qualifier/P580"--> v1
v3 --"p:qualifier/P4100"--> v5
v3 --"p:qualifier/P768"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P2715".-> v7
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v8
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P1534".-> v9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end