query-2849f7bf1c30a688ecae130fafa2f1ca

rq turtle/ttl

Query #11: Visualize places within a 50-miles radius around Clark County, Nevada (only include restaurants)

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:Map
SELECT ?item ?itemLabel ?location ?layerLabel
WHERE
{ 
  wd:Q175665 wdt:P625 ?loc .
  SERVICE wikibase:around 
          { 
           ?item wdt:P625 ?location .
           bd:serviceParam wikibase:center ?loc .
           bd:serviceParam wikibase:radius "80.4672" . # 50 Miles converted to kilometers here
          }
  OPTIONAL {?item wdt:P31 ?instance}
  BIND(?instance AS ?layer) .
  BIND(geof:distance(?loc, ?location) as ?dist)
  FILTER(?instance IN (wd:Q11707)) # Filter out 'instance of' values NOT in this list
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY ASC(?layerLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?dist") v2("?instance") v4("?item"):::projected v6("?layer") v1("?layerLabel"):::projected v3("?loc") v5("?location"):::projected c5(["bd:serviceParam"]):::iri c8(["80.4672"]):::literal c12(["en"]):::literal c2(["wd:Q175665"]):::iri f0[["?instance = 'wd:Q11707'"]] f0 --> v2 c2 --"wdt:P625"--> v3 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v4 --"wdt:P625"--> v5 c5 --"wikibase:center"--> v3 c5 --"wikibase:radius"--> c8 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P31".-> v2 end bind1[/"?instance"/] v2 --o bind1 bind1 --as--o v6 bind2[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/] v3 --o bind2 v5 --o bind2 bind2 --as--o v7 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c5 --"wikibase:language"--> c12 end