define metamodel
Overview
A metamodel is a definition of the structure and relationships of entities. By defining a metamodel, it is possible to formalize the content to be designed and the constraints to be considered at the time of design.
In the following, based on the 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
Regarding 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 increases. Therefore, it is useful to have a hierarchical structure that allows you to roughly classify the model types directly under the project.
In the following, we will define the metamodel to be a project with the following hierarchical structure. In this project example, [Requirement model] and [Design model] are set up directly under the project to roughly classify the model types.
Also, as the scope of the project increases, the number of metamodel components defined in the profile increases. Therefore, it is useful to create a package for each type of model and classify the components of the metamodel. This makes it easier to get a bird's-eye view of the overall structure of the metamodel.
In the following, we will define the meta model by providing the [Use Case Model] package as follows. In this example profile, a [Use Case Model] package is provided directly under the root of the profile to categorize the components of the metamodel.
Advance preparation
Understand screen configuration
When defining a metamodel, use the profile navigator on the left, the class diagram in the middle, and the inspector on the right.
To open a 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 [×] icon that appears in the upper right corner of the class diagram.
- Unlike the model editor, the class diagram display does not change even if the selected node changes by clicking on the tree node in the profile navigator.
- To view another class diagram, double-click the class diagram you want to view to open it.
Below, let's define a metamodel for the use case model with 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:
- Create a project for your new profile
- Configure the profile to add the Use Case Model entity
- Prepare a class diagram to define the [Use Case Model] meta model
1.1 Create a new project
Creating a project for a new profile
To create a project for a new profile, create a new project as follows:
- Launch Next Design and click the Start > Create New Project link from the Start Menu.
- In the [Create New Project] dialog, enter a [Project Name], do not specify a [Profile], and press the [Create] button to create a new project.
Switch to screen configuration for metamodel definition
Follow the steps below to switch to the screen configuration for metamodel definition explained in the preparation.
- Select Profile Navigator from the selector at the top of the navigator to switch navigators.
- Click View > Pane > Inspector on the ribbon to display the inspector on the right side of the screen.
1.2 Configure Profile
Add Entity Directly Under Project
In order to classify the model types directly under the project, add the [Requirement model] entity by the following procedure.
- Right-click [Sample Project Definition] displayed at the top of the profile navigator and select Click Add > Metamodel > Entity from the context menu.
- In the [New Entity] dialog, enter the items as shown in the table below and press the [OK] button.
item | value |
---|---|
[Display Name] | Enter "Requirement Model" as the name |
[Class Name] | (Auto-populates with the same name as the display name) |
[Icon] | Select an icon from the choices |
Definition changed so that it can be placed directly under the project
Entities that can be added directly under the project in the model navigator during modeling are limited to specific entities only. To enable the [Requirement model] added in the previous step to be added directly under the project, change the definition in the following steps.
- Select a Requirement Model in the profile navigator to view the details in the inspector.
- Check Allow deployment directly under the project in the inspector.
Create a package and add the [UseCaseModel] entity
To create a package within your profile and add the Use Case Model entity, follow these steps:
- Right-click [Sample Project Definition] displayed at the top of the profile navigator and select 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 press the [OK] button.
1.3 Prepare a class diagram that defines the metamodel
Add class diagram to [Use Case Model]
To define the Use Case Model metamodel in the form of a UML class diagram, add the class diagram as follows:
- Right-click the Use Case Models package on the profile navigator and select Click Add Class Diagram from the context menu.
- Enter [Use Case Model Structure Diagram] for 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 during modeling, it is necessary to connect the entities corresponding to the parent-child relationship with the ownership relationship.
To be able to add a Use Case Model under a Requirement Model when modeling, connect the Ownership relationship as follows:
- Double-click Use Case Model Structure Diagram to open the class diagram.
- Drag and drop Requirement Model and Use Case Model from the profile navigator to add them to the class diagram.
- To establish a relationship, move the pointer to the parent [Requirement model], drag the [▲] icon displayed in the four directions, and drop it on the [Use case model] to be related.
- When you drop it, a pop-up will appear with a selection of related types, click Embedded to select it from among them.
- This creates an ownership relationship from Requirement Model to Use Case Model, defining a parent-child relationship between Requirement Model and Use Case Model.
2. Define the structure of the use case model
To define the structure of the Use Case Model, add and associate Actor and Use Case entities to the class diagram. Here are the steps:
- Add Actor and Use case as entities.
- Add fields to the entity.
- Associate entities to define the structure of the Use Case Model.
2.1 Add Entities
To add an entity to your class diagram, follow these steps:
- Add an Entity by dragging and dropping it from the class toolbox and enter a name.
- Now add Actor and Use case as entities.
- 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 meta model, just like [Delete From Diagram] in the context menu. , also remains on the profile navigator.
- To delete an entity that was added by mistake, execute Delete From Model from the entity's context menu.
To change the icon of an added entity, do the following:
- Select the entity whose icon you want to change on the class diagram.
- Select an icon in the inspector.
2.2 Adding Fields to Entities
To add fields that hold data to your entity, follow these steps:
- Move the pointer over the entity in the class diagram.
- Click the + icon that appears to the far right of Filelds. Here, add a [Precondition] 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 press the [OK] button.
item | value |
---|---|
[Display Name] | Enter "precondition" as the name |
[Field Name] | (Auto-populates with the same name as the display name) |
[Data Type] | Select [String] from the choices |
2.3 Associate Entities to Define Structure
To allow an entity to be added as a child element of another entity, the owner relationship represents a parent-child relationship between the entities.
Also, like [Actor] and [Use case], in order to be able to relate entities that have relationships other than parent-child relationships, connect reference relationships between entities.
Here, we define the following two types of relationships as structural definitions of the [Use Case Model].
Relationship | Description |
---|---|
Ownership relationship from [Use Case Model] to [Actor] and [Use case] | [Actor] and [Use case] can now be added as children of [Use Case Model]. |
Reference association from [Actor] to [Use case] | It is now possible to associate [Actor] with [Use case]. |
- Move the pointer over the originating entity.
- Drag the [▲] icon displayed in four directions and drop it on the related entity.
- A pop-up will appear with a selection of relationship types, click to select.
- Similar to deleting an entity, if you select the relationship 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 meta model. , also remains on the profile navigator.
- To delete a relationship that was added by mistake, execute [Delete From Model] from the context menu of the relationship line.