query-9569ecdf93c9d3b701f8781d191f140e
SPARQL query
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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 ?url ?name ?district_id ?party_id
WHERE
{
?name p:P39 ?statement .
?statement ps:P39/wdt:P279* wd:Q18555726 ; pq:P580 ?start .
OPTIONAL { ?statement pq:P582 ?end }
OPTIONAL { ?statement pq:P768 ?district_id }
OPTIONAL { ?district_id rdfs:label ?district . FILTER(lang(?en_label)="en") }
OPTIONAL { ?statement pq:P4100 ?party_id }
OPTIONAL { ?name wdt:P973 ?url }
FILTER(!BOUND(?end) || ?end > 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;
v7("?district")
v6("?district_id"):::projected
v3("?en_label")
v2("?end")
v4("?name"):::projected
v8("?party_id"):::projected
v1("?start")
v5("?statement")
v9("?url"):::projected
a1((" "))
c5(["wd:Q18555726"]):::iri
c13(["bd:serviceParam"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["(not bound(?end) || ?end > NOW())"]]
f0 --> v2
v4 --"p:P39"--> v5
v5 --"p:statement/P39"--> a1
a1 --"p:direct/P279"--> c5
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;
v6 -."rdfs:label".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P4100".-> v8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P973".-> v9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end