Previous Topic: Creating a Diagram

Next Topic: CA Plex Feature: Dynamic Diagrams

Defining Relationships with the Diagrammer

In this section, you define two relationships between entities: an owned by, and a refers to relationship.

In your application, a task is part of a project. Therefore, if you delete a project, you want all of its tasks to be deleted. Because of this, you define Project as the owner of Task, so that each task is directly related to the project it is part of. This is known as an owned by relationship, which is sometimes referred to as a parent‑child relationship.

When you define a task that is part of a project, this project management application requires that you specify an employee who is responsible for completing the task. Because an employee can be assigned to more than one task, in more than one project, you do not want to delete the employee record if you delete a task. So, you define a refers to relationship between the Task and Employee entities.

When you add the triple Task refers to Employee, the Task entity stores the identifier of the Employee entity, and uses it as a pointer to that entity. The stored value is called a foreign key.

An employee can be assigned to more than one task, even to more than one task in more than one project, but a task can have only one employee assigned to it.

To define relationships in a diagram:

  1. Select the Task node and then hold down the CTRL key.
  2. With the CTRL key still held down, right-click the Project node.
  3. From the pop-up menu, choose Create Link, and then Owned By.

    This creates an owned by relationship between the two entities. Next, you create a refers to relationship between Task and Employee.

  4. Select the Task node.
  5. Hold down the CTRL key and right-click the Employee node.
  6. From the pop-up menu, choose Create Link, and then Refers To.

    The diagram should look something like this:

    Defining Relationships with the Diagrammer

    You can see the relationships between the entities, but the links look the same, with no indication of what kinds of relationships they represent. Next, you change the display so that it shows more information.

  7. From the View menu, choose Display Link Labels, and then Link Names. The Diagrammer window should look something like this:

    Defining Relationships with the Diagrammer (2)

  8. If the link label appears on top of one of the nodes, drag it to a more appropriate location. When you select a label, the associated link turns red to show you which link the label goes with.
  9. Save your model and close the Diagrammer.