query-799a03d9b05b25b67922746d7a91272c

rq turtle/ttl

The SELECT DISTINCT ?person line says that we want to SELECT all values of ?person - ie the items representing MPs - and that we would like it to be de-duplicated (DISTINCT) should any items for whatever reason appear twice. Then WHERE { ... } encloses the query itself. You will note that we are getting more results than the expected 650 - this is because it does not know about time, so is returning retired/deceased members as well as currently active ones. To get the whole lot using our "all Parliaments" query:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
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 .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?person"):::projected v2("?ps") 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