graphdbgeosparql

area not calculated in graphdb


enter image description hereI need to calculate Area but there is an error Query evaluation error: Unknown function 'http://www.opengis.net/def/function/geosparql/area' (HTTP status 500) By following query in the image

But it works in stardog, see image please

Thanks for your reply in advance


Solution

  • geof:area does not appear to be a part of the core GeoSPARQL specification, so Stardog must have created an extension on it. GraphDB does not have the exact same extensions. Instead, it uses the uSeekM function and its prefix, http://rdf.useekm.com/ext#

    So, your query would look something like this:

    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 ext: <http://rdf.useekm.com/ext#>
    
    SELECT  ?a ?area
    WHERE {
         ?a geo:hasGeometry ?g1 .
         ?g1 geo:asWKT ?lit     
    BIND(ext:area(?lit) as ?area).
    }