R27 - modelint/shlaer-mellor-metamodel GitHub Wiki

R27 / 1:M

Identifier uniquely distinguishes each instance of exactly one Class

Class has instances uniquely distinguished by one or many Identifier


Here the metamodel varies from Executable UML: โ€œShlaer-Mellor, ... a precursor to Executable UML, required that every class contain at least one identifier, even if that identifier was an attribute placed in the object solely for the purpose of being its identifier. This practice is not required in Executable UML.โ€ MB

This variation from the original Shlaer-Mellor definition OOA96 is rejected here.

Executable UML as defined in [MB] above offers the option to drop referential attributes and, presumably, express referential constraints in OCL (Object Constraint Language). Shlaer-Mellor, on the other hand, encourages the use of referential attributes to enforce model constraints.

Consider the following example from [HTBCM]:

images/R27-10.png

In the model example above, the airport code must be included as part of the runway Identifier so that one runway may be distinguished from another across the set of all airports. Without the Reference to the airport Identifier it would be necessary to write OCL (object constraint language) to express the constraint.

The use of referential attributes and identifiers to establish model constraints has a few advantages over OCL:

  • Expression directly in the data structure โ€” It is more difficult to violate a constraint if the data structure wonโ€™t accept incorrect data in the first place. OCL must be interpreted and translated correctly.

  • Concise expression โ€” In many cases, a simple referential attribute placement or merge replaces a few lines of OCL.

  • Easy to interpret โ€” If you understand a few relational model rules, the implications of referential attribute composition and placement are easy to verify. Just draw tables! The underlying model of OCL is significantly more complex (if one exists at all).

  • Consistency with the relational model โ€” and hence many years of well established math, set, logic and data theory.

Simplicity of a single language โ€” One modeling language (class diagram) can be used to express many fundamental constraints without the need of an additional constraint language.

Formalization

Identifer.(Class, Domain) -> Class.(Name, Domain)