From d217c3c8f4ae02a212230937f0835083f187afa0 Mon Sep 17 00:00:00 2001 From: Jim McCusker Date: Tue, 26 May 2015 19:34:31 -0400 Subject: [PATCH] Now properly autocommitting. Trying this on the road from a tethered iPad didn't work out. :-) --- rdflib/plugins/stores/sparqlstore.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rdflib/plugins/stores/sparqlstore.py b/rdflib/plugins/stores/sparqlstore.py index 2618cfe93..0bea8af5b 100644 --- a/rdflib/plugins/stores/sparqlstore.py +++ b/rdflib/plugins/stores/sparqlstore.py @@ -627,6 +627,8 @@ def add(self, spo, context=None, quoted=False): else: q = "INSERT DATA { %s }" % triple self._transaction().append(q) + if self.autocommit: + self.commit() def addN(self, quads): """ Add a list of quads to the store. """ @@ -641,6 +643,8 @@ def addN(self, quads): triples = ["%s %s %s ." % (x[0].n3(), x[1].n3(), x[2].n3()) for x in contexts[context]] data.append("INSERT DATA { GRAPH <%s> { %s } }\n" % (context.identifier, '\n'.join(triples))) self._transaction().extend(data) + if self.autocommit: + self.commit() def remove(self, spo, context): """ Remove a triple from the store """ @@ -663,6 +667,8 @@ def remove(self, spo, context): else: q = "DELETE { %s } WHERE { %s } " % (triple, triple) self._transaction().append(q) + if self.autocommit: + self.commit() def _do_update(self, update): print update @@ -672,8 +678,6 @@ def _do_update(self, update): self.setRequestMethod(URLENCODED if self.postAsEncoded else POSTDIRECTLY) result = SPARQLWrapper.query(self) - if self.autocommit: - self.commit() return result def update(self, query, @@ -738,6 +742,8 @@ def update(self, query, query = self.where_pattern.sub("WHERE { " + values, query) self._transaction().append(query) + if self.autocommit: + self.commit() def _insert_named_graph(self, query, query_graph): """