query-c330aa4570b68cfc596f364e55c77d72
All party changes in a single Parliament
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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 ?item ?itemLabel ?party1Label ?reasonLabel ?date ?party2Label {
?item p:P39 ?positionStatement1 .
?positionStatement1 ps:P39 wd:Q30524710 .
?positionStatement1 pq:P4100 ?party1 .
?positionStatement1 pq:P582 ?date .
OPTIONAL { ?positionStatement1 pq:P1534 ?reason . }
?item p:P39 ?positionStatement2 .
?positionStatement2 ps:P39 wd:Q30524710 .
?positionStatement2 pq:P4100 ?party2 .
?positionStatement2 pq:P580 ?date . filter ( ?party1 != ?party2 )
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}
ORDER BY ?date
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?date"):::projected
v4("?item"):::projected
v2("?party1")
v3("?party2")
v5("?positionStatement1")
v7("?positionStatement2")
v6("?reason")
c9(["bd:serviceParam"]):::iri
c3(["wd:Q30524710"]):::iri
c11(["en"]):::literal
f0[["?party1 != ?party2"]]
f0 --> v2
f0 --> v3
v4 --"p:P39"--> v5
v5 --"p:statement/P39"--> c3
v5 --"p:qualifier/P4100"--> v2
v5 --"p:qualifier/P582"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P1534".-> v6
end
v4 --"p:P39"--> v7
v7 --"p:statement/P39"--> c3
v7 --"p:qualifier/P4100"--> v3
v7 --"p:qualifier/P580"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end