query-1fe31ffafb40cc6472eec3a4cf50c6b0
edificis de Barcelona sense barri SELECT DISTINCT ?edifici ?edificiLabel WITH { SELECT ?edifici WHERE { ?edifici wdt:P131 wd:Q1492. } } AS %1 WHERE { INCLUDE %1. ?edifici wdt:P31/wdt:P279 wd:Q41176. OPTIONAL { ?edifici wdt:P131+ ?div. ?div wdt:P31 wd:Q790344 # barri Q75135432, districte Q790344. } FILTER (!BOUND(?div)) SERVICE wikibase:label { bd:serviceParam wikibase:language "ca" . } }
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#>
# edificis de Barcelona sense barri
SELECT DISTINCT ?edifici ?edificiLabel
WHERE {
{
SELECT ?edifici
WHERE {
?edifici wdt:P131* wd:Q1492.
} }
?edifici wdt:P31/wdt:P279* wd:Q41176.
OPTIONAL {
?edifici wdt:P131+ ?div.
?div wdt:P31 wd:Q790344 # barri Q75135432, districte Q790344.
}
FILTER (!BOUND(?div))
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?div")
v2("?edifici"):::projected
a1((" "))
c8(["bd:serviceParam"]):::iri
c2(["wd:Q1492"]):::iri
c6(["wd:Q790344"]):::iri
c5(["wd:Q41176"]):::iri
c10(["ca"]):::literal
f0[["not bound(?div)"]]
f0 --> v1
v2 --"wdt:P131"--> c2
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P131".-> v1
v1 --"wdt:P31"--> c6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end