diff options
| author | gromgull <devnull@localhost> | 2011-01-31 06:20:59 +0000 |
|---|---|---|
| committer | gromgull <devnull@localhost> | 2011-01-31 06:20:59 +0000 |
| commit | 451780760e801d51288d62e131ce70137bd1d086 (patch) | |
| tree | 99cba5e8ef4bf67bc671b80e224da0c80678401d | |
| parent | 43e8b090d806d615a8153d1e14063cc6d274bb25 (diff) | |
| download | rdflib-3.1.0.tar.gz | |
added hook for stores to provide their own query processor. A bit hackish, but does not break anything. (Fixes issue 121)3.1.0
| -rw-r--r-- | rdflib/graph.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/rdflib/graph.py b/rdflib/graph.py index d4399d44..d90f4de9 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -783,13 +783,20 @@ class Graph(Node): def load(self, source, publicID=None, format="xml"): self.parse(source, publicID, format) - def query(self, query_object, processor='sparql', result='sparql', initNs={}, initBindings={}, **kwargs): + def query(self, query_object, processor='sparql', result='sparql', initNs={}, initBindings={}, use_store_provided=True, **kwargs): """ """ - if not isinstance(processor, query.Processor): - processor = plugin.get(processor, query.Processor)(self) + + + + if hasattr(self.store, "query") and use_store_provided: + return self.store.query(self,query_object, initNs, initBindings, **kwargs) + if not isinstance(result, query.Result): result = plugin.get(result, query.Result) + if not isinstance(processor, query.Processor): + processor = plugin.get(processor, query.Processor)(self) + return result(processor.query(query_object, initBindings, initNs, **kwargs)) |
