I have inspired this articles and created an ontology with using geosparql ontology. Two classes named Area and Park were created as subclasses of the Feature class of geosparql. 3 Area instances and 1 Park instance were added to the ontology. Then, geometry instances were created (asWKT) as a subclass of Polygon class of geosparql. And the geometry instances were related with the Park and Area instances via hasGeometry object property (The created ontology and instances).
I have tried to make a topology query to find out which Area instances are within the Park instance. So, I have run the below query with using the sparql query plugin of Protégé 4.3.
PREFIX geosparql: http://www.opengis.net/ont/geosparql# PREFIX su: http://www.example.org/su#
SELECT ?x ?y WHERE { ?x a su:Area ; geosparql:hasGeometry ?xgeo . ?y a su:Park ; geosparql:hasGeometry ?ygeo . ?xgeo geosparql:sfWithin ?ygeo . }
No results return but I know that there are two Area instances within the Park instance. I did not find out the problem. Do not I query topological relations with using geosparql and protégé?
The problem is you don't import the "good" use of
sfWithin
entity.There is a difference between
http://www.opengis.net/ont/geosparql#sfWithin
andhttp://www.opengis.net/def/function/geosparql/sfWithin
.Actually, I don't understand yet how to proceed in Protégé with this statement, I'm sorry about that.
If you really need to use such a topology query, you can use GraphDB instead, which implements a good working plugin for GeoSPARQL.