Skip to main content

Define relationships between entities

Overview

In the Next Design metamodel, you can define relationships between entities other than ownership relationships that represent parent-child relationships.

The following describes the steps to define relationships between entities in the following order:

  • Relationship types
  • Add a relationship
  • Delete a relationship
  • Change relationship settings
  • Add a field to a relationship
  • Delete a field from a relationship
  • Redisplay a relationship that was removed from a class diagram

Image of a metamodel containing relationships between entities

Metamodel containing relationships between entities


Relationship types

The following types of relationships can be used in metamodel definitions.

Change Shape TypeDescription
EmbeddedAssociations that represent parent-child relationships or aggregation
ReferenceAssociations that represent relationships of use or dependency
DerivationAssociations that represent a tracing relationship with origin
GeneralizationAssociations that represent inheritance of characteristics
Reference

Add Association

The method for adding associations is explained for each type of association.

Add Owned Association

Adding and deleting owned associations between entities is synonymous with defining the structure of the model. For information on how to add and delete owned associations, see Metamodel Definition > Model Structure Definition.

Add Reference Association

There are several ways to add a reference association between entities, as follows. The first method is recommended.

  • Adding a reference relationship on a class diagram
  • Adding a new reference relationship while modeling
  • Adding a new reference relationship while modeling on an ER diagram
  • Adding a new reference relationship while modeling on a form
  • Adding a new reference relationship while modeling on a tree grid

The following explains the procedure for each of the above methods.

Adding a reference relationship on a class diagram

To add a reference relationship between entities using a class diagram, follow the steps below.

Adding a reference relationship on a class diagram

Procedure
  1. Display a class diagram that contains the entities that will be linked by a reference relationship. If one of the entities is not included in the same class diagram, follow the steps in Metamodel Definition > Model Structure Definition > Add an Entity > Add an Existing Entity to a Class Diagram to add the entity to the class diagram.
  2. Move the pointer to the referencing entity, drag the [▲] icon displayed on its four sides, and drop it on the referenced entity.
  3. When you drop it, a popup will appear to select the type of relationship, and select [Reference] from the options.
  4. This defines the reference relationship between the entities, and you can now add a connector representing the relationship to the ER diagram view definition.

Adding a new reference relationship while modeling in an ER diagram

To add a new reference relationship while modeling in an ER diagram, follow these steps:

Add a new reference relationship while modeling in an ER diagram

Operation procedure
  1. Add two models to which you want to connect a reference relationship on the ER diagram.
  2. Select the reference entity, then hold down the ctrl key and select the referenced entity.
  3. Click one of the following commands. (All perform the same function)
  • [Profile] > [Diagram] > [Add Connector] > [Add Reference and Connector] on the ribbon
  • [Profile] > [Metamodel] > [Relationship] on the ribbon
  • [Add Shape] > [Add Shape] > [Add Connector] > [Add Reference and Connector] on the ribbon
  • [Add Relationship...] on the context menu
  1. Clicking this will display the [New ConnectorShape] dialog box, and after setting the items, click the [OK] button.
  2. This makes the following changes at once and connects the relationship lines between the two models.
  • Adds a reference relationship between entities to the metamodel
  • Defines a connector that represents the relationship in the view definition of the ER diagram
  • Adds a reference relationship between models
note
  • A new relationship added to the metamodel is not automatically displayed in existing class diagrams. If necessary, follow the instructions below to display a relationship that has been removed from a class diagram.

Adding a new reference relationship while modeling in a form

To add a new reference relationship while modeling in a form, follow the steps below.

Adding a new reference relationship while modeling in a form

Operation procedure
  1. Select the model that will be the reference source on the form (select a model other than the one displayed in the grid).
  2. Clicking one of the following commands will display the [Add New Fields] dialog box. (All have the same effect)
  • [Profile] > [Metamodel] > [Filelds] on the ribbon
  • [Profile] > [Form] > [Add New Fields] on the ribbon
  • [Form] > [Form] > [Add New Fields] on the ribbon
  • [Profile] > [Add New Field...] on the context menu
  1. Click the [...] button on the right side of the [Data Type] setting item to open the finder to search for the referenced entity.
  2. Search for the referenced entity from the list on the finder and double-click it to enter the referenced entity in [Data Type].
  3. Select [Reference] from [Field Type] in the setting item, set the other items, and then click the [OK] button.
  4. This will make the following changes at once and add the field to the form.
  • Add a reference relationship between entities to the metamodel.

  • Add a field that represents the referenced model to the form's view definition.

Add a new reference relationship while modeling in the tree grid.

To add a new reference relationship while modeling in the tree grid, follow these steps:

Add a new reference relationship while modeling in the tree grid

