encode_uri_triple

encode_uri_triple(uri_triple: tuple[str, str, str], *, negate: bool = False) str[source]

Encode a subject-predicate-object URI triple.

Parameters:
  • uri_triple – A triple of URIs represented as strings

  • negate – If true, considers the triple as “negative” and postpends a ~ to the hash

Returns:

An encoded triple of URIs

>>> triple = (
...     "http://id.nlm.nih.gov/mesh/C000089",
...     "http://www.w3.org/2004/02/skos/core#exactMatch",
...     "http://purl.obolibrary.org/obo/CHEBI_28646",
... )
>>> encode_uri_triple(triple)
'36a1f9244ea7641a90987c82f33c25c0c13712ee8f48207b2a0825f8a4e4e26a'
>>> encode_uri_triple(triple, negate=True)
'36a1f9244ea7641a90987c82f33c25c0c13712ee8f48207b2a0825f8a4e4e26a~'