The Relation module provides an API and basic user interface for creating and managing relations between entities on your Drupal site.
- Relations are their own entities, existing strictly outside both entities they relate to (where references are attached to the source entity).
- Being separate entities, relations are also fieldable (where references are not).
- Relations can include multiple endpoints (where references only have two).
- Relations can be directional or symmetrical (where references always have an explicit starting point – thereby being directional).
These properties allow more complex information structure on your site, but also make relations more complex to set up compared to references. It should be noted that while the Relation module has a UI for managing relations, it is to a large extent an API module for other modules to implement.
Some use cases
- Relations can relate more than two entities:
areSiblings -> (john, jen, jack, jess)
- Relations with two endpoints, 2-ary or binary relations, can be directional:
bruno -> isChildOf -> boglarka
- Directional relations automatically provides a reverse relation:
boglarka -> isParentOf -> bruno
- Relations are fieldable: on the relation
CompanyA -> donation -> PartyB,
donationmay have fields for amount, date, message, etc.
- Being entities, relations can relate to other relations:
CompanyA -> donation -> PartyBand
donations -> transaction -> BankC
(that is, "Company A made a donation to Political Pary B, via Bank C"). See the RDF spec for n-ary relations for more information about relation descriptions. [Note: this isn't a standard, and may never be]).