flip

flip(mapping: Mapping, *, strict: Literal[True] = True) Mapping[source]
flip(mapping: Mapping, *, strict: Literal[False] = False) Mapping | None

Flip a mapping, if the relation is configured with an inversion.

Parameters:

mapping – An input mapping

Returns:

If the input mapping’s predicate is configured with an inversion (e.g., broad match is configured by default to invert to narrow match), a new mapping is returned with the subject and object swapped, with the inverted predicate, and with a “mutated” evidence to track original provenance. If the mapping’s predicate is not configured with an inversion (e.g., for practical purposes, regular dbrefs and close matches are not configured to invert), then None is returned