corese icon indicating copy to clipboard operation
corese copied to clipboard

URL-encoded POST // Encountered "update" at line 1, column 1

Open Inexpugnable opened this issue 5 years ago • 0 comments

Issue raised when using Corese-server (version 4.1.4a) and SPARQLWrapper (python library) with insert queries (not tested with other SPARQL 1.1 Update queries).

SPARQLWrapper will detect that Corese-server uses the "URL-encoded" protocol (https://www.w3.org/TR/sparql11-protocol/#update-operation) and will therefore use an "update" parameter not supported by Corese-server.

Line of codes probably involved in SPARQLWrapper (https://github.com/RDFLib/sparqlwrapper/blob/master/SPARQLWrapper/Wrapper.py):

request = urllib.request.Request(uri)
request.add_header("Content-Type", "application/x-www-form-urlencoded")
request.data = self._getRequestEncodedParameters(("update", self.queryString)).encode('ascii')

One way to workaround the problem with SPARQLWrapper is to use the parameter 'postdirectly' (setRequestMethod('postdirectly')) https://sparqlwrapper.readthedocs.io/en/latest/SPARQLWrapper.Wrapper.html#SPARQLWrapper.Wrapper.POSTDIRECTLY

Inexpugnable avatar Oct 07 '20 19:10 Inexpugnable