Theofilos Ioannidis
Theofilos Ioannidis

Reputation: 45

RDF4J 2.4.0-M3 GeoSPARQL query not working

Hi I am using the latest version RDF4J 2.4.0-M3 and I am trying to execute the following query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX lgd: <http://data.linkedeodata.eu/ontology#>
 SELECT ?s1 ?o1 WHERE {
 ?s1 geo:asWKT ?o1 .
  FILTER(geof:sfIntersects(?o1, "POINT (-3.9468805 51.618055)"^^<http://www.opengis.net/ont/geosparql#wktLiteral>)).
}

The expected result is the following:

s1                                           o1
http://data.linkedeodata.eu/osm/wales/transport/Geometry/16202470   MULTIPOLYGON (((-3.9469452 51.6180887, -3.9467408 51.6183097, -3.9464539 51.6182493, -3.9457195 51.6174283, -3.9459201 51.617293, -3.9460423 51.6171659, -3.9462114 51.6174525, -3.9463139 51.6175729, -3.9466882 51.6179044, -3.9469452 51.6180887)))

The same dataset has been loaded with GraphDB v8.5 and RDF4J 2.4.0-M3, the repositories verified.

The java error I received is the following: java error executing query of RDF4J repo

I have used the correct dependency for the BOM and rdf4j-queryalgebra-geosparql.

My dataset contains POINT, POLYGON, MULTIPOLYGON.

Any help will be appreciated.

Upvotes: 2

Views: 70

Answers (1)

Jeen Broekstra
Jeen Broekstra

Reputation: 22053

This is a bug in the maven dependency definitions in RDF4J 2.4 milestone 3 - for some reason it grabs the wrong version of the spatial4j library. Issue has been logged at https://github.com/eclipse/rdf4j-storage/issues/108.

Workaround is to add an explicit dependency for the correct version in your project pom:

  <dependency>
    <groupId>org.locationtech.spatial4j</groupId>
    <artifactId>spatial4j</artifactId>
    <version>0.7</version>
  </dependency>

Upvotes: 2

Related Questions