You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the source is in a format that does not support named graphs its triples
2592
2635
will be added to the default graph
2593
-
(i.e. :attr:`.Dataset.default_context`).
2636
+
(i.e. :attr:`.Dataset.default_graph`).
2594
2637
2595
2638
.. caution::
2596
2639
@@ -2611,7 +2654,7 @@ def parse(
2611
2654
the ``publicID`` parameter will also not be used as the name for the
2612
2655
graph that the data is loaded into, and instead the triples from sources
2613
2656
that do not support named graphs will be loaded into the default graph
2614
-
(i.e. :attr:`.Dataset.default_context`).
2657
+
(i.e. :attr:`.Dataset.default_graph`).
2615
2658
"""
2616
2659
2617
2660
ConjunctiveGraph.parse(
@@ -2632,31 +2675,44 @@ def remove_graph(
2632
2675
g=self.get_context(g)
2633
2676
2634
2677
self.store.remove_graph(g)
2635
-
ifgisNoneorg==self.default_context:
2678
+
ifgisNoneorg==self.default_graph:
2636
2679
# default graph cannot be removed
2637
2680
# only triples deleted, so add it back in
2638
-
self.store.add_graph(self.default_context)
2681
+
self.store.add_graph(self.default_graph)
2639
2682
returnself
2640
2683
2641
2684
defcontexts(
2642
2685
self, triple: Optional[_TripleType] =None
2643
2686
) ->Generator[_ContextType, None, None]:
2687
+
warnings.warn(
2688
+
"Dataset.contexts is deprecated, use Dataset.graphs instead.",
2689
+
DeprecationWarning,
2690
+
stacklevel=2,
2691
+
)
2644
2692
default=False
2645
2693
forcinsuper(Dataset, self).contexts(triple):
2646
2694
default|=c.identifier==DATASET_DEFAULT_GRAPH_ID
2647
2695
yieldc
2648
2696
ifnotdefault:
2649
2697
yieldself.graph(DATASET_DEFAULT_GRAPH_ID)
2650
2698
2651
-
graphs=contexts
2699
+
defgraphs(
2700
+
self, triple: Optional[_TripleType] =None
2701
+
) ->Generator[_ContextType, None, None]:
2702
+
default=False
2703
+
forcinsuper(Dataset, self).contexts(triple):
2704
+
default|=c.identifier==DATASET_DEFAULT_GRAPH_ID
2705
+
yieldc
2706
+
ifnotdefault:
2707
+
yieldself.graph(DATASET_DEFAULT_GRAPH_ID)
2652
2708
2653
2709
# type error: Return type "Generator[Tuple[Node, Node, Node, Optional[Node]], None, None]" of "quads" incompatible with return type "Generator[Tuple[Node, Node, Node, Optional[Graph]], None, None]" in supertype "ConjunctiveGraph"
0 commit comments