You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.

How to model a data mapping

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

Step 1: Create

Create a new data mapping in the Configuration module and specify which modules you want to map in the properties panel:

Step 2: Add a direct mapping rule

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

Step 3: Specify the source collection and target entity

After creating a new mapping rule, the source collection and target entity need to be specified:

  • Click on "Empty source collection" and enter an expression in terms of the source domain model that results in a set of instances, where for each instance a new instance in the target domain model has to be created.
    • Beware that you cannot refer to an active instance in the source collection that for example has just been activated in a flow before running the data mapping. So, either singletons or collections can be mapped.
  • Click on "Empty target entity" and select the target entity you want the set of instances to be mapped to. 

For example, if we want all instances of Client to be mapped to the target entity Person, this is modelled as follows:

Step 4: Optionally specify a precondition

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:

Step 5: Specify a match strategy

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 already an instance in the target domain model to represent the source instance;
  • 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:

Step 6: Specify the property mappings

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

IconDescription

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.  
Join mapping example

Let’s presume we have these source and target models: 

Source modelTarget model


In this case, the mapping would exist of 2 mapping rules:

  1. A join mapping rule to join ForeignAddress and NLAddress to Address
  2. A direct mapping rule to map Client to Person
Split mapping example

Let’s presume we have these source and target models: 

Source modelTarget model

In this case, the mapping would exist of 2 mapping rules:

  1. A split mapping rule to split Address to ForeignAddress and NLAddress
  2. A direct mapping rule to map Client to Person
Full mapping example

Let’s presume we have these source and target models: 

Source modelTarget model

In this case, the mapping would exist of 2 mapping rules:

  1. A full mapping rule to map ForeignAddress and NLAddress to InvoiceAddress and ResidentialAddress 
  2. A direct mapping rule to map Client to Person
  • No labels