1

I'm trying to delete a few triples from my triple store but, unfortunately, I can't even get this simple query to work:

WITH <GRAPH> DELETE {
  ?s ?p ?o .
} WHERE {
  <URI> <PREDICATE> ?s .
  ?s ?p ?o .
}

I just want to delete all triples that belong to a subject which is itself connected to the URI I have (with the predicate I have). The WHERE statement in a SELECT query gives me all the solutions that I want to be deleted.

EDIT

Ok, so I kept playing around with it, and for some reason, this works:

WITH <GRAPH> DELETE {
  ?s ?p ?o .
} WHERE {
  <URI> <PREDICATE> ?s .
  {?s ?p ?o .} UNION {?x ?y ?z}
}

Is this really supposed to work like that or is my triple store faulty? (I'm using 4store.)

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • What do you mean "doesn't work"? Is there a syntax error? Is the update "successful" but doesn't do what you want (e.g., it runs, but doesn't delete anything? – Joshua Taylor Sep 03 '13 at 17:12
  • yea it runs without error, but doesnt delete anything – user2743104 Sep 05 '13 at 11:16
  • Thanks for the update. What results do you get if just run the corresponding select, i.e., `WITH SELECT * WHERE { ?s . ?s ?p ?o . }`, since you mentioned that it works? An example in [3.1.3 DELETE/INSERT](http://www.w3.org/TR/sparql11-update/#deleteInsert) says that `WITH DELETE { a b c } INSERT { x y z } WHERE { ... }` is equivalent to `DELETE { GRAPH { a b c } } INSERT { GRAPH { x y z } } USING WHERE { ... }`. What happens if you use the longer form, changing `WITH ` inside to `GRAPH { ... }`? – Joshua Taylor Sep 05 '13 at 11:46
  • Sorry, i should have mentioned that before... I also tried that, and it gives me the same results (none :D). Running the select query gives me exactly the triples i want to delete. – user2743104 Sep 07 '13 at 08:12
  • possible duplicate of [SPARQL no result found on delete](http://stackoverflow.com/questions/8987825/sparql-no-result-found-on-delete) – Paul Sweatte Oct 21 '13 at 18:08

0 Answers0