-
I'm trying to understand how GeoSPARQL functions are supposed to work. I have this query: PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX gtfs: <http://vocab.gtfs.org/terms#>
SELECT ?sub ?shape WHERE {
# Get the geometry of the municipality
<https://geo.ld.admin.ch/boundaries/municipality/5072:2024> geo:defaultGeometry/geo:asWKT ?geo .
# Get the public transport stops
?sub a gtfs:Stop ;
geo:hasGeometry/geo:asWKT ?shape .
# Filter stops that are within the municipality geometry
FILTER(geo:sfWithin(?shape, ?geo))
} So I have a But the query does not work, according to the spec the function should be in the "Not supported: Function "http://www.opengis.net/ont/geosparql#sfWithin" is currently not supported by QLever." You can try it at our qlever instance here: Any ideas of what I do wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The list of the currently implemented As I understand it, you should use some tool to pre-calculate for your dataset(s) any other relations that you need in your queries. E.g. osm2rdf produces triples for the following relations: In the end, a query like this works for the data from OSM: https://qlever.cs.uni-freiburg.de/osm-planet/uqRIdh PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX ogc: <http://www.opengis.net/rdf#>
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
SELECT ?osm_id ?public_transport_type ?geometry WHERE {
# features in OSM contained by Faido
osmrel:1684675 ogc:sfContains ?osm_id .
# features that have a public transport type
?osm_id osmkey:public_transport ?public_transport_type .
# the geometries of the features
?osm_id geo:hasGeometry/geo:asWKT ?geometry .
} |
Beta Was this translation helpful? Give feedback.
-
@ktk Somewhat confusingly, the GeoSPARQL standard supports two notations for specifying a spatial join:
These two are 100% equivalent. QLever currently only supports syntax 1. Of course, we should also add support for syntax 2. |
Beta Was this translation helpful? Give feedback.
The list of the currently implemented
geof
functions seems to be short and only support geometries that are points:geof:distance (?x, ?y)
,geof:latitude (?x)
,geof:longitude (?x)
[source]As I understand it, you should use some tool to pre-calculate for your dataset(s) any other relations that you need in your queries. E.g. osm2rdf produces triples for the following relations:
ogc:sfContains, ogc:sfCovers, ogc:sfIntersects, ogc:sfEquals, ogc:sfTouches, ogc:sfCrosses, ogc:sfOverlaps
[source]In the end, a query like this works for the data from OSM: https://qlever.cs.uni-freiburg.de/osm-planet/uqRIdh