query-bdd5b2fe636bc563047372d105e29984
https://petscan.wmflabs.org/?psid=28574588&al_commands=P131%3AQ3297056Versió PetScan excloent els que ja tenen barri: https://petscan.wmflabs.org/?psid=23944443&al_commands=P131%3AQ3297056Versió PetScan:
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 geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# coses en una el·lipse per posar barri o districte
SELECT?item ?itemLabel ?layer ?layerLabel ?coord WHERE {
?item wdt:P17 wd:Q29.
?item wdt:P131+ wd:Q1492.
?item wdt:P31 ?layer.
?item wdt:P625 ?coord.
MINUS {?item wdt:P31 wd:Q15079663}
MINUS {?item wdt:P31 wd:Q75135432}
wd:Q30269827 wdt:P625 ?focus1.
wd:Q113138252 wdt:P625 ?focus2.
BIND (geof:distance(?coord, ?focus1)+geof:distance(?coord, ?focus2) as ?d).
FILTER(?d < 1.85).
OPTIONAL {
?item wdt:P131+ ?div.
?div wdt:P31 wd:Q75135432 # barri Q75135432, districte Q790344.
}
FILTER (!BOUND(?div))
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("?coord"):::projected
v8("?d")
v1("?div")
v6("?focus1")
v7("?focus2")
v3("?item"):::projected
v4("?layer"):::projected
c9(["wd:Q75135432"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,ca,en,es,fr,de"]):::literal
c3(["wd:Q29"]):::iri
c13(["bd:serviceParam"]):::iri
c5(["wd:Q1492"]):::iri
c11(["wd:Q113138252"]):::iri
c10(["wd:Q30269827"]):::iri
c8(["wd:Q15079663"]):::iri
f0[["not bound(?div)"]]
f0 --> v1
f1[["?d < '1.85^^xsd:decimal'"]]
f1 --> v8
v3 --"wdt:P17"--> c3
v3 --"wdt:P131"--> c5
v3 --"wdt:P31"--> v4
v3 --"wdt:P625"--> v5
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P31"--> c8
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P31"--> c9
end
c10 --"wdt:P625"--> v6
c11 --"wdt:P625"--> v7
bind4[/"http://www.opengis.net/def/function/geosparql/distance(?coord,?focus1) + http://www.opengis.net/def/function/geosparql/distance(?coord,?focus2)"/]
v5 --o bind4
v6 --o bind4
v7 --o bind4
bind4 --as--o v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P131".-> v1
v1 --"wdt:P31"--> c9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end