query-a03213eefce4f03fbde9b9b63c75e4c0
Everyone with summary seat/party data, but these values may not be the same as the party they were associated with in Parliament. Caveat lector. (P102)member of political party This query gives a summary list for each MP listing their seats, "known parties", and "inferred parties". Known are those explicitly associated with a given seat and period in Parliament (mostly 1996 onwards), inferred are those where we know the MP has a value set for Coverage is notionally 1803-2005, in practice 1832-2005 (as detailed seat information is not currently available before that date). Data on constituencies is comprehensive 1886-date, and broadly reliable 1832-86. Constituencies may not be named with the exact format used at the time (eg Ceredigion/Cardiganshire); this will hopefully be corrected in future data cleaning.
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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
(GROUP_CONCAT(distinct ?seatLabel; separator="; ") as ?seats)
(GROUP_CONCAT(distinct ?known_partyLabel; separator="; ") as ?known_parties)
(GROUP_CONCAT(distinct ?inferred_partyLabel; separator="; ") as ?inferred_parties)
WHERE {
?position wdt:P279 wd:Q16707842 . ?person p:P39 ?positionStatement .
?positionStatement ps:P39 ?position ; pq:P580 ?start .
bind(year(?start) as ?startyear) . filter (?startyear < 2005 ) . filter (?startyear > 1802 )
# anyone who served as an MP between 1803 and 2005
optional { ?positionStatement pq:P768 ?seat } .
optional { ?positionStatement pq:P4100 ?known_party } .
optional { ?person wdt:P102 ?inferred_party } .
# seats and parties
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .
?person rdfs:label ?personLabel .
?inferred_party rdfs:label ?inferred_partyLabel .
?known_party rdfs:label ?known_partyLabel .
?seat rdfs:label ?seatLabel . }
# labels
} group by ?person ?personLabel