query-7e0561f092b1a3d92243418d2652546f
TODO
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#>
# Stations d'Ontario actives en 1953
#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE {
?item (wdt:P31/wdt:P279*) wd:Q190107.
?item wdt:P131 wd:Q1904 .
?item wdt:P729 ?service_entry .
# service entry is before 1953
FILTER (?service_entry <= "1953-01-01T00:00:00Z"^^xsd:dateTime) .
# and closure date not before 1953
OPTIONAL { ?item wdt:P3999 ?closureDate }
FILTER(
# Closure date is not set
?closureDate > "1953-01-01T00:00:00Z"^^xsd:dateTime|| !BOUND(?closureDate) # or closure date is after 1953
)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL { ?item wdt:P625 ?coord. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?closureDate")
v4("?coord"):::projected
v3("?item"):::projected
v2("?service_entry")
a1((" "))
c6(["wd:Q1904"]):::iri
c4(["wd:Q190107"]):::iri
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["(?closureDate > '1953-01-01T00:00:00Z^^xsd:dateTime' || not bound(?closureDate))"]]
f0 --> v1
f1[["?service_entry <= '1953-01-01T00:00:00Z^^xsd:dateTime'"]]
f1 --> v2
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
v3 --"wdt:P131"--> c6
v3 --"wdt:P729"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P3999".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P625".-> v4
end