query-fdbe08c0dc5b9fcf7bcf15e80fd3fbf1
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#>
# coses de Barcelona sense barri ni districte
SELECT DISTINCT ?item ?itemLabel ?layer ?layerLabel ?coord WHERE {
?item wdt:P31 ?layer.
?item wdt:P131+ wd:Q1492.
?item wdt:P625 ?coord.
OPTIONAL {
?item wdt:P131+ ?districte.
?districte wdt:P31 wd:Q790344.
}
OPTIONAL {
?item wdt:P131+ ?barri.
?barri wdt:P31 wd:Q75135432.
}
BIND (COALESCE (?barri, ?districte) AS ?div).
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" .
}
FILTER (!BOUND(?div))
}
#defaultView:Map
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?barri")
v4("?coord"):::projected
v5("?districte")
v7("?div")
v2("?item"):::projected
v3("?layer"):::projected
c8(["bd:serviceParam"]):::iri
c6(["wd:Q75135432"]):::iri
c3(["wd:Q1492"]):::iri
c5(["wd:Q790344"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,ca,en,es,fr,de"]):::literal
f0[["not bound(?div)"]]
f0 --> v7
v2 --"wdt:P31"--> v3
v2 --"wdt:P131"--> c3
v2 --"wdt:P625"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P131".-> v5
v5 --"wdt:P31"--> c5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P131".-> v6
v6 --"wdt:P31"--> c6
end
bind1[/"?barri?districte"/]
v6 --o bind1
v5 --o bind1
bind1 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end