Dear all,

after a few more tests it is starting to look like the problem is actually with 
the geof:buffer function. A full example is at the of this message. Whatever 
the function is returning, it is certainly not a 10 metre buffer around the 
point.

What could be going wrong here? If it is relevant the version I am using is 
07.20.3233.

Thank you.

SPARQL
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX ex: <https://example.com#>

SELECT geof:buffer(?lit_b, 10, <http://www.opengis.net/def/uom/OGC/1.0/metre>)
FROM <https://example.com#>
WHERE {
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 (;)> callret-0
LONG VARCHAR
_______________________________________________________________________________

POLYGON((61 51,60.807852804032 49.049096779839,60.238795325113 
47.173165676349,59.314696123025 45.444297669804,58.071067811865 
43.928932188135,56.555702330196 42.685303876975,54.826834323651 
41.761204674887,52.950903220161 41.192147195968,51 41,49.049096779839 
41.192147195968,47.173165676349 41.761204674887,45.444297669804 
42.685303876975,43.928932188135 43.928932188135,42.685303876975 
45.444297669804,41.761204674887 47.173165676349,41.192147195968 
49.049096779839,41 51,41.192147195968 52.950903220161,41.761204674887 
54.826834323651,42.685303876975 56.555702330196,43.928932188134 
58.071067811865,45.444297669804 59.314696123025,47.173165676349 
60.238795325113,49.049096779839 60.807852804032,51 61,52.950903220161 
60.807852804032,54.826834323651 60.238795325113,56.555702330196 
59.314696123025,58.071067811865 58.071067811865,59.314696123025 
56.555702330196,60.238795325113 54.826834323651,60.807852804032 
52.950903220161,61 51))
1 Rows. -- 29 msec.

--
Luís
------- Original Message -------
On Tuesday, May 10th, 2022 at 9:25 AM, Luí­s Moreira de Sousa via 
Virtuoso-users <virtuoso-users@lists.sourceforge.net> wrote:

> 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

Reply via email to