Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
The Relation Unique module extends the Relation module with a "property" that constrains relations of a given type, much like the built-in properties "unique" and "transitive".
Relation Unique adds "endpoint uniqueness" to the provided properties:
For a non-directed relation, endpoint uniqueness ensures that any entity can only occur in one relation of the relation type. E.g. in a binary undirected relation "married to", entity uniqueness prevents polygamy.
For a directed relation, there are two kinds of entity uniqueness:
Source uniqueness: If a relation type is source unique, any entity can only
occur as source in exactly one relation of the type.
Mathematically speaking, this turns the relation type into a function.
Target uniqueness: If a relation type is target unique, any entity can only occur as target / among the targets in exactly one relation of the type.
Mathematically speaking, for binary directed relations, this turns the
inverse of the relation type into a function.