You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm fighting with a SPARQL update syntax issue when using SPARQLUpdateStore to add triples to a virtuoso store. The requests apparently succeds, silently discarding the SPARQL syntax error reported by the server.
I'm quite sure there'd be a lot of improvement if SPARQLUpdateStore used SPARQLWrapper's query() to talk to the server instead of its own httplib.HTTPConnection connection.
The text was updated successfully, but these errors were encountered:
Definitely. As far as I remember, back when I worked on SPARQLUpdateStore, SPARQLWrapper wasn't advanced enough to do updates in a meaningful way. I think the situation has changed. So, contributions are welcome.
class MyResponse(StringIO.StringIO):
"""Fakes a httplib.HTTPResponse which is always correct, for MySPARQLUpdateStore::_do_update()"""
status = 200
class MySPARQLUpdateStore(SPARQLUpdateStore):
"""Overload SPARQLUpdateStore::_do_update() to use SPARQLWrapper::query()"""
def _do_update(self, update):
if myconfig.VERBOSE:
handler = urllib2.HTTPHandler(debuglevel=1)
opener = urllib2.build_opener(handler)
urllib2.install_opener(opener)
print update
sparql = SPARQLWrapper(self.update_endpoint)
sparql.setQuery(update)
sparql.setMethod(POST)
sparql.setReturnFormat(JSON)
# Hack for Virtuoso
#sparql.queryType= SELECT
result = sparql.query()
response = MyResponse(result.response.read())
return response
I'm fighting with a SPARQL update syntax issue when using SPARQLUpdateStore to add triples to a virtuoso store. The requests apparently succeds, silently discarding the SPARQL syntax error reported by the server.
I'm quite sure there'd be a lot of improvement if SPARQLUpdateStore used SPARQLWrapper's query() to talk to the server instead of its own httplib.HTTPConnection connection.
The text was updated successfully, but these errors were encountered: