query-09e66c1ec47a3982a993bbbae62aadcc
Propertiescoordinate location (P625)instance of (P31)
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#>
SELECT DISTINCT ?formerhospital ?formerhospitalLabel ?location ?dist
WHERE
{
wd:Q647973 wdt:P625 ?loc .
SERVICE wikibase:around {
?formerhospital wdt:P625 ?location .
bd:serviceParam wikibase:center ?loc .
bd:serviceParam wikibase:radius "20" .
}
?formerhospital wdt:P31 wd:Q64578911. #former hospital building
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
BIND(geof:distance(?loc, ?location) as ?dist)
}
ORDER BY ?dist
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?dist"):::projected
v3("?formerhospital"):::projected
v2("?loc")
v4("?location"):::projected
c4(["bd:serviceParam"]):::iri
c1(["wd:Q647973"]):::iri
c12(["en"]):::literal
c7(["20"]):::literal
c9(["wd:Q64578911"]):::iri
c1 --"wdt:P625"--> v2
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v3 --"wdt:P625"--> v4
c4 --"wikibase:center"--> v2
c4 --"wikibase:radius"--> c7
end
v3 --"wdt:P31"--> c9
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c4 --"wikibase:language"--> c12
end
bind0[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/]
v2 --o bind0
v4 --o bind0
bind0 --as--o v5