# HG changeset patch # User drewp@bigasterisk.com # Date 1649145190 25200 # Node ID 219d9e89b15c4614a897cc4979be452010f8f40f # Parent a96f4eb95ef0b2e4f8113101590b2210187b56e5 extract readonly diff -r a96f4eb95ef0 -r 219d9e89b15c rdfdb/currentstategraphapi.py --- 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): """ diff -r a96f4eb95ef0 -r 219d9e89b15c rdfdb/readonly_graph.py --- /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