exclude_triples

exclude_triples(triples: Iterable[TripleType], exclusion: TripleType | Collection[TripleType], *, progress: bool = False) Iterable[TripleType][source]

Exclude triples in the given set.

Parameters:
  • triples – An iterable of triples

  • exclusion – A triple or collection of triples to exclude

  • progress – Should a progress bar be shown?

Returns:

A sub-iterable of triples whose subject and object prefixes are not the same.

>>> from curies import Triple
>>> from curies.vocabulary import exact_match, subclass_of
>>> c1, c2, c3 = "DOID:0050577", "mesh:C562966", "DOID:225"
>>> m1 = Triple.from_curies(c1, exact_match.curie, c2)
>>> m2 = Triple.from_curies(c2, exact_match.curie, c3)
>>> m3 = Triple.from_curies(c1, subclass_of.curie, c3)
>>> assert list(exclude_triples([m1, m2, m3], m3)) == [m1, m2]