Skip to content

Commit

Permalink
Working on RDFLib#955 In the algebra there is logic to translate pnam…
Browse files Browse the repository at this point in the history
…e compvalue's into URIRef etc. Now wired up, reveals a failing test
  • Loading branch information
JervenBolleman committed Mar 9, 2020
1 parent 15982d5 commit 6049464
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions rdflib/plugins/sparql/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
15 changes: 14 additions & 1 deletion rdflib/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,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)

Expand All @@ -507,7 +520,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__ = """
Expand Down

0 comments on commit 6049464

Please sign in to comment.