Define metamodel
Overview
A metamodel defines the structure and relationships of an entity. By defining a metamodel, you can formalize what you need to design and the constraints that you should consider when designing.
In the following, the theme is a use case model consisting of actors and use cases. Here are the basic steps for creating a new profile and defining a metamodel.
Image of metamodel to define
About the overall structure of the metamodel
Since Next Design can handle various models related to the product in one project, the number of models in the project is large. Therefore, it is useful to have a hierarchical structure that allows you to roughly classify the types of models directly under the project.
In the following, we will define the metamodel so that the project has the following hierarchical structure. In this project example, [Requirement model] and [Design model] are provided directly under the project, and the types of models are roughly classified.
Also, expanding the scope of your project will increase the number of metamodel components defined in your profile. Therefore, it is useful to have a package for each model type to classify the components of the metamodel. This makes it easier to get a bird's eye view of the overall composition of the metamodel.
In the following, we will provide a Use Case Model package to define the metamodel as follows: In this profile example, the Use Case Model package is provided directly under the root of the profile to classify the components of the metamodel.
Advance preparation
Understand the screen configuration
When defining a metamodel, use the profile navigator on the left, the class diagram in the center, and the inspector on the right.
To open the class diagram in the center, double-click the class diagram you want to open in the Profile Navigator. To close the class diagram, click the x icon that appears in the upper right corner of the class diagram.
note
- Unlike the model editor, the display of the class diagram does not change even if the selected node is changed by clicking the tree node in the profile navigator.
- To view another class diagram, double-click to open the class diagram you want to view.
In the following, let's define a metamodel of the use case model in the following steps.
- Add use case model to profile
- Define the structure of the use case model
1. Add use case model to profile
To add a use case model metamodel to your profile, do the following:
- Create a project for a new profile
- Configure a profile to add a Use Case Model entity
- Prepare a class diagram to define the [Use Case Model] metamodel
1.1 Create a new project
Create a project for a new profile
To create a project for a new profile, follow the steps below to create a new project.
Operation procedure
- Launch Next Design and click the Start> Create New Project link from the Start Menu.
- In the [Create New Project] dialog, enter the [Project Name], do not specify the [Profile], and click the [Create] button to create a new project.
Switch to screen configuration for metamodel definition
To switch to the screen configuration for metamodel definition explained in the preparation, follow the procedure below.
Operation procedure
- Select Profile Navigator from the selector at the top of the navigator to switch between navigators.
- Click View> Pane> Inspector on the ribbon to display the Inspector on the right side of the screen.
1.2 Configure profile
Add the entity directly under the project
In order to roughly classify the model types directly under the project, add the [Request Model] entity in the following procedure.
Operation procedure
- Right-click [Project Definition Sample] displayed at the top of the profile navigator, and click Click Add> Metamodel> Entity from the context menu.
- In the [New Entity] dialog, enter the items as shown in the table below and click the [OK] button.
Item | Value |
---|---|
[Display Name] | Enter "Request Model" as the name |
[Class Name] | (The same name as the display name is automatically entered) |
[Icon] | Select an icon from the options |
Changed definition so that it can be placed directly under the project
Entity that can be added directly under the project in the model navigator at the time of modeling is limited to a specific entity. To be able to add the [Request Model] added in the previous step directly under the project, change the definition in the following step.
Operation procedure
- Select Request Model in the Profile Navigator to view the details in the Inspector.
- Check Allow deployment directly under the project in the Inspector.
Provide a package and add a [Use Case Model] entity
To create a package in your profile and add a Use Case Model entity, do the following:
Operation procedure
- Right-click [Project Definition Sample] displayed at the top of the profile navigator, and click Click Add> Package from the context menu.
- Right-click the added package, click Rename from the context menu, and rename it to Use Case Model.
- Next, click [Add]> [Metamodel]> [Entity] from the context menu of the package.
- In the [New Entity] dialog, enter [Use Case Model] in [Display Name], select [Icon], and click the [OK] button.
1.3 Prepare a class diagram that defines the metamodel
Added class diagram to [Use Case Model]
To define the Use Case Model metamodel in UML class diagram format, add a class diagram as follows:
Operation procedure
- Right-click the Use Case Model package on the Profile Navigator and click Click Add Class Diagram from the context menu.
- Enter Use Case Model Structural Diagram as the name of the class diagram added on the profile navigator.
Configure parent-child relationship for [use case model]
In order to create a model hierarchically at the time of modeling, it is necessary to connect the entities that correspond to the parent-child relationship in the ownership relationship.
To be able to add a Use Case Model under Request Model when modeling, follow these steps to establish an ownership relationship.
Operation procedure
- Double-click Use Case Model Structure Diagram to open the class diagram.
- Drag and drop the Request Model and Use Case Model from the Profile Navigator to add them to the class diagram.
- To make an association, move the pointer to the parent Request Model, drag the โฒ icon that appears in its four directions, and drop it on the Use Case Model that you want to associate.
- When you drop it, a related type of choice will pop up, and you can select it by clicking Embedded.
- This establishes an ownership relationship from the Request Model to the Use Case Model and defines a parent-child relationship between the Request Model and the Use Case Model.
2. Define the structure of the use case model
To define the structure of the Use Case Model, add and associate the Actor and Use case entities in the class diagram. The procedure is as follows.
- Add Actor and Use case as entities.
- Add a field to the entity.
- Associate the entities to define the structure of the Use Case Model.
2.1 Add entity
To add an entity to your class diagram, do the following:
Operation procedure
- Drag and drop [Entity] from the Class Toolbox to add it and enter a name.
- Here, add [Actor] and [Use case] as entities.
Attention
- If you select an entity and press the delete key, it will only be hidden on the class diagram and will not be deleted from the metamodel, similar to the [Delete From Diagram] in the context menu. , It also remains on the profile navigator.
- If you want to delete an entity that you added by mistake, execute [Delete Model] from the context menu of the entity.
To change the icon of the added entity, follow these steps:
Operation procedure
- Select the entity whose icon you want to change in the class diagram.
- Select the icon in the Inspector.
2.2 Add field to entity
To add a field to hold data in an entity, do the following:
Operation procedure
- Move the pointer over the entity in the class diagram.
- Click the + icon that appears at the far right of Filelds. Here, add the Preconditions field (string type) to the Use case entity as follows:
- In the [Add New Fields] dialog, enter the items as shown in the table below and click the [OK] button.
Item | Value |
---|---|
[Display Name] | Enter "Precondition" as the name |
[Field Name] | (The same name as the display name is automatically entered) |
[Data Type] | Select [String] from the choices |
2.3 Associate entities to define structure
To be able to add another entity as a child element that makes up one entity, make an ownership relationship that represents the parent-child relationship between the entities.
Also, to be able to associate entities with relationships other than parent-child relationships, such as Actor and Use case, connect reference associations between the entities.
Here, the following two types of associations are defined as the structural definition of [Use Case Model].
Relationship | Description |
---|---|
Ownership related from [Use Case Model] to [Actor] and [Use case] | You can now add [Actor] and [Use case] to the children of [Use Case Model]. |
Reference association from [Actor] to [Use case] | You can now associate [Actor] with [Use case]. |
Operation procedure
- Move the pointer over the entity from which it is related.
- Drag the [โฒ] icon that appears in four directions and drop it on the related entity.
- A related type of choice will pop up, click to select.
Attention
- Similar to deleting an entity, if you select a related line on the class diagram and press the delete key, it will only be hidden on the class diagram and will not be deleted from the metamodel. , It also remains on the profile navigator.
- If you want to delete an accidentally added association, run Delete From Model from the context menu of the association line.