query-e188288e87db042e179e6e35d13924b3
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 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_id ?wikidata_idLabel (?wikidata_idLabel as ?name) ?dc_id ?area_id ?party_id ?genderObjectLabel (?genderObjectLabel as ?gender)
WHERE
{
?election wdt:P361 wd:Q22001091 .
?ps ps:P3602 ?election .
?election p:P541 ?office .
?office pq:P768 ?area_id .
?wikidata_id p:P3602 ?ps .
OPTIONAL { ?ps pq:P1268 ?party_id }
OPTIONAL { ?wikidata_id wdt:P6465 ?dc_id }
OPTIONAL { ?wikidata_id wdt:P21 ?genderObject }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?area_id"):::projected
v7("?dc_id"):::projected
v1("?election")
v10("?gender")
v8("?genderObject")
v9("?name")
v3("?office")
v6("?party_id"):::projected
v2("?ps")
v5("?wikidata_id"):::projected
c11(["bd:serviceParam"]):::iri
c2(["wd:Q22001091"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"p:direct/P361"--> c2
v2 --"p:statement/P3602"--> v1
v1 --"p:P541"--> v3
v3 --"p:qualifier/P768"--> v4
v5 --"p:P3602"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P1268".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P6465".-> v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P21".-> v8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end
bind0[/"?wikidata_idLabel"/]
null --o bind0
bind0 --as--o v9
bind1[/"?genderObjectLabel"/]
null --o bind1
bind1 --as--o v10