query-805161b37fdb6392819c854b7f13ec30

rq turtle/ttl

Modify a query to cast the same globe 08:28, 4 November 2020 (UTC) 💛●✒️●💬 Bouzinac. Thanks! in the same globeHello, I'd like to modify this query so that the given item (Q867556 in this example)'s globe should also be used to filter anything that is in a 10-km radius around the point of Q867556,

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#>
SELECT ?globe ?place ?placeLabel ?location ?instanceLabel ?dist WHERE {
  wd:Q867556 wdt:P625 ?loc .
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc.
      bd:serviceParam wikibase:geoGlobe ?globe . 
      bd:serviceParam wikibase:radius 10 . # in kilometers
  }
 # FILTER ( ?globe = wd:Q2 )
  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; v7("?dist"):::projected v5("?globe"):::projected v6("?instance") v2("?loc") v4("?location"):::projected v3("?place"):::projected c4(["bd:serviceParam"]):::iri c12(["en"]):::literal c1(["wd:Q867556"]):::iri c8(["10^^xsd:integer"]):::literal c1 --"wdt:P625"--> v2 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v3 --"wdt:P625"--> v4 c4 --"wikibase:center"--> v2 c4 --"wikibase:geoGlobe"--> v5 c4 --"wikibase:radius"--> c8 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> v6 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c4 --"wikibase:language"--> c12 end bind0[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/] v2 --o bind0 v4 --o bind0 bind0 --as--o v7