From d8015cbe4dbeb7e4a82b79752b88025c924426d2 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Mon, 7 Feb 2022 19:24:59 +0700 Subject: [PATCH 1/2] #1699 Document `Graph` behavior regarding context in constructor docstring --- rdflib/graph.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rdflib/graph.py b/rdflib/graph.py index 0abffd6a5..39b7b654b 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -319,6 +319,10 @@ class Graph(Node): context, such as true merging/demerging of sub-graphs and provenance. + Even when used with a context-aware store, Graph will only expose the quads + which belong to the default graph. To access the rest of the data, + `ConjunctiveGraph` or `Dataset` classes can be used instead. + The Graph constructor can take an identifier which identifies the Graph by name. If none is given, the graph is assigned a BNode for its identifier. From 021e624a0bfb22afd57a31cb0fa0216cc8d4ef5f Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Mon, 7 Feb 2022 19:42:02 +0700 Subject: [PATCH 2/2] #1699 Rephrase wording a bit --- rdflib/graph.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rdflib/graph.py b/rdflib/graph.py index 39b7b654b..7fae91af8 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -319,9 +319,9 @@ class Graph(Node): context, such as true merging/demerging of sub-graphs and provenance. - Even when used with a context-aware store, Graph will only expose the quads - which belong to the default graph. To access the rest of the data, - `ConjunctiveGraph` or `Dataset` classes can be used instead. + Even if used with a context-aware store, Graph will only expose the quads which + belong to the default graph. To access the rest of the data, `ConjunctiveGraph` or + `Dataset` classes can be used instead. The Graph constructor can take an identifier which identifies the Graph by name. If none is given, the graph is assigned a BNode for its @@ -1628,7 +1628,12 @@ def __contains__(self, triple_or_quad): return True return False - def add(self, triple_or_quad: Union[Tuple[Node, Node, Node, Optional[Any]], Tuple[Node, Node, Node]]) -> "ConjunctiveGraph": + def add( + self, + triple_or_quad: Union[ + Tuple[Node, Node, Node, Optional[Any]], Tuple[Node, Node, Node] + ], + ) -> "ConjunctiveGraph": """ Add a triple or quad to the store.