Dear all,
I am currently unable to use the geof:sfIntersects function as it produces
unexpected results. As an example consider the following graph:
@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix ex: <https://example.com#> .
ex:point_a a geo:Point ;
geo:asWKT "POINT(50 50)"^^geo:wktLiteral .
ex:point_b a geo:Point ;
geo:asWKT "POINT(51 51)"^^geo:wktLiteral .
The use case is to identify points that lay within a certain distance from each
other. This can be obtained with a query like:
SPARQL
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX ex: <https://example.com#>
SELECT geo:sfIntersects(?lit_a, geof:buffer(?lit_b, 10,
<http://www.opengis.net/def/uom/OGC/1.0/metre>))
FROM <https://example.com#>
WHERE {
ex:point_a geo:asWKT ?lit_a .
ex:point_b geo:asWKT ?lit_b .
};
Which produces the following result:
INTEGER NOT NULL
_______________________________________________________________________________
1
1 Rows. -- 6 msec.
One obvious problem is the return type, it should be a xsd:boolean literal (OGC
11-052r4
Table 5), but is an integer instead (also not xsd:integer). But beyond that, it
seems to point to a "true", whereas those two points lay much farther apart
than 10 metres.
As a sanity check, with a buffer of width zero the result is 0 (again integer
type):
SQL> SPARQL
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX ex: <https://example.com#>
SELECT geo:sfIntersects(?lit_a, geof:buffer(?lit_b, 0,
<http://www.opengis.net/def/uom/OGC/1.0/metre>))
FROM <https://example.com#>
WHERE {
ex:point_a geo:asWKT ?lit_a .
ex:point_b geo:asWKT ?lit_b .
};
Type the rest of statement, end with a semicolon (;)> Type the rest of
statement, end with a semicolon (;)> Type the rest of statement, end with a
semicolon (;)> Type the rest of statement, end with a semicolon (;)> Type the
rest of statement, end with a semicolon (;)> Type the rest of statement, end
with a semicolon (;)> Type the rest of statement, end with a semicolon (;)>
Type the rest of statement, end with a semicolon (;)> Type the rest of
statement, end with a semicolon (;)> Type the rest of statement, end with a
semicolon (;)> callret-0
INTEGER NOT NULL
_______________________________________________________________________________
0
1 Rows. -- 5 msec.
Looks like something is going wrong. How can I obtain a correct result from
geof:sfIntersects?
Thank you.
--
Luís
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users