diff --git a/rdflib/plugins/sparql/algebra.py b/rdflib/plugins/sparql/algebra.py index 657cbc326..0b4fc82da 100644 --- a/rdflib/plugins/sparql/algebra.py +++ b/rdflib/plugins/sparql/algebra.py @@ -154,6 +154,16 @@ def translatePName(p, prologue): datatype=prologue.absolutize(p.datatype)) elif isinstance(p, URIRef): return prologue.absolutize(p) + elif isinstance(p, EmbeddedTriple): + trSub = translatePName(p.subject(), prologue) + trPred = translatePName(p.predicate(), prologue) + trObj = translatePName(p.object(), prologue) + if trSub is not None: + p.setSubject(trSub) + if trPred is not None: + p.setPredicate(trPred) + if trObj is not None: + p.setObject(trObj) def translatePath(p): diff --git a/rdflib/term.py b/rdflib/term.py index 05fd58e91..2784f2594 100644 --- a/rdflib/term.py +++ b/rdflib/term.py @@ -495,6 +495,19 @@ def object(self): def sid(self): return self._sid + def setSubject(self, subject): + self._subject = subject + + def setPredicate(self, predicate): + self._predicate = predicate + + def setObject(self, object): + self._object = object + + def sid(self, sid): + self._sid = sid + + def __ne__(self, other): return not self.__eq__(other) @@ -506,7 +519,7 @@ def __eq__(self, other): self._object == other._object def __hash__(self): - return hash(self._subject) | hash(self._predicate) | hash(self.predicate()) + return hash(self._subject) | hash(self._predicate) | hash(self._object) class Literal(Identifier): __doc__ = """