Previous Table of Contents Next


8.9 Semantics of Associations

   Associations are the MOF Model’s second mechanism for relating MOF values at the M1-level. A MOF M2-level Association defines a binary relation between pairs of M1-level Instances, where the relationships in the relation are called Links. The Links for a given M2-level Association conceptually belong to a Link set.

   NOTE: While the MOF Model appears to support N-ary Associations, this is not so. There is a Constraint that states that an Association must have precisely 2 Association Ends; see “AssociationsMustNotUnary,? on page 117.

   An M2-level Association definition specifies the following properties:

8.9.1 MOF Associations in UML notation

    A MOF Association is represented in UML notation as shown in Figure 8.6.

   <Association Name>

   <Class1 Name> <end1 name> <end2 name>

   <Class2 Name>

   <end1 multiplicity> <end2 multiplicity>


   aggregation - none

   aggregation - composite

   navigable in direction indicated

   aggregation - shared

   Figure 8.6 - An M2-level Association in UML notation

   The connecting line denotes an Association between two Classes. The text of <Association Name>, <end1 name> and <end2 name> denote the “name? values for the respective Association and AssociationEnds. If the Association name is preceded by a forward slash, the Association has “isDerived? set to true.

   The Class boxes denote the respective types of the two ends. If the two ends of an Association have the same type, the Association line loops around so that it connects a Class box to itself.

   The <end1 multiplicity> and <end2 multiplicity> text give the multiplicity settings for the respective ends of the Association. The text that can appear here consists of an optional bounds specification with syntax:

   <bounds>::= [<number> ‘..’] (<number> | ‘*’)

   and the optional keyword “ordered.?

   Finally, the navigability and aggregation of the ends of the Association are (partially) specified by the symbols at the respective ends of the line:

   NOTE: There are a couple of anomalies in the mapping of UML Association notation to MOF Associations. First, while navigability and aggregation are orthogonal in the MOF, it is not possible to put both a diamond and an arrow head on the same end of a UML Association line. This means, for example, that it is not possible to express (the lack of) navigability from a component end to a composite end. Second, UML is imprecise about what an Association line with no arrowheads means. It can mean that the Association is not navigable, or alternatively that its navigability is not shown.

8.9.2 Core Association Semantics

   This sub clause defines the core semantic model for M1-level Association instances in a rigorous, mapping independent fashion, and enumerates some important characteristics that follow from the definition.

8.9.2.1 A Mathematical Model of Association State

    Given an M2 Association labeled as in Figure 8.6, the mapping to M1-level Link sets and Links can be modeled as follows:

   i. the number of Links in each End1_Linksi set must be greater than or equal to <End2.lower>, and less than or equal to <End2.upper>, and

   ii. the number of Links in each End2_Linksi set must be greater than or equal to <End1.lower>, and less than or equal to <End1.upper>.

   Ideally, the computational semantics of M1-level Associations for a particular mapping should be describable as transformations from one Well-formed State to another. However, some mappings must be defined such that the State of an Association instances is not always a well-formed. For example, in the IDL mapping, deletion of an Instance may cause an End_Links set to contain too few Links.

   The general model of an M1-level Association’s State may be further constrained by M2-level Constraints on the Association or other elements of the meta-model. Other systematic restrictions may apply in some mappings; for example, 8.11.1, “The Reference Closure Rule,? on page 153 and 8.11.2, “The Composition Closure Rule,? on page 155.

8.9.2.2 Characteristics of M1-level Associations

   The definitions of Links and Link_Sets above mean that M1-level Association instances have the following characteristics:

8.9.3 AssociationEnd Changeability

   The “isChangeable? flag for an AssociationEnd determines whether or not the APIs for the Association should allow clients to change Links in an M1-level Association instance. The precise interpretation of this flag is mapping specific.

8.9.3.1 AssociationEnd Navigability

   The “isNavigable? flag for an AssociationEnd determines whether or not clients should be able to “navigate? the Links in an M1-level Association instance. The flag also determines whether or not the AssociationEnd can be used as a “key.? This flag’s interpretation (i.e., its impact on APIs) will depend on the mapping used.

8.9.4 Association Aggregation

   The “aggregation? attributes of an Association’s two ends determines the aggregation semantics for the corresponding M1-level Association instances; see 8.10, “Aggregation Semantics,? on page 152 . The impact of aggregation semantics are largely mapping specific. However, “composite? aggregation does place constraints on the Link_Set of a Well-formed State.

8.9.5 Derived Associations

   When an M2-level Association has “isDerived? set to true, the resulting M1-level Association’s Link_Set is calculated from other information in the M1-level model. The M1-level semantics of derived Association instances is beyond the scope of the MOF specification.