query-ce887b460647e8bd9b14547f997266ba
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#>
#castelli in Emilia-Romagna presenti su Wikidata e con coordinate
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?comuneLabel ?coord WHERE {
{?item wdt:P31/wdt:P279* wd:Q23413 } UNION {?item wdt:P31 wd:Q856584 .} UNION {?item wdt:P31 wd:Q17715832 .}
?item (wdt:P131)* wd:Q1263 .
?item wdt:P131 ?comune .
?comune wdt:P625 ?comunecoord .
OPTIONAL { ?item wdt:P625 ?itemcoord . }
BIND(IF(BOUND(?itemcoord),?itemcoord,?comunecoord) AS ?coord)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en, it, fr, es, de". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?comune")
v3("?comunecoord")
v5("?coord"):::projected
v1("?item"):::projected
v4("?itemcoord")
a1((" "))
c10(["bd:serviceParam"]):::iri
c4(["wd:Q856584"]):::iri
c7(["wd:Q1263"]):::iri
c5(["wd:Q17715832"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en, it, fr, es, de"]):::literal
c3(["wd:Q23413"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c5
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c4
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
end
union0r <== or ==> union0l
end
v1 --"wdt:P131"--> c7
v1 --"wdt:P131"--> v2
v2 --"wdt:P625"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P625".-> v4
end
bind0[/"if(bound(?itemcoord),?itemcoord,?comunecoord)"/]
v4 --o bind0
v3 --o bind0
bind0 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end