Can we have the equivalent of a spatial selection geof:sfIntersects?

Hi, is it possible to have spatial selection (geof:sfIntersects) against a WKT literal?

By using the equivalent geof:relate(?g1, ?g2, geo:intersects) it is clear that ?g2 must be a geometry.

Obviously one way would be to create (insert) a few triples with an imaginary geometry which would be linked to the WKT literal, but that is not satisfactory in general.

Thanks

not sure if I understand correctly, but in GeoSPARQL

  • you either use the relation as a property function (e.g. geo:sfIntersects) which then expects a geometry or a feature (there are rewriting rules in the GeoSPARQL standard, in the end it's nothing more then convenience and sometimes also needs inferencing enabled to infer that something is a geo:Feature or a geo:Geometry)
  • or you use the filter expression (e.g. geof:sfIntersects) which works only the serialization literal level and expects literals

So it's not necessary to create geometries.

SELECT * {
:myGeometry geo:sfIntersects ?geo
}

vs

SELECT * {
:s hasGeometry [geo:asWKTLiteral ?lit ] .
FILTER(geof:sfIntersects("Point (12.2 12.3)"^^geo:wktLiteral, ?lit)
}

Note, geo: vs geof:prefix - this is what matters,

Appendix:
that would be the rewrite extension when using a topological relation as property function:

Forall ?f1 ?f2 ?g1 ?g2 ?g1Serial ?g2Serial
    (?f1[ogc:relation->?f2] :-
        Or(
            And
                # feature – feature rule
                (?f1[geo:hasDefaultGeometry->?g1]
                 ?f2[geo:hasDefaultGeometry->?g2]
                 ?g1[ogc:asGeomLiteral->?g1Serial]
                 ?g2[ogc:asGeomLiteral->?g2Serial]
                 External(ogc:function (?g1Serial,?g2Serial)))
            And
                # feature – geometry rule
                (?f1[geo:hasDefaultGeometry->?g1]
                 ?g1[ogc:asGeomLiteral->?g1Serial]
                 ?f2[ogc:asGeomLiteral->?g2Serial]
                 External(ogc:function (?g1Serial,?g2Serial)))
            And
                # geometry - feature rule
                (?f2[geo:hasDefaultGeometry->?g2]
                 ?f1[ogc:asGeomLiteral->?g1Serial]
                 ?g2[ogc:asGeomLiteral->?g2Serial]
                 External(ogc:function (?g1Serial,?g2Serial)))
            And
                # geometry - geometry rule
                (?f1[ogc:asGeomLiteral->?g1Serial]
                 ?f2[ogc:asGeomLiteral->?g2Serial]
                 External(ogc:function (?g1Serial,?g2Serial)))
    )
)

Hi, I have a sound understanding of the GeoSPARQL standard.

As you very well described it I do have two options for checking the "intersects" spatial relation between two objects with spatial extent:

  1. Geometry Topology Extension
    geof:sfIntersects(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral): xsd:boolean

or

  1. Topology Vocabulary Extension
    geo:sfIntersects with geo:SpatialObject as domain and range.

Stardog does not seem to support either version of the GeoSPARQL standard (geof:sfIntersects, geo:sfIntersects).

The Query Rewrite Extension defines a set of RIF rules [15] that use topological
extension functions defined in Geometry Topology Extension (Ch.9) to establish the existence of direct topological predicates defined in Topology Vocabulary Extension (Ch. 7).

Now my question is this. Is there any way I express a spatial selection query, like the one you included in your answer, in Stardog:

SELECT * {
:s hasGeometry [geo:asWKTLiteral ?lit ] .
FILTER(geof:sfIntersects("Point (12.2 12.3)"^^geo:wktLiteral, ?lit)
}

Also you can check in my other post/question " [Geof:relate boolean function returns incosistent results compared to the predicate form (BGP)]" for a sample dataset with inconsistencies between the two forms of the geof:relate function/predicate.

Thank you in advance