Associations

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  How to Model... > Relationships >

Associations

An association is a conceptual connection between two elements. You can create association relationships like any other relationship in UModel, see Creating Relationships.

 

When you create an association between two classes, a new attribute is automatically inserted in the originating class. For example, creating an association between Car and Engine classes adds a property of type Engine to the Car class.

um_association_1

When a class is added to a diagram, its associations are shown automatically on the diagram, provided that the following conditions are met:

 

The option Automatically create Associations is enabled from Tools | Options | Diagram Editing tab.
The attribute's type is set (in the image above, Property1 is of type Engine)
The class of the referenced "type" is also present in the current diagram (in the image above, the class Engine).

 

You can also explicitly show the class properties of any class as associations on the diagram. To do this, right-click a class property, and select one of the following commands:

 

Show | <Property> as Association
Show | All Properties as Associations

 

When you click an association on the diagram, its properties can be changed, if necessary, from the Properties window.

um_association_2

It is important to note the properties listed below. Modifying these properties changes the appearance of the association on the diagram, or adds various informative text labels. For information about showing or hiding text labels, or changing the appearance of the relationship (such as color or line thickness), see Changing the Style of Lines and Relationships.

 

Property

Purpose

A: name

The name of the member on end A of the relationship. In the car example above, it is Property1.

A: aggregation

Enables you to change the type of association on end A. Changing this property will also change the representation of the association on the diagram. Valid values:

 

none

Denotes a normal association um_ic_association

shared

Changes the association into an aggregation um_ic_aggregation

composite

Changes the association into a composition um_ic_composition

A: memberEndKind

Attributes participating in a relationship can belong either to a class or to the association. This property specifies who owns this end of the relationship and whether this end of the relationship is navigable. ("Navigable" means that the end has an "arrow" ending). Valid values:

 

memberEnd

Member on this end belongs to the class.

ownedEnd

Member on this end belongs to the association

navigableOwnedEnd

Member on this end belongs to the association and this end becomes navigable.

 

Setting both A and B ends to ownedEnd makes the association bi-directional.

A: multiplicity

Multiplicity specifies the number of objects at this end of the relationship. For example, if a car has four wheels, multiplicity would be 1 on one end and 4 on the other end of the relationship.

um_multiplicity

 

The same set of attributes are available for end B of the relationship.

 

If enabled, the property Show Assoc. Ownership in the Styles window displays ownership dots for the selected relationship. By default, this property is set to False. The following is an example of a class where Show Assoc. Ownership is set to True:

um_association_ownership

 

 

Creating reflexive associations

Associations can be created using the same class as both the source and target. This is a so-called "self link", or reflexive association. It may describe, for example, the ability of an object to send a message to itself, for recursive calls. To create a self link, click the association toolbar button um_ic_association, then drag from the element, dropping somewhere else on the same element.

um_reflexive_association

 

Creating association qualifiers

Associations can be optionally decorated with association qualifiers. Qualifiers are attributes of an association. In the example below, the association qualifier isbn specifies that a book can be retrieved from the list of books by this attribute. To add a qualifier:

 

1.Create an association between two classes.
2.Right-click the association and select New | Qualifier.

um_association_qualifier

To rename or delete association qualifiers, use the same steps as for all other elements, see Renaming, Moving, and Copying Elements and Deleting Elements.


© 2019 Altova GmbH