query-4562660c38b5127f4a0c599b17612558
Display villages within the specific radius from a specific place SELECT ?place ?placeLabel ?plwp ?location WITH { SELECT ?place (SAMPLE(?location) AS ?location) { wd:Q6895050 wdt:P625 ?polvillLoc . SERVICE wikibase:around { ?place wdt:P625 ?location. bd:serviceParam wikibase:center ?polvillLoc; wikibase:radius "55". } ?place wdt:P31 wd:Q55488 . } GROUP BY ?place } AS %i WHERE { include %i OPTIONAL { ?plwp schema:about ?place; schema:isPartOf https://pl.wikipedia.org/ . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],pl,cs,de". } }
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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Display villages within the specific radius from a specific place
SELECT ?place ?placeLabel ?plwp ?location WHERE {
{
SELECT ?place (SAMPLE(?location) AS ?location) {
wd:Q6895050 wdt:P625 ?polvillLoc .
SERVICE wikibase:around {
?place wdt:P625 ?location.
bd:serviceParam wikibase:center ?polvillLoc;
wikibase:radius "55".
}
?place wdt:P31 wd:Q55488 .
}
GROUP BY ?place
} OPTIONAL { ?plwp schema:about ?place; schema:isPartOf <https://pl.wikipedia.org/> . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],pl,cs,de". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?location"):::projected
v2("?place"):::projected
v4("?plwp"):::projected
v1("?polvillLoc")
c7(["55"]):::literal
c15(["#91;AUTO_LANGUAGE#93;,pl,cs,de"]):::literal
c1(["wd:Q6895050"]):::iri
c4(["bd:serviceParam"]):::iri
c12([https://pl.wikipedia.org/]):::iri
c9(["wd:Q55488"]):::iri
c1 --"wdt:P625"--> v1
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v2 --"wdt:P625"--> v4
c4 --"wikibase:center"--> v1
c4 --"wikibase:radius"--> c7
end
v2 --"wdt:P31"--> c9
bind1[/"sample(?location)"/]
v4 --o bind1
bind1 --as--o v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."schema:about".-> v2
v4 --"schema:isPartOf"--> c12
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c4 --"wikibase:language"--> c15
end