query-f9a589da612c0d0994831e90951c2e2d
Finnish parliamentary elections
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?year
WHERE
{
?item wdt:P179 wd:Q2112448 .
OPTIONAL { ?item wdt:P580 ?start. }
OPTIONAL { ?item wdt:P585 ?pit. }
BIND ( IF(BOUND(?pit), YEAR(?pit), YEAR(?start)) AS ?year )
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?year
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v4("?pit")
v3("?start")
v5("?year"):::projected
c6(["bd:serviceParam"]):::iri
c2(["wd:Q2112448"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P179"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P580".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P585".-> v4
end
bind0[/"if(bound(?pit),year-from-dateTime(?pit),year-from-dateTime(?start))"/]
v4 --o bind0
v3 --o bind0
bind0 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end