Previous Topic: Defining an Owned By Relationship

Next Topic: Defining Employee and Its Attributes

Defining a Refers To Relationship

To define a Refers To relationship:

  1. In the Diagrammer, select the Task node.
  2. Hold down the Control key and right-click the Employee entity.
  3. From the pop-up menu, choose Create Link, and then Refers To.

    A refers to link is created between the two entities:

    PLEX--Defining a Refers To Relationship

    Note: This creates a many-to-one relationship, indicating that an employee can be assigned to many tasks, but that a task can have only one employee assigned to it.

  4. Refresh the Model Editor.

    Note: Creating the relationship between the Task and Employee entities created the triple Task refers to Employee.

    You have now defined relationships between the Project, Task, and Employee entities. Defining these relationships caused the primary keys of the Employee and Project entities to become foreign keys of the Task entity. Next, you change the diagram to display these foreign keys.

  5. In the Diagrammer, select the Task entity.
  6. Right-click the entity, choose Resolved Keys, and then Show.

    Your diagram changes to display the Employee ID and Project ID attributes in the Task entity.

    PLEX--Defining a Refers To Relationship (2)

    Note: The two foreign keys have dashed borders. The Project ID node is displayed in the same color as the Task ID node, as it becomes part of the Task entity’s key (because it results from an owned by relationship). This type of attribute is usually called a parent key because it is the key of the parent entity. The Employee ID node is darker because it is not part of the Task entity’s key.

  7. Close the Diagrammer. Click Yes to save your changes.