0

I want to get all venues that have the 'maximum_capacity' property (P1083), and then I want to filter them by whether or not their lat/lon attribute intersects some polygon. I am trying to follow Wikipedia's example: https://en.wikipedia.org/wiki/GeoSPARQL

I am sure there's something about geoSPARQL I don't quite understand. I would also wish to do this in DBPedia, but I am slightly more comfortable with Wikidata for now.

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>

SELECT DISTINCT ?venueLabel ?maximum_capacity ?latlon ? 
administrative_locLabel WHERE {

  ?venue wdt:P1083 ?maximum_capacity ; wdt:P17 wd:Q30 .

  OPTIONAL{

    ?venue wdt:P625 ?latlon .

    ?venue wdt:P131 ?administrative_loc .

          }

  FILTER(geof:sfWithin(?latlon,
     "POLYGON((-77.089005 38.913574,-77.029953 38.913574,-77.029953 
38.886321,-77.089005 38.886321,-77.089005 
38.913574))"^^geo:wktLiteral))

  SERVICE wikibase:label { bd:serviceParam wikibase:language " 
[AUTO_LANGUAGE],en" }
}

You can find this query here

  • WKT geometric objects usually have a space after each comma. Try "POLYGON((-77.089005 38.913574, -77.029953 38.913574, -77.029953 38.886321, -77.089005 38.886321, -77.089005 38.913574))" – csk May 29 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.