query-74f7a45d31cbefd1627e523f3e3dd96b
wikibase:around not including itselfNormally when I use wikibase:around it returns the original item, but not in this case. I wonder if is because there are 2 locations. One was preferred, I changed the other temporarily to deprecated, but that made no difference.
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 WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
{
SELECT DISTINCT ?item WHERE {
# hint:Query hint:optimizer "None"
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
wd:Q26676412 wdt:P625 ?targetLoc .
SERVICE wikibase:around {
?item wdt:P625 ?location .
bd:serviceParam wikibase:center ?targetLoc .
bd:serviceParam wikibase:radius "30" .
bd:serviceParam wikibase:distance ?dist.
}
?item wdt:P31/wdt:P279* wd:Q91122. # bunker
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?dist")
v2("?item"):::projected
v3("?location")
v1("?targetLoc")
a1((" "))
c5(["wd:Q26676412"]):::iri
c4(["en-GB,en"]):::literal
c14(["wd:Q91122"]):::iri
c2(["bd:serviceParam"]):::iri
c10(["30"]):::literal
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
c5 --"wdt:P625"--> v1
subgraph s2["http://wikiba.se/ontology#around"]
style s2 stroke-width:4px;
v2 --"wdt:P625"--> v3
c2 --"wikibase:center"--> v1
c2 --"wikibase:radius"--> c10
c2 --"wikibase:distance"--> v4
end
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c14