query-ea3e56a3ef9046231b3f74a9b5678ba9

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?place ?placeLabel ?location ?instanceLabel ?dist WHERE {
  SERVICE wikibase:around {     ?place wdt:P625 ?location .
 bd:serviceParam wikibase:center "Point(2.3 48.8)"^^geo:wktLiteral .
      bd:serviceParam wikibase:radius 2. # in kilometers
}  OPTIONAL {     ?place wdt:P31 ?instance .  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  BIND(geof:distance(?loc, ?location) AS ?dist) .

} ORDER BY ASC(?dist)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?dist"):::projected v4("?instance") v3("?location"):::projected v2("?place"):::projected c7(["2^^xsd:integer"]):::literal c3(["bd:serviceParam"]):::iri c5([sPoint(2.3 48.8)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c11(["en"]):::literal subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v2 --"wdt:P625"--> v3 c3 --"wikibase:center"--> c5 c3 --"wikibase:radius"--> c7 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P31".-> v4 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c3 --"wikibase:language"--> c11 end bind0[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/] null --o bind0 v3 --o bind0 bind0 --as--o v5