From 41c6466f804bb86aa9e2cfca023c77ba5160a19b Mon Sep 17 00:00:00 2001 From: Ivan Herman Date: Sat, 1 Aug 2015 13:17:03 +0200 Subject: Added a 'graphs' method to the Dataset object (the documentation already had it...) --- rdflib/graph.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rdflib/graph.py b/rdflib/graph.py index 68339eba..80f21b60 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -1629,6 +1629,13 @@ class Dataset(ConjunctiveGraph): yield c if not default: yield self.graph(DATASET_DEFAULT_GRAPH_ID) + def graphs(self, triple=None) : + default = False + for c in super(Dataset, self).contexts(triple): + default|=c.identifier == DATASET_DEFAULT_GRAPH_ID + yield c + if not default: yield self.graph(DATASET_DEFAULT_GRAPH_ID) + def quads(self, quad): for s, p, o, c in super(Dataset, self).quads(quad): if c.identifier==self.default_context: @@ -1636,7 +1643,6 @@ class Dataset(ConjunctiveGraph): else: yield (s, p, o, c.identifier) - class QuotedGraph(Graph): """ Quoted Graphs are intended to implement Notation 3 formulae. They are -- cgit v1.2.1