query-11376abae34afb672cbe1da21ef496e9

rq turtle/ttl

Consulta de elementos geolocalizados alrededor de un punto predeterminado

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#>
SELECT ?place ?placeLabel ?dist (SAMPLE(?image) AS ?image)
      WHERE
      {
        SERVICE wikibase:around {
            ?place wdt:P625 ?location .
            bd:serviceParam wikibase:center "Point(${longitude} ${latitude})"^^geo:wktLiteral .
            bd:serviceParam wikibase:radius "10" .
        }
        ?place wdt:P1435 ?monument .
        OPTIONAL { ?place wdt:P18 ?image . }
        SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.map(lang => lang.code).join(',')}" }
        BIND(geof:distance("Point(${longitude} ${latitude})"^^geo:wktLiteral, ?location) as ?dist) 
      }
      GROUP BY ?place ?placeLabel ?dist
      ORDER BY ?dist

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?dist"):::projected v6("?image"):::projected v3("?location") v4("?monument") v2("?place"):::projected c5([sPoint(${longitude} ${latitude})^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c3(["bd:serviceParam"]):::iri c12(["${langs.map(lang => lang.code).join(',')}"]):::literal c7(["10"]):::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 v2 --"wdt:P1435"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v6 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c3 --"wikibase:language"--> c12 end bind0[/"http://www.opengis.net/def/function/geosparql/distance(sPoint(${longitude} ${latitude})^^<http://www.opengis.net/ont/geosparql#wktLiteral>',?location)"/] v3 --o bind0 bind0 --as--o v6 bind2[/"sample(?image)"/] v6 --o bind2 bind2 --as--o v6