encode_curie_triple

encode_curie_triple(curie_triple: tuple[str, str, str], converter: Converter, *, negate: bool = False) str[source]

Encode a subject-predicate-object CURIE triple.

Parameters:
  • curie_triple – A triple of CURIEs represented as strings

  • converter – A converter

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

Returns:

An encoded triple of URIs

>>> import curies
>>> from curies.triples import Triple
>>> converter = curies.load_prefix_map(
...     {
...         "mesh": "http://id.nlm.nih.gov/mesh/",
...         "skos": "http://www.w3.org/2004/02/skos/core#",
...         "CHEBI": "http://purl.obolibrary.org/obo/CHEBI_",
...     }
... )
>>> triple = ("mesh:C000089", "skos:exactMatch", "CHEBI:28646")
>>> encode_curie_triple(triple, converter)
'36a1f9244ea7641a90987c82f33c25c0c13712ee8f48207b2a0825f8a4e4e26a'
>>> encode_curie_triple(triple, converter, negate=True)
'36a1f9244ea7641a90987c82f33c25c0c13712ee8f48207b2a0825f8a4e4e26a~'