1

I have got a simple problem for you : My use case is to delete a single node (red square below) and thoses relations stored into my triplestore (GraphDB) with a SPARQL query based on this graph :

enter image description here

DELETE FROM declaration needs triples like ?s ?p ?o. Considering ?s is the red node, the problem is I don't want to delete ?o but only ?s ?p (and of course ?p2 ?s). How Can I achieve that ? Thanks !

A.Dumas
  • 63
  • 1
  • 5
  • I guess you misunderstand the RDF data model. The smallest unit of existence is an RDF triple, thus, you can only delete RDF triples. `DELETE {:node ?p ?o} WHERE {:node ?p ?o}` will delete all triples where the node is the subject. Nothing more, nothing less. That also means, if `:node` occurs somewhere as object of a triple, the node will still be in the RDF graph. The same holds for all `?o` - that doesn't mean each such node will be deleted, they can still occur as a) subject and b) as object for other subjects. – UninformedUser Mar 17 '23 at 11:22
  • 2
    if you want to make disappear the node, you have to remove incoming and outgoing RDF triples: `DELETE {?s ?p ?o} WHERE { {BIND(:node AS ?s) ?s ?p ?o} UNION {BIND(:node AS ?o) ?s ?p ?o} }` – UninformedUser Mar 17 '23 at 11:25

0 Answers0