大家好,新年快乐!!我正在使用StSparql/Geosparql 端点,并且我有一个空间数据集,其中包含湖泊和河流的几何形状。我的目标是尝试找到所有相互交叉的湖泊和河流,并将它们显示在地图上。我尝试了一些简单的方法,如下所示:
SELECT ?s1 ?s2
WHERE
{
?s1 geo:hasGeometry [ geo:asWKT ?o1 ] .
?s2 geo:hasGeometry [ geo:asWKT ?o2 ] .
FILTER(geof:sfIntersects(?o1, ?o2)).
}
或者更准确地说,像这样更精确的东西:
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 ))
}
我也尝试在 ?river 或 ?lake 上放置 geof:buffer,但我无法收回相交的河流和湖泊的整个区域,而是出现以下错误:
org.openrdf.sail.rdbms.exceptions.RdbmsQueryEvaluationException:org.postgresql.util.PSQLException:错误:GEOSIntersects:TopologyException:侧位置冲突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 有(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 = ?
我已经更改了很多东西,但是错误仍然存在,并且每次都与我发布的内容几乎相似。我也尝试过不同的功能,例如 geof:sfTouches 或 geof:sfContains 等...但我不明白为什么它不起作用...任何想法?