hash_triple
- hash_triple(mapping: SemanticMapping, converter: Converter) str[source]
Return a triples sameness identifier.
- Parameters:
mapping – A semantic mapping
converter – A converter
- Returns:
A mapping sameness identifier, which incorporates the subject, predicate, object, and predicate modifier based on https://ts4nfdi.github.io/mapping-sameness-identifier/
>>> from sssom_pydantic import SemanticMapping, hash_triple >>> from curies import Converter >>> converter = Converter.from_prefix_map( ... { ... "cas": "https://commonchemistry.cas.org/detail?cas_rn=", ... "CHEBI": "http://purl.obolibrary.org/obo/CHEBI_", ... "mesh": "http://id.nlm.nih.gov/mesh/", ... "skos": "http://www.w3.org/2004/02/skos/core#", ... "semapv": "https://w3id.org/semapv/vocab/", ... } ... ) >>> mapping = SemanticMapping.exact("mesh:C000089", "CHEBI:28646") >>> hash_triple(mapping, converter) '36a1f9244ea7641a90987c82f33c25c0c13712ee8f48207b2a0825f8a4e4e26a' >>> hash_triple(mapping.negate(), converter) '36a1f9244ea7641a90987c82f33c25c0c13712ee8f48207b2a0825f8a4e4e26a~' >>> hash_triple(SemanticMapping.exact("CHEBI:28646", "cas:645-92-1"), converter) 'bb768f0b1e1643298f4df1a381001f6ed68fcc8fff49b371f0235b51dbab9e1e'