Operation procedure
  1. Select the model that will be the reference source in the tree grid.
  2. Click one of the following commands to display the [Add New Fields] dialog: (Both perform the same action)
  • [Profile] > [Metamodel] > [Filelds] on the ribbon
  • [Profile] > [Form] > [Add New Fields] on the ribbon
  • [Form] > [Form] > [Add New Fields] on the ribbon
  • [Profile] > [Add New Field...] on the context menu
  1. As in the previous section "Adding a new reference relationship while modeling in a form," set the items in the [Add New Fields] dialog and then click the [OK] button.
  2. This makes the following changes at once, allowing you to add a referenced model under a referencing model in the tree grid.
  • Adds a reference relationship between entities to the metamodel
  • Adds a field that can display the referenced model under the referencing model in the tree grid view definition

Adding a derived relationship

To add a derived relationship using a class diagram, follow these steps:

Add derived relationship

Operation procedure
  1. Add the entities that have a derived relationship to each other to the class diagram.
  2. Move the pointer to the derived entity, drag the [▲] icon displayed on its four sides, and drop it on the entity that is the source of the derivation.
  3. When you drop it, a popup will appear to select the type of relationship, and select [Derivation] from the options.
  4. This defines a derived relationship between the entities, and you will be able to add derivations and trace relationships between models during modeling.
tip
  • When defining a derived relationship, we recommend adding a new class diagram just for defining the derived relationship, in addition to the existing class diagram. Since many derived relationships are defined across the metamodel, if they are defined separately in multiple class diagrams, it will be difficult to grasp the excess or deficiency of derived relationships in the entire metamodel.

Adding an inheritance relationship

To add an inheritance relationship between entities, use a class diagram and follow the steps below.

Adding an inheritance relationship

Procedure
  1. Add the entities that will have an inheritance relationship to the class diagram.
  2. Move the pointer to the inheriting entity, drag the [▲] icon that appears on its four sides, and drop it on the inheriting entity.
  3. When you drop it, a popup will appear to select the type of relationship, and select [Generalization] from the options.
  4. This defines the inheritance relationship between the entities, and the fields of the inheriting entity will be available in the inherited entity.

Deleting a relationship

There are several ways to delete a relationship between entities, as follows:

  • Delete a relationship from the metamodel
  • Delete a relationship from a class diagram (hide it from the class diagram without deleting it from the metamodel)

The method for deleting a relationship is the same regardless of the type of relationship.

Delete a relationship from the metamodel

To delete an existing relationship from the metamodel in a class diagram, follow the steps below.

Delete relationship from metamodel

Procedure
  1. If you want to delete a relationship that is used in a model, delete the relationship from the model first.
  2. In the class diagram, select the relationship you want to delete from the metamodel, and select [Delete From Model] from the context menu.

You can also delete a relationship from the metamodel by following the steps below.

Other Procedures
  1. In the Profile Navigator, select the relationship you want to delete.
  2. Check the details of the selected relationship in the Inspector.
  3. Select [Delete] from the context menu or press the delete key.
note
  • Owned and inherited relationships are not displayed in the Profile Navigator, so delete them from the class diagram.
  • If the relationship you want to delete is not displayed in the class diagram, follow the instructions below to "Redisplay a relationship deleted from a class diagram" to unhide the hidden relationship and then delete it.

Delete a relationship from a class diagram

To delete some relationships from a class diagram and hide them, follow the steps below.

Delete a relationship from a class diagram

Operation procedure
  1. Select the relationship you want to delete from the class diagram and select [Delete From Diagram] from the context menu or press the delete key.

Change Relationship Settings

To change the number of data in an owned relationship or change a reference relationship to a two-way reference, use the Inspector as follows.

Change Relationship Settings

Operation Procedure
  1. Click [View] > [Pane] > [Inspector] from the ribbon to display the Inspector on the right side of the screen.
  2. Select the target relationship in the class diagram or profile navigator.
  3. Select [Metamodel] from the tab at the top of the Inspector.
  4. To change the number of data in an owned relationship and restrict the number of models that can be added as children, change [Multiplicity] in the [Fields] group.
  5. To allow reference relationships to be edited only from the referencing model, uncheck the [IsTwoWay] check box in the [Relationship Class] group.
note
  • To see the field name that holds the association in the class diagram, click [Home] > [Class Diagram] > [Show Label] on the ribbon and check [Field Name].
  • To see the display name of the associated class in the class diagram, click [Home] > [Class Diagram] > [Show Label] on the ribbon and check [Association Class Name].
  • Editing the label displayed on the association line changes the [Display Name] and [Field Name] of the field.
Reference

Adding Fields to Associations

Use the Inspector to add fields to reference and derived associations.

Operation procedure
  1. Same as the following operation procedure for entities.

Metamodel definition > Entity field definition > Add a field > Add a field by inspector

Remove a field from a relationship

To remove a field from a reference relationship or derived relationship, use the inspector, just like adding it.

Operation procedure

Redisplay a relationship deleted from a class diagram

To redisplay a relationship deleted from a class diagram or to display a relationship added outside of a class diagram, follow the steps below from the class diagram.

Redisplay relationships removed from class diagram

Operation procedure
  1. Select an entity with relationships in the class diagram and execute [Show hidden relationships] from the context menu.