0

我正在使用 GraphDB 并想使用 geosparql 计算两点之间的 geof:distance。?point 和 ?point2 是几何结构,结构如下"POINT(-77.050125 38.892086)"^^<http://www.opengis.net/ont/geosparql#wktLiteral>。但是由于某种原因,查询中的字段 dist 仍然为空。为什么我无法理解。我已经启用了 geosparql。

我的代码如下:

    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX : <http://www.semanticweb.org/evangelos/ontologies/2019/2/untitled-ontology-2#>
    prefix geo: <http://www.opengis.net/ont/geosparql#>
    prefix geof: <http://www.opengis.net/def/function/geosparql/>
    prefix unit: <http://qudt.org/vocab/unit#>
    prefix sf: <http://www.opengis.net/ont/sf#>
    prefix test24: <http://www.semanticweb.org/evangelos/ontologies/2019/2/untitled-ontology-2#>

SELECT ?point2 (geof:distance(?point, ?point2, unit:Kilometer) as ?dist)

    WHERE
    {
        :MouseioMetaksisSoufliou :hasGPSCoordinates ?geom2.
        ?geom2 geo:asWKT ?point.
        ?geom3 geo:asWKT ?point2.
        FILTER (?geom2 != ?geom3).
    } 

这很好用。我认为 unit# 本体可能会导致问题

这是我的工作代码

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.semanticweb.org/evangelos/ontologies/2019/2/untitled-ontology-2#>
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
prefix sf: <http://www.opengis.net/ont/sf#>
prefix test24: <http://www.semanticweb.org/evangelos/ontologies/2019/2/untitled-ontology-2#>

SELECT ?point10 ((geof:distance(?point10, ?point11, uom:metre) < 2000) as ?dist)
WHERE
{
    :MouseioMetaksisSoufliou :hasGPSCoordinates ?geom2.
    ?geom2 geo:asWKT ?point.
    ?geom3 geo:asWKT ?point2.
    FILTER(!sameTerm(?geom2, ?geom3)).    
    BIND(CONCAT("<http://www.opengis.net/def/crs/OGC/1.3/CRS84> ", STR(?point))    as ?point5)
    BIND(CONCAT(STR(?point5), "^^geo:wktLiteral") as ?point10)
    BIND(CONCAT("<http://www.opengis.net/def/crs/OGC/1.3/CRS84> ", STR(?point2))    as ?point6)
    BIND(CONCAT(STR(?point6), "^^geo:wktLiteral") as ?point11)


} 
4

0 回答 0