diff options
author | shreyasnagare <shreyasnagare@gmail.com> | 2021-06-30 03:27:26 -0400 |
---|---|---|
committer | shreyasnagare <shreyasnagare@gmail.com> | 2021-06-30 03:27:26 -0400 |
commit | d6aa01db18739aea43177cfcec41f8667aebdb3d (patch) | |
tree | 907b039c98f7f09e91b0f1178e60ed778edd7fcb | |
parent | e4d975af6ee4e38b6bb7473b5660c84f787b5d94 (diff) | |
download | rdflib-d6aa01db18739aea43177cfcec41f8667aebdb3d.tar.gz |
Update graph operator overloading for subclasses
-rw-r--r-- | rdflib/graph.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rdflib/graph.py b/rdflib/graph.py index f90b3acb..c354a770 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -558,7 +558,7 @@ class Graph(Node): def __add__(self, other): """Set-theoretic union BNode IDs are not changed.""" - retval = Graph() + retval = self.__class__() for (prefix, uri) in set(list(self.namespaces()) + list(other.namespaces())): retval.bind(prefix, uri) for x in self: @@ -570,7 +570,7 @@ class Graph(Node): def __mul__(self, other): """Set-theoretic intersection. BNode IDs are not changed.""" - retval = Graph() + retval = self.__class__() for x in other: if x in self: retval.add(x) @@ -579,7 +579,7 @@ class Graph(Node): def __sub__(self, other): """Set-theoretic difference. BNode IDs are not changed.""" - retval = Graph() + retval = self.__class__() for x in self: if x not in other: retval.add(x) |