AssociationClasses

The contents of the AssociationClasses package is shown in Figure 66. The AssociationClasses package is one of the packages of the Classes package.

In order to locate the metaclasses that are referenced from this package,
· See "Property (from Kernel, AssociationClasses)" .
· See "Class (from Kernel)" .
· See "Association (from Kernel)" .

AssociationClass (from AssociationClasses)


A model element that has both association and class properties. An AssociationClass can be seen as an association that also has class properties, or as a class that also has association properties. It not only connects a set of classifiers but also defines a set of features that belong to the relationship itself and not to any of the classifiers.

Description

In the metamodel, an AssociationClass is a declaration of a semantic relationship between Classifiers, which has a set of features of its own. AssociationClass is both an Association and a Class.

Attributes

No additional attributes.

Associations

No additional associations.

Constraints

[1] An AssociationClass cannot be defined between itself and something else.

self.allConnections->forAll ( ar |
    ar.type <> self
    and
    ar.type.allParents ()-> excludes ( self )
    and
    ar.type.allChildren () -> excludes ( self ) )

Additional Operations

[1] The operation allConnections results in the set of all AssociationEnds of the Association.

allConnections : Set ( AssociationEnd );
allConnections = self.end->union ( self.allParents ().end )

Semantics

An association may be refined to have its own set of features; that is, features that do not belong to any of the connected classifiers but rather to the association itself. Such an association is called an association class. It will be both an association, connecting a set of classifiers and a class, and as such have features and be included in other associations. The semantics of an association class is a combination of the semantics of an ordinary association and of a class.

An association class is both a kind of association and kind of a class. Both of these constructs are classifiers and hence have a set of common properties, like being able to have features, having a name etc. As these properties are inherited from the same construct (Classifier), they will not be duplicated. Therefore, an association class has only one name, and has the set of  features that are defined for classes and for associations. The constraints defined for class and for association also are
applicable for association class, which implies for example that the attributes of the association class, the ends of the association class, and the opposite ends of associations connected to the association class must all have distinct names.

Moreover, the specialization and refinement rules defined for class and association are also applicable to association class.

Note ­ It should be noted that in an instance of an association class, there is only one instance of the associated classifiers at each end , i.e. from the instance point of view, the multiplicity of the associations ends are `1'.

Notation

An association class is shown as a class symbol attached to the association path by a dashed line. The association path and the association class symbol represent the same underlying model element, which has a single name. The name may be placed on the path, in the class symbol, or on both, but they must be the same name.
Logically, the association class and the association are the same semantic entity; however, they are graphically distinct. The association class symbol can be dragged away from the line, but the dashed line must remain attached to both the path and the class symbol.