Mercurial > code > home > repos > rdfdb
changeset 88:219d9e89b15c
extract readonly
author | drewp@bigasterisk.com |
---|---|
date | Tue, 05 Apr 2022 00:53:10 -0700 |
parents | a96f4eb95ef0 |
children | 1120c6489888 |
files | rdfdb/currentstategraphapi.py rdfdb/readonly_graph.py |
diffstat | 2 files changed, 17 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/rdfdb/currentstategraphapi.py Mon Apr 04 23:01:08 2022 -0700 +++ b/rdfdb/currentstategraphapi.py Tue Apr 05 00:53:10 2022 -0700 @@ -10,24 +10,6 @@ log = logging.getLogger("currentstate") -class ReadOnlyConjunctiveGraph(object): - """similar to rdflib's ReadOnlyGraphAggregate but takes one CJ in, instead - of a bunch of Graphs""" - - def __init__(self, graph): - self.graph = graph - - def __getattr__(self, attr): - if attr in ['subjects', 'value', 'objects', 'triples', 'label']: # not complete - return getattr(self.graph, attr) - raise TypeError("can't access %r of read-only graph" % attr) - - def __len__(self): - return len(self.graph) - - def contextsForStatement(self, stmt): - raise NotImplementedError - class CurrentStateGraphApi(object): """
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rdfdb/readonly_graph.py Tue Apr 05 00:53:10 2022 -0700 @@ -0,0 +1,17 @@ +class ReadOnlyConjunctiveGraph(object): + """similar to rdflib's ReadOnlyGraphAggregate but takes one CJ in, instead + of a bunch of Graphs""" + + def __init__(self, graph): + self.graph = graph + + def __getattr__(self, attr): + if attr in ['subjects', 'value', 'objects', 'triples', 'label']: # not complete + return getattr(self.graph, attr) + raise TypeError("can't access %r of read-only graph" % attr) + + def __len__(self): + return len(self.graph) + + def contextsForStatement(self, stmt): + raise NotImplementedError