Search code examples
javasparqlsesame

SPARQL delete on owlim-lite not working


I want to delete all the triples in my OWLIM-lite store using Java/Sesame API

I tried:

DELETE WHERE { ?s ?p ?o } ;

in all variants (with or withour prefixes) like so:

DELETE * WHERE { ?s ?p ?o } ;
DELETE { ?s ?p ?o } WHERE { ?s ?p ?o } ;
WITH <...> DELETE * WHERE { ?s ?p ?o } ;
...

but none of these queries seem to work. I always get the same exception:

org.openrdf.query.MalformedQueryException: Encountered " "delete" "DELETE "" at line 1, column 1.
Was expecting one of:
    "base" ...
    "prefix" ...
    "select" ...
    "construct" ...
    "describe" ...
    "ask" ...

It looks like it's a similar problem as this one: MALFORMED QUERY: Encountered " "delete" "DELETE except all the other queries (SELECT) work perfectly fine.

What am I doing wrong?


Solution

  • You are probably using an incorrect endpoint location for your updates. SPARQL update requests should be sent to openrdf-sesame/repository/<repid>/statements, while SPARQL query requests should go to openrdf-sesame/repository/<repid>.