query-19751beed468f16b1b9f89b5e34c86c1
biblioteche in Emilia-Romagna presenti su Wikidata, di cui alcuni con coordinate geografiche SELECT DISTINCT ?item ?itemLabel ?itemDescription ?comuneLabel ?coord WHERE { {?item wdt:P31/wdt:P279 wd:Q7075} UNION {?item wdt:P31 wd:Q856584 .} ?item wdt:P131/wdt:P131/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". } }
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#>
#biblioteche in Emilia-Romagna presenti su Wikidata, di cui alcuni con coordinate geografiche
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?comuneLabel ?coord WHERE {
{?item wdt:P31/wdt:P279* wd:Q7075} UNION {?item wdt:P31 wd:Q856584 .}
?item wdt:P131/wdt:P131/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((" "))
a2((" "))
a3((" "))
c3(["wd:Q7075"]):::iri
c9(["bd:serviceParam"]):::iri
c4(["wd:Q856584"]):::iri
c6(["wd:Q1263"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en, it, fr, es, de"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c4
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"--> a2
a2 --"wdt:P131"--> a3
a3 --"wdt:P131"--> c6
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;
c9 --"wikibase:language"--> c11
end