query-f13b1762728ad8aee346d97e9f26b297
Members elected through bypolls SELECT DISTINCT ?person ?personLabel ?constituencyLabel ?partyLabel ?start ?predLabel WHERE { ?person p:P39 ?positionStatement. ?positionStatement ps:P39 [wdt:P279* wd:Q24546266] . # all people who held an MLA position ?positionStatement pq:P2715 wd:Q61747313. # elected through a bypoll OPTIONAL { ?positionStatement pq:P768 ?constituency . } OPTIONAL { ?positionStatement (pq:P4100|pq:P102) ?party. } OPTIONAL { ?positionStatement pq:P1365 ?pred. } OPTIONAL { ?positionStatement pq:P580 ?start. } OPTIONAL { ?positionStatement pq:P582 ?end. } OPTIONAL { ?positionStatement pq:P1534 ?cause. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". } } ORDER BY ?start
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 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#>
# Members elected through bypolls
SELECT DISTINCT ?person ?personLabel ?constituencyLabel ?partyLabel ?start ?predLabel WHERE {
?person p:P39 ?positionStatement.
?positionStatement ps:P39 [wdt:P279* wd:Q24546266] . # all people who held an MLA position
?positionStatement pq:P2715 wd:Q61747313. # elected through a bypoll
OPTIONAL { ?positionStatement pq:P768 ?constituency . }
OPTIONAL { ?positionStatement (pq:P4100|pq:P102) ?party. }
OPTIONAL { ?positionStatement pq:P1365 ?pred. }
OPTIONAL { ?positionStatement pq:P580 ?start. }
OPTIONAL { ?positionStatement pq:P582 ?end. }
OPTIONAL { ?positionStatement pq:P1534 ?cause. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". }
}
ORDER BY ?start
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?cause")
v4("?constituency")
v7("?end")
v5("?party")
v2("?person"):::projected
v3("?positionStatement")
v6("?pred")
v1("?start"):::projected
a1((" "))
c3(["wd:Q24546266"]):::iri
c17(["#91;AUTO_LANGUAGE#93;, en"]):::literal
c15(["bd:serviceParam"]):::iri
c6(["wd:Q61747313"]):::iri
v2 --"p:P39"--> v3
a1 --"p:direct/P279"--> c3
v3 --"p:statement/P39"--> a1
v3 --"p:qualifier/P2715"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P768".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 -."p:qualifier/P102".-> v5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"p:qualifier/P4100"--> v5
end
union0r <== or ==> union0l
end
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P1365".-> v6
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v1
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v7
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P1534".-> v8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end