Several different types of mappings are possible, covering a wide range of scenario's. In this chapter we’ll take a look at the different types.
Let’s presume we have these source and target models:
Source model
Target model
Create a new data mapping in the Configuration module and specify which modules you want to map in the properties panel:
After opening a mapping, click on the + icon below "Mapping Rules" to add a mapping rule. There are several types of mapping rules to choose from.
In this example, we'll use the simplest type of mapping rule: a direct mapping. We'll need two direct mapping rules: one to map client (source model) to person (target model) and one to map address (source model) to address (source model).
Learn more about the different mapping rule types and how they relate to Blueriq Studio here. |
After creating a new mapping rule, the source collection and target entity need to be specified:
For example, if we want all instances of Client to be mapped to the target entity Person, this is modelled as follows:
You can specify an expression in terms of the source domain model that serves as a precondition for carrying out this' instance mapping.
For example, if we only want all clients that are older than 18 to be mapped to Person, we use the following precondition:
You can specify match conditions to check if there is a matching instance. By default, the setting is: "By comparing instance identifiers". Each instance has a GUID that identifies it. By using this setting, the runtime checks whether an instance of that entity with the same GUID already exists in the target module, and if so that instance matches and is used for the mapping. When using "By comparing if properties are equals" or "By comparing if properties match by condition", an own matching rule can be created that compares values from the source instance to values from the target instance.
Next, specify what should happen if :
there is no instance in the target domain model yet representing the instance of the source model;
there are instances in the target model for which there are no matching instances in the source model.
A good example is if a person exists with the same Social Security Number:
Finally, it is time to map the attributes and relations from the source collection to the target entity. The attributes and relations that belong to the selected target entity are already prefilled. The data to be mapped to these attributes and relations is to be specified in the form of an expression. The active instance in this expression is the instance you have defined in your source collection (step 3).
Icon | Description |
---|---|
Select the precondition icon to specify a precondition. | |
Select the this icon to specify a justification to be mapped together with the attribute or relation. | |
Select the + icon to add one or more expression(s). This is often used in combination with preconditions. | |
Select the trash bin icon to clear the property mapping. |
Let’s presume we have these source and target models:
In this case, the mapping would exist of 2 mapping rules:
|
Let’s presume we have these source and target models:
In this case, the mapping would exist of 2 mapping rules:
|
Let’s presume we have these source and target models:
In this case, the mapping would exist of 2 mapping rules:
|