MALFORMED QUERY: Encountered “ ”delete“ ”DELETE

送分小仙女□ 提交于 2019-12-11 13:37:40

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!