Skip to main content
Skip table of contents

Creating a Data Model Project

When creating a new Data Model project, you proceed as follows:

  1. In the X4 Designer, right-click in the Projects view and choose New from the context menu. 
  2. Select Data Model Project.

    Alternatively, you can click on New in the File menu and select Data Model Project.
  3. Enter a name for your project in the Project Creation Wizard dialog.

  4. 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.

(info) The Entities folder cannot be deleted, moved, or renamed.

<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.

How to set entity relationships in the Design view:

  1. Select Add to add a new entity relationship.

  2. 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.

  3. 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:

CODE
<?xml version="1.0" encoding="UTF-8"?>
<DataModel xmlns="http://softproject.de/datamodel/1.0">
	<EntityRelationships>
	</EntityRelationships>
</DataModel>

The EntityRelationships element can contain the following elements:

  • OneToOne
  • OneToMany
  • ManytoOne

These three elements provide of the following attributes for the definition of the relationships between the entities:

AttributeDescription
entityYou can use this attribute to specify the from entity of the relationship.
toEntityYou 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 toEntity for  the entity with respect to the further usage of the data model.

You can, for example, specify a delivery address as the property for a one-to-one relationship between a customer and an address, as shown in the following example.


Example:

CODE
<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>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.