query-f160dca01b3008f2195c010a134c2185
WikinautVALUESFILTER
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
#defaultView:Map
# Map for coal OR wat<er power plants which are in service or which were in service
SELECT ?plantLabel ?typeLabel ?plantGeo ?plantserviceentry ?plantserviceretirement
WHERE
{
{
SELECT ?plant ?type
WHERE
{
{
?plant wdt:P31/wdt:P279* wd:Q6558431.
BIND (wd:Q6558431 AS ?type)
}
UNION
{
?plant wdt:P31/wdt:P279* wd:Q15911738.
BIND (wd:Q15911738 AS ?type)
}
}
} ?plant wdt:P625 ?plantGeo.
VALUES ?countries { wd:Q20 wd:Q34 wd:Q35 }
?plant wdt:P17 ?countries. # The plant is in Norway, Sweden or Denmark
OPTIONAL { ?plant wdt:P729 ?plantserviceentry. }
OPTIONAL { ?plant wdt:P730 ?plantserviceretirement. }
# The plant was in service in 1980-2000
FILTER (IF(BOUND(?plantserviceentry), ?plantserviceentry <= "1980-00-00"^^xsd:date, true) &&
IF(BOUND(?plantserviceretirement), ?plantserviceretirement >= "1999-12-31"^^xsd:date, true))
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?countries")
v3("?plant")
v5("?plantGeo"):::projected
v1("?plantserviceentry"):::projected
v2("?plantserviceretirement"):::projected
v5("?type")
a1((" "))
a2((" "))
c15(["en"]):::literal
c13(["bd:serviceParam"]):::iri
c6(["wd:Q6558431"]):::iri
c7(["wd:Q15911738"]):::iri
f0[["if(bound(?plantserviceentry),?plantserviceentry <= '1980-00-00^^xsd:date','true^^xsd:boolean')if(bound(?plantserviceretirement),?plantserviceretirement >= '1999-12-31^^xsd:date','true^^xsd:boolean')"]]
f0 --> v1
f0 --> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c7
bind1[/"'wd:Q15911738'"/]
bind1 --as--o v5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c6
bind2[/"'wd:Q6558431'"/]
bind2 --as--o v5
end
union0r <== or ==> union0l
end
v3 --"wdt:P625"--> v5
bind3[/VALUES ?countries/]
bind3-->v6
bind30(["wd:Q20"])
bind30 --> bind3
bind31(["wd:Q34"])
bind31 --> bind3
bind32(["wd:Q35"])
bind32 --> bind3
v3 --"wdt:P17"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P729".-> v1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P730".-> v2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end