4.2.3 Relationships and Roles
Managing relationships and roles
Relationships and roles form connections between objects. In
the Matrix Editor these are represented in the cells of the matrix. Each row in
the matrix has an object in the vertical axis, and each column has an object in
the horizontal axis. Thus each cell is defined by two objects, a row object and
a column object. If those objects are related either a relationship or role is
shown as an entry in that cell. In the rest of this section we will refer to
relationships: the operations are also applicable when roles are being viewed
(selected in the View menu).
Relationships and roles
can be viewed and edited similarly
to objects. The fastest way to edit their properties is to double click them.
Alternatively, you can first select the item and then either press Enter or
choose
Properties... from the pop-up menu or the
Edit menu. If
there are several relationships between the objects – and thus several
elements in the same cell – a dialog box appears for selecting the desired
relationship.
As a result of the operation, a property dialog opens
allowing you to edit the information about the
relationship.
Adding relationships
To add a new relationship:
1) | Select
the cell in the matrix between the desired objects on the axes.
|
2) | Open the
pop-up menu with the right mouse
button. |
3) | Select
Add... from the pop-up menu.
|
| Selection
of the right kind of relationship works similarly to objects. When you create a
relationship a dialog opens showing possible relationship
types. You can reduce the number of items in the dialog
by choosing a default type for new relationships in this Matrix Editor from the
Types menu or the relationship types
toolbar. |
Double clicking also works
as a shortcut for adding relationships. Note that this works only if the cell is
empty: otherwise it shows the properties of the existing relationship.
As a result a dialog window opens with possible
relationships to be added. Each item is a binding, consisting of a relationship,
the roles that will be created with the relationship, and which object will be
in which role. If only one combination of relationships and roles is possible
the tool bypasses this dialog and the property dialog appears immediately. This
dialog contains tabs for property dialogs on the relationship and each of the
roles.
| If
a relationship or a role does not have properties, the tab label text on the
notebook page is italicized. The tab label for roles also shows the name of the
object to which that role attaches.
|
4) | Fill
in the properties of the new relationship and roles. Click the tab labels to
move between relationship and role
pages. |
5) | Accept
the new relationship and its roles by clicking All OK.
|
The relationship is added to the matrix,
and will be shown in the cell in accordance with your view and format
settings.
N-ary relationships
As the Matrix Editor only has two axes, and thus two objects
corresponding to each cell, it cannot show n-ary
relationships.
Ports
As the Matrix Editor only shows objects on the axes, not
individual ports for those objects, it does not show relationships involving
ports.
Moving a relationship or a role
As with objects, relationships and roles can also be moved.
Moving a relationship or role changes the objects involved in it. To move a
relationship:
1) | Select
a
cell. |
2) | Open
a pop-up menu from the
dialog. |
3) | Choose
Move from the
menu. |
4) | Click
a new position in the
matrix. |
Relationships cannot be moved in
a matrix if there is a Diagram representation of the same
graph.
Deleting a relationship or a role
To delete a relationship in a matrix:
1) | Select
the cell containing the
relationship. |
2) | Open
the pop-up menu from the
cell. |
3) | Choose
Delete from the pop-up menu or the Edit menu (or press
Delete button in the
toolbar). |
Relationships and roles cannot
be deleted in a Matrix if there is a Diagram representation of the same graph:
delete the relationship in the Diagram, and the change will be propagated to the
matrix next time you choose
View | Refresh.