2

Hello everyone and have a Happy New Year!! I am using an StSparql/Geosparql endpoint and I have a spatial dataset which has geometries for lakes and rivers. My goal is to try and find all the lakes and rivers which intersect each other and display them on a map. I tried something simple like the following:

 SELECT ?s1 ?s2
WHERE 
{
?s1 geo:hasGeometry [ geo:asWKT ?o1 ] .
?s2 geo:hasGeometry [ geo:asWKT ?o2 ] .
FILTER(geof:sfIntersects(?o1, ?o2)).
} 

Or to be more exact, something more precise like this:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geor: <http://www.opengis.net/def/rule/geosparql/>
PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>>
PREFIX gag: <http://geo.linkedopendata.gr/gag/ontology/>
PREFIX water: <http://geo.linkedopendata.gr/water-bodies/ontology/>

    SELECT (geof:intersection(?river,geof:union(?lake)) AS ?TotalArea)
    WHERE
    {
    
      ?r  rdf:type water:Ποτάμι.
      ?r  water:είναι_το_υδάτινο_σώμα ?o.
      ?o  water:έχει_όνομα ?k.
      ?o  geo:hasGeometry ?rg.
      ?rg geo:asWKT ?river.
    
      ?l  rdf:type water:Λίμνη.
      ?l  water:είναι_το_υδάτινο_σώμα ?z.
      ?z  geo:hasGeometry ?lg.
      ?lg geo:asWKT ?lake.
    
    FILTER(geof:sfIntersects(?river ,?lake ))
    }

I also tried to place geof:buffer on ?river or ?lake, but I can't take back the whole area of the intersected rivers and lakes, and instead I get the following error:

org.openrdf.sail.rdbms.exceptions.RdbmsQueryEvaluationException: org.postgresql.util.PSQLException: ERROR: GEOSIntersects: TopologyException: side location conflict at 22.958592013338393 40.590552060768502 SELECT έ2.obj, l_k.value, NULL , NULL FROM triples_1 t0 INNER JOIN triples_6 ε1 ON (ε1.subj = t0.subj) INNER JOIN triples_19 έ2 ON (έ2.subj = ε1.obj) INNER JOIN hasgeometry_12 h3 ON (h3.subj = ε1.obj) INNER JOIN aswkt_26 a4 ON (a4.subj = h3.obj) INNER JOIN geo_values l_river ON (l_river.id = a4.obj) INNER JOIN geo_values l_lake ON ((ST_Intersects(l_river.strdfgeo,l_lake.strdfgeo))) INNER JOIN aswkt_26 a6 ON (a6.obj = l_lake.id) INNER JOIN hasgeometry_12 h7 ON (h7.obj = a6.subj) INNER JOIN triples_6 ε8 ON (ε8.obj = h7.subj) INNER JOIN triples_1 t9 ON (t9.obj = ? AND t9.subj = ε8.subj) LEFT JOIN label_values l_k ON (l_k.id = έ2.obj) WHERE t0.obj = ?

I have changed many things, but the error persists, and every time is almost similar to what i posted. I have also tried different functions such as geof:sfTouches or geof:sfContains etc... but I can't understand why it doesn't work... Anyone any ideas ??

0 Answers0