OLAP Data Model : Fields : Link Fields

Link Fields
Link fields are pointers that create inter-object relationships. All relationships are bi-directional, therefore every link has an inverse link that defines the same relationship from the opposite direction. A link and its inverse link can be in the same table or they can reside in different tables. An example link declaration in XML is shown below:
<table name="Participant">
<fields>
<field name="MessageAddress" table="Address" type="LINK" inverse="Messages"/>
...
</fields>
</table>
In this example, the link field MessageAddress is owned by the Participant table and points to the Address table, whose inverse link is called Messages. The table to which a link points is called the link’s extent.
Link fields are always MV: the collection property, if set, is ignored. A link’s values are IDs of objects that belong to its extent table. Relationships are created or deleted by adding IDs to or removing IDs from the link field. Like MV scalar fields, link values are sets, hence duplicates are ignored.
Because relationships are bi-directional, when a link is updated, its inverse link is automatically updated at the same time. For example, if an object ID is added to MessageAddress, connecting the owning participant object to a specific Address object, the Messages link for that address object is updated to point back to the same participant.
One side-effect of this referential integrity behavior is that objects can be implicitly created: if an object ID is added to MessageAddress and the corresponding person doesn’t exist, it is created. An implicitly-created object will only have an _ID and automatically-updated link field value(s).
If a link’s owner and extent are the same table, the relationship is reflexive. An example reflexive relationship is the Manager/DirectReports relationship in the Person table:
<table name="Person">
<fields>
<field name="DirectReports" table="Person" type="LINK" inverse="Manager"/>
<field name="Manager" table="Person" type="LINK" inverse="DirectReports"/>
...
</fields>
</table>
A link can also be its own inverse: such relationships are called self-reflexive. For example, we could define spouse and friends as self-reflexive relationships (though some may argue friendship is not always reciprocal).