Reputation: 287
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:
This seems to indicate that
I did something wrong in setting up this test (if so, what?) OR
RDF4J doesn't support GeoSPARQL (at least not the geof:sfIntersects function)
1 and/or 2 or something else?
Thanks.
Upvotes: 2
Views: 581
Reputation: 150
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.
Upvotes: 1