In this section we give an overview of how models created in the i-refactory modeller can be checked to find errors.
PowerDesigner has a very important feature called model check
, this examines your changes in the model and will warn (and sometimes autocorrect) you for inconsistency and mistakes.
There are many default checks available. These checks are documented on the SybooksOnline pages.
As part of the i-refactory, additional checks are included; you can recognize these rules because the name starts with i-refact.
You can check your model in any of the following ways:
F4
in a modelTools > Check Model
Check Model
from the contextual menuAfter you start the Model Check, a result list is displayed. It is required that reported errors are resolved and that warnings are carefully checked.
The i-refactory Model Checks contain a description that is shown after you press Help
when you right-click on the error.
{info} SQL code and regular expressions in your model - for example in Business Rule Helpers or Attribute Value Constraints - are not checked. Any syntax errors there will result in an error in the Runtime environment. For example, during metadata import or during data consumption.
It's possible to automatically correct a limited number of warnings and errors, but you always have to understand why it warns you before you apply the autocorrect function.
You can apply a correction by right-clicking on the warning or error and selecting the Automatic correction
option.
Most warnings and errors require manual intervention.
You can apply a manual correction by right-clicking on the warning or error and selecting the Correct
option.
Here are some examples of model checks warnings and errors that you can encounter when you run model checks on your model:
Check | Applies to | Purpose | Action to fix |
---|---|---|---|
Existence of collation | Column | Check if a collation is set for a column. Instead of specifying a collation, set the column to a datatype which supports Unicode (nvarchar). | The automatic correction option removes the collation but does not change the datatype. |
Timeline column should always have a timeline type / kind | Column | This check identifies timeline columns, where the timeline type/kind is empty. | For any model other than a GDAL model check, the timeline type error is connected to the column. For a GDAL model, check the mapping from the CFM. |
Column mapping is not allowed to a computed column | Column mapping | Checks if a mapping is created to a computed column and returns an error if one exists. | Either remove the mapping or execute the automatic correction option. If the automatic correction option is chosen, the column is set to a normal column. |
Existence of multiple mappings with the same source-target tables | Entity mappings | Check if multiple mappings exists between the same source and target entity. | Manual remove one or more duplicate mappings. |
Architecture layer not allowed to be empty/null | Model | Checks if the architecture layer code of a model is set. | Set to proper value manually if empty. |
Source or target tables used in mappings cannot be found | Model not open | If a model contains mappings, this check ensures that the models referenced in the mappings are opened. Otherwise exporting the metadata does not contain the proper mapping information. | Open the relevant models. |
Owner should not be empty | Owner/schema | Each table in a model should have an owner. | Manually set the owner for those objects listed in the check. |
Reference code uniqueness | Reference | Checks if the code of the reference is unique. | Change the code of the reference manually. |
Reference name uniqueness | Reference | Checks if the name of the reference is unique. | Change the name of the reference manually. |
Role name in collection is unique if duplicate parent reference exists | Reference | If two or more relations of the same type exist between 2 entities, then a parent role should be entered for these relationships. Otherwise they cannot be distinguished. | Manually correct the relationship and add a parent role. |
Check | Applies to | Purpose | Action to fix |
---|---|---|---|
Columns in BK of subtyped Hub should be of the same type as columns in BK of supertype Hub | BK key | Checks if the columns in the business key of the subtyped hub are of the same datatype as columns in the business key of supertype hub. | Correct the datatype. |
Hub business key must contain one or more columns | BK key | This check ensures that the hub, has at least one business key column. | Add at least one business key column. |
Columns in the natural key are incorrect | BK key / Link key | The check ensures that columns in a hub or link have the proper stereotype and that columns that have the proper stereotype are all in the "natural key" of the hub/link. | Use the autocorrect option. Columns may be removed from the anchor or added to the natural key. |
Business Rule Helper does not have a Primary Key | Business Rule Helper | This check ensures that a Business Rule Helper object has a primary key. | Add a primary key to the business rule helper. |
Not all columns are stereotyped in the Business Rule Helper Entity | Business Rule Helper columns | This check ensures that all columns in the business rule helper entity have a stereotype. | Use the autocorrect option. Or manually update the columns to the correct stereotype. |
Column should have a mapping | Column | Columns in the model should be mapped. | Add a mapping. |
Structural Feature should have a stereotype | Column | Each column in the model should have a stereotype. | Autocorrect is available for context tables. Columns in these table types will be set to Satellite Column if empty. |
Satellites and foreign key links should be mapped from one source entity only | Context tables (satellites, foreign key links) | Context tables (satellites and foreign key links) should have only one source table mapped. Mapping more than one source table to a context table will result in loss of data. | Remove one or more mappings. |
Satellites and foreign key links should have exactly one driving relationship | Context tables (satellites, foreign key links) | This check ensures that satellites and foreign key links have exactly one driving relationship. | Remove the incorrect relationship. |
If the column has a mapping then at least all source key columns should be mapped | DVSurrogateKey columns in context tables | If a mapping exists from a source then at least all key columns of this source should be mapped. | Add the missing mappings. |
Foreign key link should have at least one reference to an anchor | Foreign key link | This check ensures that an FK Link has at least one non driving reference to an anchor. | Add a non driving reference to a anchor. |
Foreign key links has at least two outgoing references | Foreign key link | This check ensures that foreign key links have two or more references to other tables. | Add an additional reference. |
A hub should have one or more business keys as part of the alternate key | Hub / Link | This check ensures that a hub has one or more business keys as part of the alternate key. | Add a business key. |
If a satellite or foreign key link is related to the anchor then at least a unitemporal single active satellite or foreign key link should be related to the anchor as well | Hub / Link | Make sure the anchor (hub or link) at least has a relation to a unitemporal/single active satellite or foreign key link as well. Otherwise the existence flag on the anchor will not be properly set to true/false. | Add a satellite or foreign key link to the hub or link. |
No mastermapping present | Hub / Link | No mastermapping is found on the anchor. A mapping is a mastermapping if and only if the primary key columns of a source table are fully mapped to the business key columns of an anchor and this same source table is fully mapped to the surrogate key of a unitemporal/single active satellite or foreign key link. | Map the primary key columns in the source table to the business key columns in the hub or link. |
No satellite or foreign key link connected to the anchor | Hub / Link | This check warns for the fact that a anchor doesn't have a satellite or foreign key link connected to it. | Add a satellite or foreign key link to the hub or link. |
Subtype should have at least one subtype reference | Hub / Link | A subtype should have at least one subtype reference / relationship. | Add a subtype reference/relationship |
Too many mastermappings present | Hub / Link | More than one mastermapping is found on the anchor. A mapping is a mastermapping if and only if the primary key columns of a source table are fully mapped to the business key column of an anchor and this same source table is fully mapped to the surrogate key of a unitemporal/single active satellite or foreign key link. | Remove the mastermapping and apply it correctly. |
BK of subtyped Hub should have the same number of columns as BK of supertype Hub | Key | Business key of subtyped Hub should have the same number of columns as the business key of supertype Hub. | Remove and create the subtype again |
The key of a satellite must contain start_date and all non templated columns | Key | This check ensures that the alternative key of an Alternative Key satellite contains start_date and all non templated columns. | Use the autocorrect option. Or remove and create the alternative key satellite again. |
Index for Primary or Alternate Key is not as expected | Key related indexes | This check ensures that the Primary and Alternate Key index have the correct column list and are named as their counterpart key. | Use the autocorrect option. |
Key Root is not allowed to have any context | Key root anchor | This check ensures that a Key Root does not have any context. | Remove the context attributes in the Key Root. |
Key Root Link should be connected to other key-roots | Key Root Link | A key root link is only allowed to contain references to other key roots. | Add a reference to an other key root to the key root link |
Link key (LK) should contain at least two columns | Link | This check ensures that the link has a natural key that consists of at least two column, either 2 foreign keys or a foreign key and an attribute. | Add another reference or a column to the link. |
Source and target columns should have a comparable datatype | Mapped columns | Datatypes of source and target should be equal. | Manually synchronize the datatype (either of source or target). |
Non key attributes from source table are mapped to the natural key of a hub or link | Mapped DVLinkReferenceColumn, DVLinkKeyColumn and BusinessKeyColumn columns in a hub or link | Mappings from non key source attributes to a Hub or Link are suspect. They are although not necessarily wrong when used as integrity mappings. | Correct the mapping. |
Surrogate key column of a hub or link should not be mapped | Mapped DVSurrogateKey columns of a hub or link | It is not allowed to map to these columns. | Use the autocorrect option. The mapping will be removed. |
Metadata columns should not be mapped | Mapped MetadataColumns | These columns should not be mapped to from a historical staging model. | Use the autocorrect option. The mapping will be removed. |
Only one source table is allowed to map to both an anchor and a context table (satellite or foreign key link) | Mapping | Make sure only one source table is mapped to both an anchor and a satellite/foreign key link. The satellite or foreign key link should be a unitemporal/single active satellite/foreign key link. Other source tables may only be mapped to either the anchor (integrity mapping) or the satellites or foreign key links but not to both. With this check we assure that only one master mapping exists for an anchor. | Correct the mapping. |
Natural key subtype reference generated flag set to true | Natural key subtype references | Checks if the generate flag of the reference is set to false (enforcement of this relationship as a referential foreign key constraint is not required/desired). | Use the autocorrect option. |
Natural key subtype reference join incorrect, replicated columns differ from joined columns | Natural key subtype references | This check ensures that the natural join is complete with respect to the replication and joined columns. A column is replicated from the root. So the replicated column in the child should have the same source in the root as should the parent column. | Use the autocorrect option. |
Reference name or code incorrect | Reference code and name | Set the name and code of a reference to the correct value. | Use the autocorrect option. |
Link object should have a stereotype | References | A link object like a reference should have a stereotype. | Manually correct (remove the object and recreate). |
Reference join uses the wrong column in the child-table | References of a link | This check ensures that the join columns of a reference in a link only use columns classified as DVLinkReferenceColumns. | Manually correct. Either repair the join conditions or remove the reference and the column from the link and create a new reference. |
Satellite Block should contain at least one satellite column | Satellite columns | A satellite normally should have a column with stereotype SatelliteColumn. It is although possible that no context is available and the satellite is only use for tracking the existence of an anchor. | |
Satellite column should never be mandatory | Satellite columns | These columns should never be set to mandatory. | Use the autocorrect option. The mandatory property will be set to false. |
Virtual subtype is not supported | Subtype anchors | This check ensures that a subtype is not virtual / non persistent. | Manually correct the error. |
References from all links that are part of a subtype hierarchy should refer to the same hierarchy at all levels | Subtype links | This check ensures that references from all links in a sub / supertype hierarchy point to the same hubs / links (or their sub / supertypes) across a subtype hierarchy. | Manually correct the error. |
Subtype Reference incorrect - check script output window | Subtype references | This check ensures that the subtype reference is correct according to the business rules defined for modelling subtypes including their references. See the script output window for more details. | Manually correct the error. |
Subtype Reference should have a matching natural key reference and vice versa | Subtype references | This check ensures that a natural key reference and a normal reference exist for a subtype relationship. | Use the autocorrect option. |
Table with non-unique code | Table | This check ensures that all tables in the model have a unique code. | Manually correct the error. |
Classifier should have a stereotype | Tables, Views | All tables, views and other named classifiers should have a stereotype when modelling an UAM model. | Manually correct (remove the object and recreate). |
Timeline transaction columns should not be mapped | Transaction timeline columns | Not allowed to map to these columns. | Manually remove the mappings. |
After you've checked the physical data models, you can deploy the data models.