Example #1
0
 def from_tuple(tuple_):
     subject, predicate, object_ = tuple_[0]
     triple = (
         wrap_if_not_none(unescape, subject),
         wrap_if_not_none(unescape, predicate),
         wrap_if_not_none(unescape, object_)
     )
     tuple_ = (triple, ) + tuple_[1:]
     return _Triple.from_tuple(tuple_)
Example #2
0
 def to_tuple(self, default_stype='uri', default_otype='literal'):
     tuple_ = _Triple.to_tuple(self, default_stype, default_otype)
     subject, predicate, object_ = tuple_[0]
     triple = (
         wrap_if_not_none(escape, subject),
         wrap_if_not_none(escape, predicate),
         wrap_if_not_none(escape, object_)
     )
     tuple_ = (triple, ) + tuple_[1:]
     return tuple_