query-6d3c80fd6d1ead9fd0d409b6645d4c34
title:Pairs of churches in Lithuania that are within 25 metres of each other
SELECT ?church ?churchLabel ?churchloc ?dist ?other ?otherLabel
WHERE
{
?church wdt:P31 wd:Q16970 . # this thing is a church
?church wdt:P17 wd:Q37 . # and it's in the UK
?church wdt:P625 ?churchloc . # and it has a location
?other wdt:P31 wd:Q16970 . # another thing is also a church
SERVICE wikibase:around {
?other wdt:P625 ?otherloc .
bd:serviceParam wikibase:center ?churchloc .
bd:serviceParam wikibase:radius "0.025" . # and is pretty much exactly on the same spot (±25m)
}
FILTER (STR(?church) > STR(?other)) # filter so each pair only shows up once
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
BIND(geof:distance(?churchloc, ?otherloc) as ?dist)
}
ORDER BY ?dist
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#>
#title:Pairs of churches in Lithuania that are within 25 metres of each other
SELECT ?church ?churchLabel ?churchloc ?dist ?other ?otherLabel
WHERE
{
?church wdt:P31 wd:Q16970 . # this thing is a church
?church wdt:P17 wd:Q37 . # and it's in the UK
?church wdt:P625 ?churchloc . # and it has a location
?other wdt:P31 wd:Q16970 . # another thing is also a church
SERVICE wikibase:around {
?other wdt:P625 ?otherloc .
bd:serviceParam wikibase:center ?churchloc .
bd:serviceParam wikibase:radius "0.025" . # and is pretty much exactly on the same spot (±25m)
}
FILTER (STR(?church) > STR(?other)) # filter so each pair only shows up once
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
BIND(geof:distance(?churchloc, ?otherloc) as ?dist)
}
ORDER BY ?dist