问题
While trying to delete triplets I get following error:
MALFORMED QUERY: Encountered " "delete" "DELETE
Was expecting one of:
"base" ...
"prefix" ...
"select" ...
"construct" ...
"describe" ...
"ask" ...
My query was:
DELETE {
?s example:id 'Id' .
};
Sesame with Jetty is what I am using. I sent an HTTP request. I have another question opened around this
delete rest api to remove statements from global context
I might be sending to wrong endpoint. My endpoint looks like:
http://example.com/openrdf-sesame/repositories/$repo/
Please help.
EDIT:
self.baseURLRepositories = storeUrl + "/openrdf-sesame/repositories/"
endpoint = self.getBaseURLForSesameRepositories() + "%s" % (self.getRepository())
params = { 'query': query }
headers = {
'content-type': 'application/x-www-form-urlencoded',
'accept': 'application/sparql-results+json'
}
(response, content) = httplib2.Http().request(endpoint, 'POST', urllib.urlencode(params), headers=headers)
results = json.loads(content)
where query = DELETE ...
回答1:
You are using an incorrect endpoint location. SPARQL update requests should be sent to openrdf-sesame/repository/<repid>/statements
.
来源:https://stackoverflow.com/questions/17770420/malformed-query-encountered-delete-delete