query-3c7d001cfcdb320162740f4717d4ac05
- Adding qualifiers and filtering to find current MPsWe saw earlier that modern MP statements have a wide range of qualifiers, which can be selected with the pq: syntax. These help refine details about a term and let us go beyond the very simple "was an MP".
Use at
- https://query.wikidata.org/sparql
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/>
SELECT DISTINCT ?person 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 .
?ps pq:P2715 ?election . ?ps pq:P582 ?end . ?ps pq:P1534 ?cause .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?cause")
v7("?election")
v8("?end")
v5("?party")
v1("?person"):::projected
v2("?ps")
v6("?seat")
v4("?start")
v3("?term")
c2(["wd:Q5"]):::iri
c6(["wd:Q16707842"]):::iri
v1 --"p:direct/P31"--> c2
v1 --"p:P39"--> v2
v2 --"p:statement/P39"--> v3
v3 --"p:direct/P279"--> c6
v2 --"p:qualifier/P580"--> v4
v2 --"p:qualifier/P4100"--> v5
v2 --"p:qualifier/P768"--> v6
v2 --"p:qualifier/P2715"--> v7
v2 --"p:qualifier/P582"--> v8
v2 --"p:qualifier/P1534"--> v9