Summary from issue https://github.com/RDFLib/sparqlwrapper/issues/159

Fuseki is being sent an HTML form (application/x-www-form-urlencoded) so it sends back HTML. That is what SPARQLWrapper (and curl and ...) do with a POST by default.

The request should set the Content-=type to "application/sparql-update"


https://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/#query-success is about query success not update.

See
https://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/#update-success

For an update response, only looking at the status code is necessary.

    Andy

On 15/08/2020 15:02, Andy Seaborne wrote:
PS Fuseki error responses are text/plain, not text/html.

     Andy

On 15/08/2020 13:39, Andy Seaborne wrote:
 > text/html;charset=utf-8

Probably because the other end is an HTML page, maybe a query form, not and a SPARQL endpoint.

There are several system that advertise thei HTML form and the form then goes to the SPARQL endpoint which is at a different URL.

     Andy

On 15/08/2020 07:16, Wolfgang Fahl wrote:
see also https://github.com/RDFLib/sparqlwrapper/issues/159

when using SPARQLWrapper in python for an INSERT i get the error message.

/RuntimeWarning: unknown response content type 'text/html;charset=utf-8' //
/

/Carlos Tejo Alonso now pointed tohttps://www.w3.org/TR/2013/REC-sparql11-protocol-20130321/#query-success
/

/stating /that the response body format is implementation specific. What options are available for Apache Jena for e.g. content negotiation in this case
and how can this be achieved with SPARQLWrapper?
//

(See unit test and sample code below) see also http://wiki.bitplan.com/index.php/DgraphAndWeaviateTest

def  testJenaInsert(self):
         jena=self.getJena(mode="update")
         insertString  =  """
PREFIX cr: <http://cr.bitplan.com/>
INSERT DATA {
cr:version cr:author "Wolfgang Fahl".
}
"""
         results=jena.rawQuery(insertString)
         print  (results)

...

   def  rawQuery(self,queryString,method='POST'):
         '''
query with the given query string
'''
         self.sparql.setQuery(queryString)
         self.sparql.method=method
         queryResult  =  self.sparql.query()
         jsonResult=queryResult.convert()
         return  jsonResult
--

Wolfgang Fahl
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web:http://www.bitplan.de

Reply via email to