query-5095908165a853580f4872237438bba2

rq turtle/ttl

Propertiescoordinate location (P625)instance of (P31)operator (P137)

Use at

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#>
#defaultView:Table
SELECT DISTINCT ?place ?placeLabel ?location ?dist
  WHERE
  {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
  wd:Q6840942 wdt:P625 ?loc .
  SERVICE wikibase:around {
            ?place wdt:P625 ?location .
              bd:serviceParam wikibase:center ?loc .
              bd:serviceParam wikibase:radius "20" .
   }
   ?place wdt:P31 wd:Q55488. {?place wdt:P137 wd:Q107980329.} UNION {?place wdt:P137 wd:Q18208626.}.
   BIND(geof:distance(?loc, ?location) as ?dist)
} ORDER BY ?dist LIMIT 1

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?dist"):::projected v2("?loc") v4("?location"):::projected v3("?place"):::projected c5(["wd:Q6840942"]):::iri c4(["en"]):::literal c14(["wd:Q107980329"]):::iri c2(["bd:serviceParam"]):::iri c15(["wd:Q18208626"]):::iri c12(["wd:Q55488"]):::iri c10(["20"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end c5 --"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"--> c10 end v3 --"wdt:P31"--> c12 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P137"--> c15 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P137"--> c14 end union0r <== or ==> union0l end bind0[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/] v2 --o bind0 v4 --o bind0 bind0 --as--o v5