Creating a Data Model Project
To create a new Data Model Project:
- In the X4 Designer, right-click in the Projects view and choose New from the context menu.
Select Data Model Project.
Alternatively, you can click on New in the File menu and select Data Model Project.Enter a name for your project in the Project Creation Wizard dialog.
- Select Finish.
Data Model Projects have a predefined folder structure which is automatically created when you create a new Data Model Project.
Entities | This folder is empty when creating a project. You can add 1 to n entities.
|
<Project>.datamodel | Project-related file containing the data model definition. You set the relationships between the entities created by you in this file. All relationships you set here result in a hierarchy. For information on creating entities, see the Creating Entities section. |
Setting entity relationships in the Design view
You can set relationships between entities using the graphical editor in the .datamodel file. To open the editor, select the Design tab at the bottom of the Entity Relationships window.
To set entity relationships in the Design view:
Select Add to add a new entity relationship.
Select the desired values for the From Entity, the To Entity, and the Cardinality from the drop-down lists.
The From Entity and To Entity drop-down lists contain all entities that are available in your project. When you create or delete entities in your project, the values in both drop-down lists are refreshed automatically. You do not have to close and re-open the editor to refresh the values.
In the Cardinality drop-down list, you can choose between OneToOne, OneToMany, and ManyToOne.In the Relation Property field, specify the desired property for the relationship between the entities. This field is a free text field.
As an example, a structure of entity relationships may look like shown here:

Note
Note the following when setting the entity relationships:
- The values for From Entity and To Entity must not be identical.
- The combination of From Entity, To Entity, and Relation Property must be unique. It is not allowed to create duplicate relationships.
If you use the same combination of source entity and target entity, you must specify a different relationship property in the Relation Property field for each entity pair.
If you set an incorrect relationship, an error message is displayed and you cannot save your data model.
Setting entity relationships in the Source view
When creating a new Data Model Project, the <Project>.datamodel file in the XML view that is opened from the Source tab at the bottom of the Entity Relationships window looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<DataModel xmlns="http://softproject.de/datamodel/1.0">
<EntityRelationships>
</EntityRelationships>
</DataModel>
The EntityRelationships element is used to set the relationships between the entities created by you which are represented in the data model. Any relationship you specify will result in a hierarchy. For more information on creating entities, see the Creating entities section.
The EntityRelationships element can contain the following elements:
OneToOneOneToManyManytoOne
These three elements provide of the following attributes for the definition of the relationships between the entities:
| Attribute | Description |
|---|---|
entity | You can use this attribute to specify the from entity of the relationship. |
toEntity | You can use this attribute to specify the target entity of the relationship. |
property | You can use this attribute to specify the name which is used to reference the entity specified in You can, for example, specify a delivery address as the |
Example:
<DataModel xmlns="http://softproject.de/datamodel/1.0">
<EntityRelationships>
<OneToOne entity="Customer.entity" toEntity="Address.entity" property="DeliveryAddress"/>
<OneToMany entity="Customer.entity" toEntity="Order.entity" property="Order"/>
<ManyToOne entity="Order.entity" toEntity="Customer.entity" property="Customer"/>
</EntityRelationships>
</DataModel>