query-3c651017daffd5fd7296e1d7558039c4
TODO
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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?candidate ?candidateLabel ?electionLabel ?qualifiers WHERE {
{
SELECT ?candidate ?election (GROUP_CONCAT(CONCAT(STR(?qpropLabel), ': ', COALESCE(STR(?qvalueLabel), STR(?qvalue))); separator='; ') AS ?qualifiers) {
?candidate p:P726 ?statement .
?statement ps:P726 ?election .
?election wdt:P361 wd:Q640715 .
OPTIONAL {
?statement ?pq ?qvalue .
?qprop wikibase:qualifier ?pq .
OPTIONAL {
?qprop wikibase:propertyType wikibase:WikibaseItem .
?qvalue rdfs:label ?qvalueLabel .
FILTER( LANG( ?qvalueLabel ) = "fi" ) .
}
} .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fi" .
?qprop rdfs:label ?qpropLabel .
} .
} GROUP BY ?candidate ?election
}.
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi" } .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?candidate"):::projected
v3("?election")
v5("?pq")
v7("?qprop")
v8("?qpropLabel")
v9("?qualifiers"):::projected
v6("?qvalue")
v4("?qvalueLabel")
v2("?statement")
c5(["fi"]):::literal
c8(["wikibase:WikibaseItem"]):::iri
c11(["bd:serviceParam"]):::iri
c4(["wd:Q640715"]):::iri
v1 --"p:P726"--> v2
v2 --"p:statement/P726"--> v3
v3 --"p:direct/P361"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -->v5--> v6
v7 -."wikibase:qualifier".-> v5
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."wikibase:propertyType".-> c8
v6 --"rdfs:label"--> v4
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c5
v7 --"rdfs:label"--> v8
end
bind1[/"concat(str(?qpropLabel),': ',str(?qvalueLabel)str(?qvalue))"/]
v8 --o bind1
v4 --o bind1
v6 --o bind1
bind1 --as--o v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c5
end