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.

Custom Docking Points

1.8

Suppose your class has many incoming or outgoing connections. In that case, only a single docking point for all links can impair the overview.

To dock your connection to an arbitrary point, press the Shift key while drawing the connection line over a class's border. A small dot will indicate the position of your new docking point. Release the mouse (while keeping Shift pressed) to create your connection.

Custom Docking Points

Press SHIFT to dock a connector to an arbitrary position.

Your new docking point will keep its position relative to the total length of the classifier's edge. So if you grow or shrink the classifier, the docking point will adjust its position according to the new size.

Tip

You can also use this approach when moving a connection's endpoint. Just press Shift and dock the endpoint at the desired position.

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

1.8

Navigability in UML describes how easy it is for a class instance to reach the object on the other side of a connection. If, for example, a connection has navigation arrows for both of its ends, that means there must be an efficient way during runtime to navigate from one edge to the other and vice versa (think, for example, of a double-linked list). How this navigation should actually be realized is implementation specific.

UMLBoard supports navigability for all types of associations and the usage relation. To set the navigation of a relation, you can pick the connection directly or choose one of its endpoints and select one of the Navigation context menu entries: Source, target, or both. Picking the same menu item again will remove the navigation from the corresponding edge.

Changing the navigability of a connection.

Changing the navigability of a connection.

Making the source of an aggregation/composition relation navigable does technically work. However, you won't see the resulting navigation arrowhead as it would overlap with the diamond symbol. Instead, you can draw two relations, one for the aggregation and the other for expressing the navigability from target to source.

Note

When loading diagrams created with a version older than 1.8.0, UMLBoard will automatically change the navigability of each usage relation to target to render the arrowhead correctly.

Moving Relations Vertically/Horizontally

1.9

Sometimes, you want to draw several relations in parallel between two elements, e.g., when a class has more than one outgoing connection to another. So far, you have had to drag the endpoints of each relation separately to the desired positions. This can be cumbersome, especially if the space between your lines is small. Instead, you can now click on the relation's name and drag it up/down (or left/right) to move the whole connection to the desired position.

Moving relations vertically between two elements.

Moving relations vertically between two elements.

This works for all relations as long as they are orthogonally attached to their elements (either on two horizontal docking points or two vertical ones).

Tip

Instead of using the mouse, you can also use the arrow keys. Just click on the relation to select it and move the up/down or left/right keys to move the relation.

Moving a Relation's Name

1.9

While dragging a relation lets you change its position, pressing Shift while dragging its name allows you to move only the title while keeping the other parts untouched. This can be useful for long texts that would otherwise be overlapped by other diagram elements. The new text position will be "locked" and will have the following behavior:

  • When moving both ends of the relationship, the text will keep its new place relative to both ends.
  • Dragging only one end will not affect the text position. It stays "locked" at its current custom position.

You can always go back to the auto-positioning mode by right-clicking on the text and unchecking the lock menu entry. The layout algorithm will then calculate the new text position depending on the shape of the relation.

Using SHIFT+Drag to move a relation's name around.

The name of a relation can be moved around when pressing SHIFT while dragging.

Choosing between Overlapping Lines

1.9

Ever had the problem that you could not grab a line because it was hidden by another one? Press Cmd (macOS) or Ctrl (Windows/Linux) and use the right/left arrow keys while hovering over the lines to step through them one by one. The currently top most line will be marked in bold color. After you reached the desired connection, click with the mouse to select it. Now you can easily manipulate the line.

Navigating through overlapping lines. The currently active line is drawn with a stronger line width.

Press CMD or CTRL and use the arrow keys to navigate through overlapping lines.

References and further readings


Last update: January 31, 2023