query-839147f3349487285965734df733745e
12:07, 29 April 2024 (UTC)) talk (Arided Unable to display result: MapError/warning message: . Here's a version that works and gets an image from Wikimedia Commons if one is available: (P625)coordinate location Hi, this query looks a bit overcomplicated, which is why it was timing out. The title at the start needs to be prefixed with "title:" which is why you were getting that error. Maps need co-ordinate locations, which you get using the property
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#>
#title:Map of hospitals
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coords ?image WHERE {
?item wdt:P31/wdt:P279? wd:Q16917. # Hospital or type of hospital
?item wdt:P131/wdt:P131? wd:Q23169. # In Oxfordshire or a (part of)* Oxfordshire
?item wdt:P625 ?coords. # get longitude and latitude
OPTIONAL{?item wdt:P18 ?image}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?coords"):::projected
v3("?image"):::projected
v1("?item"):::projected
a1((" "))
a2((" "))
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;"]):::literal
c2(["wd:Q16917"]):::iri
c5(["wd:Q23169"]):::iri
v1 --"wdt:P31"--> a1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a1 --"wdt:P279"--> c2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
end
union0r <== or ==> union0l
end
v1 --"wdt:P131"--> a2
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
a2 --"wdt:P131"--> c5
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
end
union1r <== or ==> union1l
end
v1 --"wdt:P625"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P18".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end