query-ea3100275af9c714ae515fd1e099ff63
Using wikibase:around with an indirection
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#>
SELECT DISTINCT ?item ?itemLabel ?locationsLabel ?targetLoc WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
{
SELECT DISTINCT ?item ?locations ?targetLoc WHERE {
wd:Q111529510 wdt:P276 ?locations. ?locations wdt:P625 ?targetLoc .
SERVICE wikibase:around {
?item wdt:P625 ?location .
#?item wdt:P276 ?locations. ?locations wdt:P625 ?location .
bd:serviceParam wikibase:center ?targetLoc .
bd:serviceParam wikibase:radius "1" .
bd:serviceParam wikibase:distance ?dist.
}
#FILTER (EXISTS {?item wdt:P31* wd:Q1958056})
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?dist")
v3("?item"):::projected
v4("?location")
v1("?locations")
v2("?targetLoc"):::projected
c11(["1"]):::literal
c2(["bd:serviceParam"]):::iri
c4(["en-GB,en"]):::literal
c5(["wd:Q111529510"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
c5 --"wdt:P276"--> v1
v1 --"wdt:P625"--> v2
subgraph s2["http://wikiba.se/ontology#around"]
style s2 stroke-width:4px;
v3 --"wdt:P625"--> v4
c2 --"wikibase:center"--> v2
c2 --"wikibase:radius"--> c11
c2 --"wikibase:distance"--> v5
end