Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update graph operator overloading for subclasses #1349

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def __isub__(self, other):
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:
Expand All @@ -570,7 +570,7 @@ def __add__(self, other):
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)
Expand All @@ -579,7 +579,7 @@ def __mul__(self, other):
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)
Expand Down