2

I'm using RDF4J workbench:

System Information
Application Information
Application Name    RDF4J Workbench
Version 2.0.1
Runtime Information
Operating System    Windows 8.1 6.3 (amd64)
Java Runtime    Oracle Corporation Java HotSpot(TM) 64-Bit Server VM (1.8.0_101)
Process User    Greg
Memory
Used    203 MB
Maximum 3463 MB

Although I can see references to GeoSPARQL in the RDF4J repository on github, it doesn't seem to be implemented at this time. I ran this SPARQL Update query on a cleared "In Memory Store with RDFS+SPIN Support" repository to set up a test on RDF4J workbench:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX sf: <http://www.opengis.net/ont/sf#>
PREFIX sxxicci: <http://www.disa.mil/dso/a2i/ontologies/PBSM/Interface/SXXIComplianceCheckIndividuals#>

INSERT DATA
{
     sxxicci:aPolygon geo:asWKT "Polygon((0.5 -0.5, 0.5 0.5, -0.5 0.5, 0.5 -0.5))"^^sf:wktLiteral .
}

This results in a repository with one fact.

Now I attempt to look for an overlap with a literal polygon with the following query which should find my one fact set up above:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX sf: <http://www.opengis.net/ont/sf#>

SELECT DISTINCT * 
WHERE 
{
     ?bGeom geo:asWKT ?bWKT . 
     FILTER (geof:sfIntersects(?bWKT, "Polygon((1 0, 1 1, 0 1, 1 0))"^^sf:wktLiteral))
}

This query gives an error result as HTML which I've had rendered:

enter image description here

This seems to indicate that

  1. I did something wrong in setting up this test (if so, what?) OR

  2. RDF4J doesn't support GeoSPARQL (at least not the geof:sfIntersects function)

1 and/or 2 or something else?

Thanks.

Greg Cox
  • 287
  • 1
  • 12
  • 1
    I don't know if the workbench contains all GeoSPARQL related Jar files, but from here I guess we can estimate which functions are (at least) supported: https://github.com/eclipse/rdf4j/tree/master/testsuites/geosparql/src/main/resources/testcases-geosparql/functions – UninformedUser Sep 15 '16 at 19:35
  • 1
    Yah, does having _zero_ documentation count as "sparsely documented"? Any way, we're working on improving this, stay tuned. – Jeen Broekstra Sep 15 '16 at 22:36
  • I bet that a function `geof:sfIntersects` is always be slower than a magic predicate `geo:sfIntersects`, since the function needs to do a full scan – Vladimir Alexiev Jan 13 '17 at 20:07

1 Answers1

1

I had a similar problem using the RDF4J APIs in a maven application, the problem ended up being that the GeoSPARQL functions are defined in the rdf4j-queryalgebra-geosparql package; which is not included by default. After adding that to my POM the queries worked as expected.

I'm not really familiar with application servers, but a quick look at the rdf4j-workbench, deployed on Tomcat, shows that library missing from the lib/ directory. Once I manually added it and reloaded the application, my spatial query parsed and executed correctly.

nickrobison
  • 150
  • 2
  • 14
  • how did you setup the repo? "In Memory Store with RDFS+SPIN Support" (from the original question) doesn't sound like it includes GeoSPARQL – Vladimir Alexiev Mar 14 '18 at 11:02
  • I don't really remember how I setup the repository originally, I just did a quick test last year, but I believe I followed the same procedure from the original posting. I don't remember seeing an option for enabling GeoSPARQL support directly, but with the correct jars in the lib directory, I'm not sure how a configuration option would solve the issue. – nickrobison Mar 14 '18 at 16:54