query-57a2485449de65b61f5bd969a05db4d4
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 segons el barri o districte
SELECT DISTINCT ?instLabel ?item ?itemLabel ?layer ?layerLabel ?coord WHERE {
?item wdt:P31 ?inst.
?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 ?layer).
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" .
}
}
#defaultView:Map
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?barri")
v3("?coord"):::projected
v4("?districte")
v2("?inst")
v1("?item"):::projected
v6("?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
v1 --"wdt:P31"--> v2
v1 --"wdt:P131"--> c3
v1 --"wdt:P625"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P131".-> v4
v4 --"wdt:P31"--> c5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P131".-> v5
v5 --"wdt:P31"--> c6
end
bind0[/"?barri?districte"/]
v5 --o bind0
v4 --o bind0
bind0 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end