query-d09328b84b0583d6e85556daa24f4042

rq turtle/ttl

MPs who were expelled from, or suspended by, their party SELECT DISTINCT ?person ?personLabel ?causeLabel ?partyLabel ?date WHERE {

?person p:P39 [ ps:P39 [ wdt:P279 wd:Q16707842 ] ;
pq:P1534 ?cause ; pq:P582 ?date ; pq:P4100 ?party ]. # find the reason their term of office ended { ?cause wdt:P279
wd:Q30580630 . } UNION { ?cause wdt:P279* wd:Q35855188 . } # filter to expulsion or suspension SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } # get their names } ORDER BY ?date

Use at

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#>
# MPs who were expelled from, or suspended by, their party
SELECT DISTINCT ?person ?personLabel ?causeLabel ?partyLabel ?date
WHERE {

  ?person p:P39 [ ps:P39 [ wdt:P279* wd:Q16707842 ] ;  
          pq:P1534 ?cause ; pq:P582 ?date ; pq:P4100 ?party ].                  # find the reason their term of office ended
  { ?cause wdt:P279* wd:Q30580630 . } UNION { ?cause wdt:P279* wd:Q35855188 . } # filter to expulsion or suspension
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }          # get their names
}
ORDER BY ?date

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?cause") v1("?date"):::projected v3("?party") v4("?person"):::projected a2((" ")) a1((" ")) c2(["wd:Q16707842"]):::iri c13(["en"]):::literal c8(["wd:Q30580630"]):::iri c9(["wd:Q35855188"]):::iri c11(["bd:serviceParam"]):::iri a1 --"p:direct/P279"--> c2 a2 --"p:statement/P39"--> a1 a2 --"p:qualifier/P1534"--> v2 a2 --"p:qualifier/P582"--> v1 a2 --"p:qualifier/P4100"--> v3 v4 --"p:P39"--> a2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P279"--> c9 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P279"--> c8 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end