Visual OCL

TU-Berlin | Faculty IV | Institute ISTI | Research group TFS

User Guide for the Eclipse VOCL-Plugin
group 2

small logo
section: < previous | next >
| |
chapter: << previous | next >>

2.4 AssociationRoles

In addition to ClassifierRoles which are the most important elements to define constraints, Associationroles shall connect ClassifierRoles, regardless of the type, to form Navigation expression that will be discussed in the next chapter. The direction of a AssociationRole is indicated by the arrow at the end and a rolename located at the target.

2.4.1 Creating AssociationRoles

For creating AssociationRoles have to following the next steps:
  1. Create two ClassifierRoles regardless of the type.
  2. Select the entry AssociationRole in the palette. A Cursor with a connector below is displayed and enabled only by moving it over a ClassifierRole.
  3. Select the source (c:Company) and target ClassifierRole (:Employee).
  4. A dialog is opened (see Fig. 2.4.2).  On the left side you see the selected source ClassifierRole and on the right side the selected target ClassifierRole.  In the textfield  above you can specify a name for the target side so that navigation is possible later. If you leave this field empty, the type of the target ClassifierRole will be taken.
  5. Then click Ok and the AssociationRole is created.

Fig. 2.4.1 - starting point for creation of AssociationRoles


Fig. 2.4.2 - dialog for creation of AssociationRules

2.4.2 Deleting AssociationRoles

AssociationRoles can be deleted in two different ways: Firstly, you select the AssociationRole you want to delete and select delete in the contextmenu. The connected ClassifierRoles remain untouched. Secondly, an AssociationRole will be deleted if you delete either the source ClassifierRole or the target ClassifierRole. These two kinds of deletion prevent that one end of an AssociationRole is unbound.

Fig. 2.4.3 - AssociationRole wih an endrole "is_employed_in"

2.4.3 Editing AssociationRoles


You can edit the rolename of the AssociationRole by doubleclicking on the label. Then a CellEditor is opened and you can enter a new name and press enter.

 

2.4.4 Special Features

You can put an AssociationRole at different locations of a ClassifierRole because of the anchor points a ClassifierRole possesses. First you click on the source ClassifierRole and the anchor point that the nearest one is choosen. Then you move the mouse cursor to the target ClassifierRole and you see that the AssociationRole is connected to different locations while moving the cursor over the ClassifierRole.

An other special feature of AssociationRoles are bendpoints (see Fig 2.4.4). On a selected AssociationRole you can see a small point in the middle. If you move the mouse cursor to it, you will see that the cursor sightly. Now you can drag this point to another position. The line breaks into two parts and a bendpoint was created.
Bendpoints have no relevance for the model but they can improve the design of a VOCL-Diagram.


Fig. 2.4.4 - AssociationRole with a bendpoint
©2005 TFS