diff options
author | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2017-02-09 09:07:00 +0100 |
---|---|---|
committer | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2017-02-09 09:07:27 +0100 |
commit | cde90dae34bf7bbab60b0351a895cc85c2c0f628 (patch) | |
tree | aabbea07d6744ccf4d17b702d669b416c9b5f0c0 | |
parent | 57793a4107ac211d43959599019e006edb55a3fa (diff) | |
download | rdflib-cde90dae34bf7bbab60b0351a895cc85c2c0f628.tar.gz |
made SPARQLStore count emitted queries and updates
-rw-r--r-- | rdflib/plugins/stores/sparqlstore.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rdflib/plugins/stores/sparqlstore.py b/rdflib/plugins/stores/sparqlstore.py index b55e7b49..66382219 100644 --- a/rdflib/plugins/stores/sparqlstore.py +++ b/rdflib/plugins/stores/sparqlstore.py @@ -145,6 +145,7 @@ class SPARQLStore(NSSPARQLWrapper, Store): self.graph_aware = context_aware self._timeout = None self.query_method = default_query_method + self._queries = 0 # Database Management Methods def create(self, configuration): @@ -188,6 +189,11 @@ class SPARQLStore(NSSPARQLWrapper, Store): def remove(self, _, context): raise TypeError('The SPARQL store is read only') + def _query(self, *args, **kwargs): + self._queries += 1 + + return super(SPARQLStore, self)._query(*args, **kwargs) + def query(self, query, initNs={}, initBindings={}, @@ -504,6 +510,8 @@ class SPARQLUpdateStore(SPARQLStore): self.autocommit = autocommit self.dirty_reads = dirty_reads self._edits = None + self._updates = 0 + def query(self, *args, **kwargs): if not self.autocommit and not self.dirty_reads: @@ -647,6 +655,9 @@ class SPARQLUpdateStore(SPARQLStore): self._timeout = int(timeout) def _do_update(self, update): + + self._updates += 1 + self.resetQuery() self.setQuery(update) self.setMethod(POST) |