query-44d9e05ba4be25a404b3c22c52b4fef7
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?opened
WHERE
{
?item wdt:P31 wd:Q928830. # it's a metro station
{?item wdt:P131/wdt:P131* wd:Q64 .} # located in Berlin
UNION
{?item wdt:P131/wdt:P131* wd:Q821435 .} # or a borough of Berlin
OPTIONAL { ?item wdt:P1619 ?opened . } # it may have an opening date
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?opened"):::projected
a1((" "))
a2((" "))
c2(["wd:Q928830"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,de"]):::literal
c5(["wd:Q821435"]):::iri
c8(["bd:serviceParam"]):::iri
c4(["wd:Q64"]):::iri
v1 --"wdt:P31"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P131"--> a2
a2 --"wdt:P131"--> c5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P131"--> a1
a1 --"wdt:P131"--> c4
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P1619".-> v2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end