Create a model
A logical model refers to a structured representation of how data entities, attributes, relationships, and business rules are defined and organized within an organization. It serves as a blueprint that outlines the structure and behavior of data elements across the enterprise.
The Semarchy extension for VS Code allows you to design and manage data models efficiently. This page walks you through the process of creating a model file within your workspace.
| All configuration options available for an object in the Application Builder are mirrored and accessible within the Semarchy extension for VS Code. For detailed information on logical models and all properties related to this type of object, see Introduction to logical modeling. |
Create a model file
A model is the first object you should add to your MDM project. Before you start, make sure you have created your Semarchy workspace in VS Code and familiarized yourself with our recommended best practices for setting up an MDM project in this environment.
| Each workspace in VS Code should be dedicated to a single model. |
To create a model file, follow these steps:
-
From the Activity Bar, access the Explorer view.
-
Right-click on your workspace folder.
-
From the context menu, choose New File.
-
Enter a name for the new model file.
It is recommended to include both the object name and type in the file name.Make sure to include the file extension (e.g., <ModelName>.Model.yml). -
Press Enter.
The newly created model file is added at the root of your workspace.
Design the model
Define the object and mandatory properties
After creating your model file, proceed to define the object and its mandatory properties:
-
Double-click on the newly created model file in the Explorer view to open it in the editor.
-
Add
_type:and enterModel.You can use the IntelliSense feature by pressing Control+Space to view a list of suggestions immediately after creating a new file. -
Press Control+S (or Command+S on macOS) to save your file.
Saving at this stage allows for IntelliSense to suggest snippets if activated. -
Add
name:and enter your model’s name, preferably in PascalCase for consistency.Alternatively, you can activate IntelliSense again to generate a snippet for this object type. Selecting the Model snippet will populate your file with the
namemandatory property.
Define optional properties
Optionally, you can define additional properties for your model, as required by your project specifications. To do so:
-
Activate IntelliSense to view a comprehensive list of available properties.
IntelliSense dynamically updates the list of suggestions as you type, prioritizing relevant options and excluding properties already defined in the file, unless multiple identical properties are allowed for a specific object. -
Select a property from the suggestions to insert it or its corresponding snippet into the design file.
-
(Optional) Repeat this process as needed to complete the structure of your model.
Validate the model
Review the design file
To ensure that the model you are designing in VS Code is error-free, follow these best practices:
-
Double-check the file structure and properties to ensure they accurately reflect your intended data model.
VS Code provides features to help you avoid errors in your files:
-
Syntax highlighting: enable syntax highlighting for YAML to spot syntax errors quickly.
-
Error markers: red squiggly lines appear under problematic sections. Hover over them to see detailed error messages.
-
-
Use the Semarchy extension’s validation features to verify the file. Any error found is listed in the Problems view of the Panel.
Clicking on an issue in the Problems panel navigates your cursor to the corresponding location in the file where the issue was detected.
Build the model
You can build your model locally to validate the syntax and structure of your file and test the functionality and behavior of your model. To do so, use any of the following options:
-
Semarchy extension’s toolbar
-
In the Activity Bar, select
Semarchy to open the extension’s toolbar. -
Click the Build button.
-
or
-
Command Palette
-
Open the Command Palette.
-
Type and select Semarchy: Build Data Management Model.
-
or
-
-
Open the Terminal view.
-
Use the following command to build a specific model:
-
semarchy dm model build [--workspace <workspace_directory>]
Replace <workspace_directory> with the full path of your model’s root folder.
|
Regardless of the method chosen, the Output panel shows the model validation results and any potential errors.
Once the model has been locally built without any errors, it is ready for deployment.