Trying to delete data from a Jena Fuseki server running the GeoSPARQL extension.
The queries don't seem to be effective.
The output from the server when trying either DELETE or DELETE DATA is:
23:29:06 WARN Fuseki :: [2] Parse error: Encountered " "delete" "DELETE "" at line 15, column 1.
23:29:52 WARN Fuseki :: [4] Parse error: Encountered " <DELETE_DATA> "DELETE DATA "" at line 15, column 1.
Command to run the server, from scratch without an empty index and tdb file:
java -jar jena-fuseki-geosparql-4.2.0.jar \
-rf file.n3 \
--index_expiry 50000000000000,500000000000,500000000000 -p 3034 \
-t ./geosparql-tdb2 \
-t2 --update \
--spatial_index ./geosparql-tdb2/spatial.index
(prefix spa: <http://jena.apache.org/spatial#>)
The delete query is thus:
DELETE DATA { ?feature a sosa:featureOfInterest . }
WHERE {
?feature a sosa:featureOfInterest ;
spa:withinBox(54.3 -116.5 34.2 -93.9) .
}
Which corresponds to a select query which is working as expected (i.e. is correctly selecting the rows which should be deleted):
select * WHERE {
?feature spa:withinBox(54.3 -116.5 34.2 -93.9) .
}
Any ideas?
Edit: The delete query which was causing the parse error was incorrect. This new delete query doesn't cause an error. However, this still doesn't delete the data.
DELETE {
?g a geo:Geometry .
}
WHERE {
?g a geo:Geometry .
?g spa:withinBox(54.3 -116.5 34.2 -93.9) .
}
Also, the query URL is /ds/query and the delete URL is /ds/update.
Finally, the request is being performed in python as follows:
def run_sparql(s, qtype='query'):
url = 'http://localhost:3034/ds/' + qtype
payload = s
headers = {'Content-Type': 'application/sparql-query'}
res = requests.post(url, data=payload, headers=headers)
The response code for the delete query is 415 while for the select it is 200.
Edit #2:
Changing the content type from application/sparql-query to application/sparql-update results in a status code of 400 and still does not delete the data as expected.
To be clear:
s = '''
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix spa: <http://jena.apache.org/spatial#>
DELETE {
?g a geo:Geometry .
}
WHERE {
?g a geo:Geometry .
?g spa:withinBox(54.3 -116.5 34.2 -93.9) .
}
'''
url = 'http://localhost:3034/ds/update'
payload = s
headers = {'Content-Type': 'application/sparql-update'}
res = requests.post(url, data=payload, headers=headers)
Even this is not working:
prefix geo: <http://www.opengis.net/ont/geosparql#>
DELETE {?g a geo:Geometry}