Narrowing down the models that can be associated
By defining reference relationships between entities in the metamodel, you can specify the type of model (metamodel class) that can be associated as the reference destination.
In that case, when you try to add a referenced model, all models in the project are narrowed down to candidates that can be associated based on the model type and displayed in a list.
Conversely, you can apply constraints to narrow down the candidates that can be associated from a specific range of models.
For example, let's consider the following metamodel structure.
-
Subsystems and components own functions. ... (2) and (4) in the figure
-
Modules use functions. ... (5) in the figure
According to this metamodel structure, the candidates for functions available to modules are both subsystem functions and component functions.
In contrast, suppose there is a design constraint that modules can only use subsystem functions ((2) in the figure) and cannot use component functions ((4) in the figure).
In Next Design, such constraints can be applied to reference relationships ((5) in the diagram).
To apply constraints to reference relationships, add the constraint to the reference relationship defined in the metamodel. In the constraint, specify the path from the referencing entity to the referenced entity that can be associated based on the metamodel structure (hereinafter referred to as a path constraint). In the above example, the path (1)-(2) in the diagram starting from the referencing module to the referenced function is specified as follows:
$Parent.PublicFunction
After applying a path constraint, verify that the path constraint works correctly and check whether there are any violations of the path constraint in the project. This allows you to detect and address any violations of the constraint even if you add a path constraint to an existing project later or change the path constraint.
Below, we will explain path constraints for reference relationships between entities in the following order.
- Add/Modify Path Constraints
- Edit Model According to Path Constraints
- Validate Path Constraints
Add/Modify Path Constraints
To add a path constraint to a reference relationship between entities or to modify an added path constraint, follow the steps below.
- Select the entity that holds the field to which you want to add a path constraint using one of the following methods.
- Display the class diagram containing the entity in the Profile Navigator and select the entity.
- Select the entity in the Profile Navigator tree.
- Click [View] > [Pane] > [Inspector] from the ribbon to display the Inspector on the right, and scroll down to display the [Constraints] list.
- To add a path constraint, click the [+] button at the bottom right of the [Constraints] list.
- Set the following items in the [Add Feature Relation] dialog.
- Enter the name of the constraint in [Display Name] and [Name].
- Select [Path Constraint] in [Change Shape Type].
- Select [Reference to Utilization Function (Reference to Utilization Function)] in [Target Field].
- Enter the path to allow the association in [Path] according to the path constraint notation.
- When you press the [OK] button in the dialog, the path constraint will be added.
- To change the path constraint you added, move the pointer over the constraint displayed in the [Constraints] list in the Inspector and click the edit icon.
- Change the settings in the [Constraint setting] dialog and press the [OK] button.
- Even if you add or change a path constraint, the existing model will be maintained as it is.
- To check whether an existing model satisfies the path constraints, perform an error check according to "Verifying Path Constraints" described below.
Path constraint notation
The format and elements of a path constraint are as follows.
Format: \{path element\}.\{path element\}.・・・;\{path element\}.\{path element\}.・・・
{path element} | Description |
---|---|
$Parent | Parent entity |
Field Name | Field name that corresponds to the path to the related destination |
Special symbol | Description |
---|---|
. (period) | Symbol that connects path elements |
; (semicolon) | Delimiter for listing multiple path constraints in parallel with or conditions |
Edit model according to path constraint
When a path constraint has been added, if you try to associate it with a model that does not satisfy the path constraint in the ER diagram, an error will be displayed and you will not be able to associate it.
Then, when you try to add a reference model in a form, etc., only the model candidates that satisfy the path constraint are displayed in a list.
Verify path constraints
To check for violations of path constraints in your project, follow the steps below.
- Click [Home] > [Model] > [Check Error] on the ribbon, and if there are any violations of the path constraints, they will be displayed in the error list.
- To jump to the error, double-click the error displayed in the error list.
- To clear the error list, do one of the following:
- From the ribbon, click [Home] > [Model] > [Check Error], and then click [Clear Error].
- Click the [Clear Error Contents] button on the error list toolbar.