query-1e4e7fbb6e5d0c08ada71e1af3a78b00

rq turtle/ttl

title: List of candidates by constituency SELECT ?item ?itemLabel ?constituency ?constituencyLabel ?party ?partyLabel ?votes WHERE { ?item wdt:P31 wd:Q5; p:P3602 ?statement. ?statement ps:P3602 wd:Q106253677. OPTIONAL { ?statement pq:P768 ?constituency. } OPTIONAL { ?statement pq:P1268 ?party. } OPTIONAL { ?statement pq:P1111 ?votes. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC (?constituencyLabel)

Use at

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 ?party ?partyLabel ?votes WHERE {
  ?item wdt:P31 wd:Q5;
     p:P3602 ?statement.
  ?statement ps:P3602  wd:Q106253677.
  OPTIONAL { ?statement pq:P768 ?constituency. }
  OPTIONAL { ?statement pq:P1268 ?party. }
  OPTIONAL { ?statement pq:P1111 ?votes. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
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 v5("?party"):::projected v3("?statement") v6("?votes"):::projected c10(["bd:serviceParam"]):::iri c5(["wd:Q106253677"]):::iri c2(["wd:Q5"]):::iri c12(["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 optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P1268".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P1111".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end