query-675ce4a0f9377a16d8fba36d1a002708

rq turtle/ttl

Get wikidata item without URLI'm trying to write a query returning all wikidata items with coordinates inside a bounding box.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT  ?wikidata ?placeLabel ?whatisitLabel ?location ?latitude ?longitude WHERE {
  SERVICE wikibase:box {
    ?place wdt:P625 ?location .
    bd:serviceParam wikibase:cornerSouthWest "Point(82.5 35)"^^geo:wktLiteral .
    bd:serviceParam wikibase:cornerNorthEast "Point(93 43)"^^geo:wktLiteral .
  }
  OPTIONAL {?place wdt:P31 ?whatisit.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,es,it,ru,zh". }
  ?place p:P625 ?statement . # coordinate-location statement
  ?statement psv:P625 ?coordinate_node .
  ?coordinate_node wikibase:geoLatitude ?latitude .
  ?coordinate_node wikibase:geoLongitude ?longitude .
  BIND (?place AS ?wikidata).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,es,it,ru". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?coordinate_node") v6("?latitude"):::projected v2("?location"):::projected v7("?longitude"):::projected v1("?place") v4("?statement") v3("?whatisit") v8("?wikidata"):::projected c7([sPoint(93 43)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c11(["en,de,fr,es,it,ru,zh"]):::literal c5([sPoint(82.5 35)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c16(["en,de,fr,es,it,ru"]):::literal c3(["bd:serviceParam"]):::iri subgraph s1["http://wikiba.se/ontology#box"] style s1 stroke-width:4px; v1 --"p:direct/P625"--> v2 c3 --"wikibase:cornerSouthWest"--> c5 c3 --"wikibase:cornerNorthEast"--> c7 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P31".-> v3 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c3 --"wikibase:language"--> c11 end v1 --"p:P625"--> v4 v4 --"p:statement/value/P625"--> v5 v5 --"wikibase:geoLatitude"--> v6 v5 --"wikibase:geoLongitude"--> v7 bind0[/"?place"/] v1 --o bind0 bind0 --as--o v8 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c3 --"wikibase:language"--> c16 end