query-c1a45285a8eae94f1e8a2e407c3440f3
SPARQL query
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
SELECT ?wikidata ?wikidataLabel ?electorate_wikidata ?electorate_wikidataLabel ?party_wikidata ?party_wikidataLabel
WHERE
{
?wikidata p:P39 ?statement .
?statement ps:P39 wd:Q18912794 ; pq:P580 ?start .
OPTIONAL { ?statement pq:P582 ?end }
OPTIONAL { ?statement pq:P768 ?electorate_wikidata }
OPTIONAL { ?statement pq:P4100 ?group }
OPTIONAL { ?wikidata wdt:P102 ?party_wikidata }
BIND(COALESCE(?end, "3001-01-01T00:00:00Z"^^xsd:dateTime) as ?enddate)
FILTER (?enddate > NOW())
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?start ?end
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?electorate_wikidata"):::projected
v2("?end")
v9("?enddate")
v7("?group")
v8("?party_wikidata"):::projected
v1("?start")
v5("?statement")
v4("?wikidata"):::projected
c10(["bd:serviceParam"]):::iri
c3(["wd:Q18912794"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?enddate > NOW()"]]
f0 --> v9
v4 --"p:P39"--> v5
v5 --"p:statement/P39"--> c3
v5 --"p:qualifier/P580"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P582".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P768".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P4100".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P102".-> v8
end
bind1[/"?end'3001-01-01T00:00:00Z^^xsd:dateTime'"/]
v2 --o bind1
bind1 --as--o v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end