GraphDB geof:两点之间的距离返回空字段-geosparql

时间:2019-06-25 07:49:01

标签: distance ontology querying graphdb geosparql

我正在使用GraphDB,并希望通过使用geosparql计算两点之间的geof:距离。 ?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)


} 

0 个答案:

没有答案