Although I have gone through lot of examples on the web explaining the use of python SPARQLWrapper using SELECT statements for fetching data from sesame triple store, but no
This is not particularly clear from the docs, but I think you can just execute an update statement in the same way that you execute a query:
queryString = "DELETE WHERE { ?s ?p ?o. }"
sparql = SPARQLWrapper("http://localhost:8080/openrdf-sesame/repositories/test/statements")
sparql.setQuery(queryString)
ret = sparql.query()
In the case of Sesame, one thing to keep in mind is that the URL for the update endpoint (repositories/
) is not the same as the URL for the query endpoint (repositories/
). See the Sesame protocol docs for details.