On Wed, 2019-02-20 at 17:27 -0700, ganesh chandra wrote: > Hello All, > My data looks something like this: > <http://www.example.com/example/123456789> a something:Entity ; > something:privateData [ a something:PrivateData ; > something:jsonContent "{\"fileType\": \”jp\"}"^^xsd:string ; > something:modeData [a something:data1 > system:code 1234] > something:system <http://www.test.edu/fileType> ] ; > > There are many like the above one and I am trying to write the query to > delete all the data if the id matches. How I should I go about doing this? >
If the data is always in this shape, something like this should work: prefix something: <http://something.example.org> prefix system: <http://system.example.org> DELETE WHERE { <http://www.example.com/example/123456789> a something:Entity ; something:privateData ?_a. ?_a a something:PrivateData ; something:jsonContent ?json ; something:modeData ?_b; something:system ?filetype . ?_b a something:data1; system:code ?code. } This just replaces the blank nodes with sparql variables. It's a good idea to test DELETE updates thoroughly, because they can often cause surprises. One way to see what will be deleted is to change the DELETE to SELECT and run it as a query. That will show you exactly what triples will be deleted. Regards, --Paul
