Relationship definition between entities
Overview
The Next Design metamodel allows you to define relationships between entities in addition to ownership relationships that represent parent-child relationships.
The following steps guide you through defining the relationships between entities:
- Related types
- Add association
- Delete association
- Change related settings
- Add a field to the association
- Remove fields from associations
- Redisplay the associations deleted from the class diagram
Image of metamodel including relationships between entities
Related types
The types of associations available in the metamodel definition are:
Kind | Description |
---|---|
Embedded | Relationships that represent parent-child relationships and aggregations |
Reference | Relationships that represent usage and dependency relationships |
Derivation | Relationship that represents the trace relationship with the origin |
Generalization | Relationships that represent inheritance of characteristics |
reference
- For more information, see Reference> related-types-and-details.md.
Add association
Explains how to add a relationship for each type of relationship.
Add ownership related
Adding/removing ownership relationships between entities is synonymous with defining the structure of a model. See Metamodel Definition> Model Structure Definition for how to add/remove ownership.
Add reference association
There are several ways to add reference associations between entities: The recommended method is the first method.
- Add reference association in class diagram
- Add new reference associations while modeling
- Add new reference associations while modeling with ER diagram
- Add new reference associations while modeling in document form
- Add new reference associations while modeling in the tree grid
The operation procedure is explained below for each of the above methods.
Add reference association in class diagram
Operation procedure
- Display a class diagram that contains each other's entities that make reference associations. If one of the entities is not in the same class diagram, then Metamodel Definition> Model Structure Definition> Add Entity> Add Existing Entity to Class Diagram (./model-structure-definition#model) -Structure-definition--add-exist-entity-to-class-diagram) to add the entity to the class diagram.
- Move the pointer to the referencing entity, drag the [โฒ] icon displayed in the four directions, and drop it on the referencing entity.
- When dropped, a pop-up will appear where you can select the relevant type and select Reference from the choices.
- This defines the reference relationship between the entities and allows you to add a connector that represents the relationship to the view definition in the ER diagram.
Add new reference associations while modeling with ER diagram
Operation procedure
- Add two models on the ER diagram for which you want to make a reference association.
- Select the referenced entity, then hold down the ctrl key and select the referenced entity.
- Click one of the following commands. (Both have the same behavior)
- Ribbon Profile> Diagram> Connector> Add Reference and Connector
- Ribbon [Profile]> [Metamodel]> [Relationship]
- Ribbon [Shape]> [Shape]> [Connector]> [Add Reference and Connector]
- Add Association ... in the context menu
- Click to display the [New Connector Shape] dialog, set the items, and then click the [OK] button.
- This will make the following changes at once and connect the related lines between the two models.
- Added reference relationships between entities in the metamodel
- Define a connector that represents a connection to the view definition of the ER diagram
- Add reference relationship between models
note
- New associations added to the metamodel will not automatically appear in existing class diagrams. If necessary, display it on the class diagram according to "Redisplay the association deleted from the class diagram" below.
Add new reference associations while modeling in document form
Operation procedure
- Select the model to refer to on the document form (select a model other than the one displayed in the grid).
- Click one of the following commands to display the Add New Fields dialog. (Both have the same behavior)
- Ribbon Profile> Metamodel> Filelds
- Ribbon Profile> Form> Add New Fields
- Ribbon [Form]> [Form]> [Add New Fields]
- Add new field in context menu ...
- Click the [...] button at the right end of [Data Type] of the setting item to open the finder to search for the referenced entity.
- Find the referenced entity in the list on the Finder and double-click it to enter the referenced entity in Data Type.
- Select [Reference] from [Field Type] of the setting items, set other items, and then click the [OK] button.
- This will make the following changes at once and add the field on the document form.
- Added reference relationships between entities in the metamodel
- Added a field to represent the referenced model in the view definition of the document form
Add new reference associations while modeling with tree grid
Operation procedure
- Select the model to refer to on the tree grid.
- Click one of the following commands to display the Add New Fields dialog. (Both have the same behavior)
- Ribbon Profile> Metamodel> Filelds
- Ribbon Profile> Form> Add New Fields
- Ribbon [Form]> [Form]> [Add New Fields]
- Add new field in context menu ...
- Set the items in the Add New Fields dialog, and then press the OK button, as in "Adding a new reference association while modeling in a document form" above.
- This allows you to make the following changes at once and add the referenced model below the referencing model on the tree grid.
- Added reference relationships between entities in the metamodel
- Added a field that can display the referenced model below the referencing model in the view definition of the tree grid.
Add derivation related
To add a derivation association using a class diagram, do the following:
Operation procedure
- Add each other's entities that connect the derivation associations to the class diagram.
- Move the pointer to the entity to be derived, drag the [โฒ] icon displayed in the four directions, and drop it on the entity from which it is derived.
- When you drop it, a pop-up will appear to select the related type, and you can select Derivation from the choices.
- This defines the derivation relationships between the entities and allows you to add derivation and trace relationships between the models during modeling.
tip
- When defining a derivation association, it is recommended to add a new class diagram to define only the derivation association, in addition to the existing class diagram. Since many derivation relationships are defined across the metamodel, it is difficult to understand the excess or deficiency of derivation relationships in the entire metamodel if they are defined separately in multiple class diagrams.
Add inheritance related
To add inheritance associations between entities, use the class diagram as follows:
Operation procedure
- Add each other's entities that make an inheritance relationship to the class diagram.
- Move the pointer to the inherited entity, drag the [โฒ] icon displayed in the four directions, and drop it on the inherited entity.
- When dropped, a pop-up will appear where you can select the related type and select Generalization from the choices.
- This defines the inheritance relationship between the entities and makes the fields of the inheriting entity available to the inherited destination.
Delete association
There are several ways to remove associations between entities:
- Remove associations from metamodel
- Remove associations from class diagram (hide them in class diagram without removing them from metamodel)
The method for deleting associations is the same regardless of the type of association.
Remove associations from the metamodel
To remove an existing association from the metamodel in a class diagram, do the following:
Operation procedure
- If you want to remove the association used in the model, remove the relevant association from the model beforehand.
- Select the association you want to delete from the metamodel in the class diagram and run Delete From Model from the context menu.
You can also remove the association from the metamodel by following the steps below.
Other operating procedures
- Select the association you want to delete in the Profile Navigator.
- Review the relevant details selected in the Inspector.
- Execute [Delete] from the context menu, or press the delete key.
note
- Ownership and inheritance relationships are not visible in the profile navigator, so delete them in the class diagram.
- If the association you want to delete is not displayed in the class diagram, redisplay the hidden association and then delete it according to "Redisplay the association deleted from the class diagram" below.
Remove associations from class diagram
To remove some associations from the class diagram and hide them, do the following:
Operation procedure
- Select the association you want to delete from the class diagram and execute [Delete From Diagram] from the context menu or press the delete key.
Change related settings
To change the number of ownership-related data and change reference-related to bidirectional references, use the Inspector as follows:
Operation procedure
- Click View> Pane> Inspector from the ribbon to display the Inspector on the right side of the screen.
- Select the target association in the class diagram or profile navigator.
- Select Metamodel in the tab at the top of the Inspector.
- To change the number of ownership-related data to limit the number of models that can be added to the child, change Multiplicity in the Filelds group.
- To allow reference associations to be edited only from the referencing model, uncheck the IsTwoWay checkbox in the Relationship Class group.
note
- To see the field names that hold the association in the class diagram, turn on the Home> Class Diagram> Show Label toggle button from the ribbon.
- Editing the label displayed on the related line changes the Display Name and Field Name of the field.
reference
- Setting items for associations differ depending on the type of association.
- For more information, see Reference> Profile Settings and Modeling Changes.
Add fields to associations
Use the Inspector to add fields to reference-related and derived-related relationships.
Operation procedure
Similar to the following steps for an entity.
Metamodel definition> Entity field definition> Add field> Add field in Inspector
Remove fields from associations
To remove a field from a reference-related and derived-related relationship, use the Inspector as you would add it.
Operation procedure
- Similar to the following steps for an entity.
Redisplay the association deleted from the class diagram
To redisplay the associations that you deleted from the class diagram or to display the associations that you added outside the class diagram, follow these steps from the class diagram.
Operation procedure
- Select the relevant entity in the class diagram and run Show Hidden Relationships from the context menu.