query-1daf8f27db54d8c1a61da9b1fbaac17f
title: List of candidates by constituency SELECT ?item ?itemLabel ?constituency ?constituencyLabel WHERE { ?item wdt:P31 wd:Q5; p:P3602 ?statement. ?statement ps:P3602 wd:Q106253677. OPTIONAL { ?statement pq:P768 ?constituency. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?item ?itemLabel ?constituency ?constituencyLabel ORDER BY DESC (?constituencyLabel)
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#>
#title: List of candidates by constituency
SELECT ?item ?itemLabel ?constituency ?constituencyLabel WHERE {
?item wdt:P31 wd:Q5;
p:P3602 ?statement.
?statement ps:P3602 wd:Q106253677.
OPTIONAL { ?statement pq:P768 ?constituency. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?item ?itemLabel ?constituency ?constituencyLabel
ORDER BY DESC (?constituencyLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?constituency"):::projected
v1("?constituencyLabel"):::projected
v2("?item"):::projected
v3("?statement")
c8(["bd:serviceParam"]):::iri
c5(["wd:Q106253677"]):::iri
c2(["wd:Q5"]):::iri
c10(["en"]):::literal
v2 --"p:direct/P31"--> c2
v2 --"p:P3602"--> v3
v3 --"p:statement/P3602"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P768".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end