Skip to content

Relations

Overview

While the UML specification identifies many different relationships and possible sub-types, UMLBoard only uses a subset of them. This subset, however, should be suitable for most diagrams, associations, generalizations and dependencies.

In UMLBoard, associations can be split further into compositions and aggregations:

  • Use compositions to express that the lifetime of one class depends on its related type. E.g., suppose an Order class has a composition relation to OrderItems: If you delete the Order class, all corresponding OrderItems will be deleted accordingly.

  • Aggregations describe a similar relation, but both elements of the connection can exist independently of each other. For example, a Tire might still exist if you delete the Car to which it belongs (although this might depend on your use case).

If you're unsure about the concrete type of association (or it does not matter in your case), choose the more general and unspecified type association.

To specify a generalization relationship, UMLBoard provides the Inheritance or Implementation relation. The concrete type of generalization depends on the target class type. In the case of a class, the generalization will be Inheritance; in the case of an interface, it will be an Implementation. Changing the target class type will automatically change the kind of generalization.

Finally, the dependency relation is not further distinguished. If you need a more fine-grained dependency classification, you could use a meaningful description like «use», «create» or «call» for your relation's text.

Creating and Editing

To create a relationship between two classes, start by dragging one of the connection points that appear when you hover the mouse over a class rectangle onto the target class.

After releasing the mouse on the target, a dialog with the list of available relationships should appear. The available options might vary depending on your source and target class type.

Creating a connection between two classes

Drag a connection point to create a relation between two classes

The created link will have a predefined description depending on the chosen relationship type. You can change it by long-pressing or double-clicking the text. Right-clicking on the connection opens a context menu with additional editing options: Switching the Connections allows you to

Context menu for editing a connection

The context menu provides additional
options for editing a connection.

UMLBoard will always draw an orthogonal connection path by choosing the least distant connection points as start and endpoints. The relation automatically updates if you move either the source or target element.

Anchor Points

1.6

The automatic routing algorithm should work for most basic scenarios but can be limited regarding more advanced layouts. To provide extra guidance to the automatic routing, you can add additional anchor points to a line by pressing Cmd / Ctrl + Click while clicking on a connection line. When drawing a connection between two elements (classes or notes), the algorithm will now always ensure that the line also goes through all anchor points associated with the relation line.

Adding additional Anchor Points to guide the routing algorithm

CMD/CTRL+Click to add an anchor point to a relation.

Just click and hold the mouse to drag the anchor point to a different position and see the changes applied to the routing instantly. In that way, you can force the connection to take a specific direction or move around elements.

Changing the routing of a relation

You can change the routing of a relation by dragging an anchor point to the desired position.

To delete an anchor point again, select it by clicking on it and press the Del or Backspace key.

Note

Anchor points don't change their position if you move the source/end of a relation separately (but do if you move both source and target simultaneously). Therefore, adjusting the anchor points might sometimes be necessary after moving one of the connection's elements.

Choose and Lock Docking Points

1.6

Using anchor points to customize the routing is suitable for more complex scenarios. Still, it can be a bit cumbersome for more straightforward designs. Here, it is often sufficient to define which sides of an element should be used for docking the connection line.

For this, you have two possibilities:

  1. For new lines: While drawing a new connection, just drag its end directly on the connection point of the target element you wish your line to connect to.
  2. For existing lines: Drag the connection's end marker (the blue dot at the end of a line) and drop it onto an arbitrary connection point. In that way, you can also change the source/target element of a connector after creating it.

Choose any of the four docking points to connect your relation with a class or note

Drag the end of a relation over a docking point to lockits ending to that specific port.

After that, the line's ending is locked to this specific point. The layout algorithm will no longer choose a different docking point, no matter where the source and target elements are placed. If you want to remove this constraint and enable auto-docking again, grab the line's end (the blue dot) and drop it directly over the element (and not over one of its docking points). The routing will then choose the docking point that guarantees the shortest connection between two elements.

Another way of locking/unlocking a line to a connection point is to right-click on the end indicator and choose the corresponding menu entry from the context menu.

Right-Click on a relation's end marker to open a context menu

Right-Click on a relation's end marker to open a context menu.

Associations and Properties

1.3

Whether you want to express a relation as an association or through an attribute is totally up to you. You can even start one way and later convert it to the other. For doing so, click on your property/relation and choose the corresponding menu element. You can, of course, undo or revert your decision any time by executing the contrary menu element.

Relations can be converted to properties and vice versa

Relations can be converted to
properties and vice versa

References and further readings


Last update: June 27, 2022