In this section you can find how to generate a logical validation model (LVM) from a Logical Data Model (LDM), when a LDM is available. This speeds up your work and ensures you use the exact definitions as specified in the LDM. Another advantage is having lineage on all physical data models. For example, if you alter an attribute in one model, you can evaluate the impact of this change. In another section we explain how to create a logical validation model from scratch.
At any moment, you can perform a model check to verify if there are errors in the model.
When you update a LDM, you can also update a logical validation model that is already linked to it.
Before generating the logical validation model, make sure that the LDM has the following requirements:
To generate a logical validation model from a LDM:
Create an empty logical validation model from a template or open an existing empty logical validation model.
Open the LDM from which you want to generate a logical validation model.
In the tab General
, select Update Existing Physical Data Model
.
Select the option Preserve modifications
. This ensures that the adjustments to the logical validation model will not be overwritten by the LDM, but are preserved.
If there is no Physical Data Model next to Select model
, you can select the logical validation model. Click on the button with ...
.
Go to the tab Detail
.
Go to the tab Selection
.
You can choose which entities you want to add. Tick the check box next to the entities you want to add.
Press OK.
The Merge Model
window appears. In this window, you can configure how the two models are merged.
The root model is displayed at the top of the window (1
). In the example above, this is the physical data model, called Logical Validation Model
.
The properties of the models to be merged are displayed at the bottom half of the window:
2
): name of the settings3
): details of the LDM4
): details of the physical data modelThere are also several icons:
{info} Visit the PowerDesigner online manual for more information about the Merge Action Icons.
In the Merge Model
window, unselect the following options:
Architecture Layer
: The architecture layer HSTGIN-Logical Staging Layer
of the logical validation model must be kept.Default Valid Time Type
: The settings of the logical validation model must be kept.Internal Staging Template Table
: The settings of the logical validation model must be keptWhen you create an empty logical validation model, the standard version is 1.0.0. Select the box next to Version
if you want to import the Version
value of the LDM to the logical validation model.
Unselect Timeline types
. Otherwise, these timeline types will be deleted in the logical validation model.
After having carefully checked the options, click on OK
.
In the logical validation model a new diagram appears. This new diagram has the same name as the diagram in the LDM. You can rename the diagram.
To solve the classification property error, save the logical validation model, close it en reopen it again.
{warning} Be very careful in the Merge Model settings. Especially when updating an existing logical validation model. PowerDesigner will automatically select several options from the configuration of how the two models will be merged. Carefully check the settings. Otherwise these settings will overwrite the i-refactory settings in the logical validation model, which will lead to errors. Fortunately, PowerDesigner will not delete objects by default.
After you have generated the logical validation model from the LDM, a relation is established between the two models.
This means that if you change some properties in the LDM, you can use the option Impact and Lineage Analysis...
to check which entities and which models will be affected by the change. You can also check which models are linked to the LDM.
After the automatic generation of the logical validation model, there are some extra settings or steps that you need to follow. You do this to make sure that the logical validation model is in accordance with the logical data model and to avoid errors during the runtime process.
The automated generation of the logical validation model requires a post-processing before you can continue.
The datatypes in the LDM are different from the datatypes in a physical data model, such as the logical validation model. For example, a datetime
in a LDM needs to be changed to a datetime2
datatype in the logical validation model, because the datatype in the SQL Server database needs to be more precise than in the LDM.
{tip} To update the datatypes of multiple attributes at the same time, you can use the option show the properties of all attributes in the model.
{example} You can see the differences in datatypes between attributes of the entity Order in the LDM and the entity Order in the LVM.
Integer
is correctly changed toint
Variable characters (64)
is correctly changed tovarchar(64)
Decimal(18,2)
is correctly changed todecimal(18,2)
However, there are some datatypes that require your attention:
- Date: dates should be changed to the datatype
Date
.- Date & Time:
Date & Time
should be changed todatetime2
. Make a conscious choice about what precision you need. Precision 0 (zero) means it includes seconds. With precision 7 it includes nanoseconds. For valid time, you need to select the datatypedatetime2(7)
.- Variable characters: make sure to check if the datatype has to be
varchar(%n)
ornvarchar(%n)
.
When the LDM contains subtype/supertype patterns or generalization patterns, you are required to do extra configuration to determine what entities should be generated in the logical validation model. In the logical validation model, both patterns can be captured using a supertype/subtype relationship.
To create a supertype/subtype relationship in the logical validation model, you have two options:
In this case a subtype is implemented in the logical validation model as an entity with a zero-to-one relationship to the supertype entity. To generate the subtypes as separate tables, you need to:
Generate Children
and Generate Parent
in the Inheritance Properties
of the LDM.
In the logical validation model it is possible to define subtype-supertype pattern as
Complete
and/orMutual Exclusive
.
Complete
pattern: all instances in the supertype can be found in the related subtypes. For example, a provider offers TV, internet, and phone plans, there are no other type of plans. A customer can choose to get a TV and internet plan, without a phone.Mutually exclusive
pattern: one instance in the supertype can be found in none or just one Subtype. For example, a person can either be male or female.Mutually exclusive and complete
pattern: one instance in the supertype must be found in just one subtype. For example, a customer must either be a (natural) person or a company, there are no other types of customer available.These patterns are not automatically implemented in the logical validation model or generated as metadata by i-refactory. To account for these patterns, you need to add set constraints to the logical validation model.
{warning} Depending on the type of subtype-supertype pattern (for example, mutually exclusive), the cardinality of the relationship between a subtype and supertype might not be correct. You need to adjust it accordingly.
To create a rollup table containing all the attributes of the subtypes, you need to:
Generate Parent
in the Inheritance Properties
.
When the logical validation model uses valid times these columns require special attention in order to be correctly used in the runtime process. For each column that is treated as valid time you need to adjust settings for valid times.
You can also add constraints to the logical validation model to reflect the business requirements and to validate the data.
If you've already linked the LDM to the logical validation model, you can merge the models again after making changes in the LDM. You need to be very careful in the Merge Model
window and analyse every option.
If you add an attribute, entity or business rule to the LDM, or delete an object from the LDM, the procedure is almost the same as generating a new logical validation model.
Tools > Generate Physical Data Model
.Update existing Physical Data Model
. The linked logical validation model is already selected.
OK
.The window Merge Models
appears.
Architecture Layer
. The architecture layer [HSTGIN]-Logical Staging Layer
of the logical validation model must be kept.Default Valid Time Type
. The settings of the logical validation model must be kept.Internal Staging Template Table
. The settings of the logical validation model must be kept.{warning} Shortcuts to tables in the
Merge Models
window represent mappings to the technical model. Don't delete these mappings.