R21 - modelint/shlaer-mellor-metamodel GitHub Wiki

R21 / Mc:Mc-M

Attribute is constrained to match value of zero, one or many Identifier Attribute

Identifier Attribute constrains value of zero, one or many Attribute


An Attribute can refer to an Identifier Attribute and, in so doing, becomes a referential attribute. In reality, there is no actual 'reference' in the sense of a handle or pointer. Instead, a constraint is defined such that the referring Attribute may only take on a value (for some instance in the source/from Class) that matches a value present in the referenced Identifier Attribute for some instance in the target/to Class.

An implementation of a model may, of course, employ programming style pointers. But the model itself is built on relational, i.e. mathematical, foundations where no concept of a pointer is defined.

If an Attribute does not reference any Identifier Attribute it is a non-referential Attribute.

The same Attribute may refer to multiple Identifier Attributes. Consider this example from the Elevator Case Study class diagram:

images/class-attribute-subsystem/R21-10.png

Here the Top Bank Level.Bank Attribute references both the Bank Level.Bank and the Bank.Name Identifier Attributes. In doing so, we ensure that the Bank.Name value found via R5 is always the same value found via R38 in Bank Level.Bank.

As shown in the example below, multiple instances of Attribute Reference may correspond to the same Attribute / Attribute Identifier pair on R21.

images/class-attribute-subsystem/R21-20.png

Formalization

Attribute Reference.(From attribute, From class, Domain) -> Attribute.(Name, Class, Domain)
Attribute Reference.(To identifier, To attribute, To class, Domain) -> Identifier Attribute.(Identifier, Attribute, Class, Domain)

Constraints

The To attribute and To class referential attributes are constrained as follows:

(To attribute, To class) != (From attribute, From class)

An Attribute may not refer to itself.