Metamodel Mapping Properties

Metamodel mappings are mappings between metamodel objects, which control how objects are imported or generated. Metamodel mappings are sub-objects of the PowerDesigner metamodel object on which they are defined.

To open a metamodel mapping property sheet, select the mapping from the list at the top of the Mapping Editor Mappings pane or parent object property sheet Mapping tab and click the Properties tool.

The tabs available on a particular mapping property sheet depend on the objects being mapped. The General tab contains the following properties:

Property

Description

Source object Specifies the metamodel object being mapped to the target object.
Target object Specifies the metamodel object being mapped from the source object. This object is the parent of the mapping itself.
Transformation script [metaattribute mappings] Specifies a script to set the value of the attribute. In the following example, from an XML import, the notnullable attribute is imported to the Mandatory attribute and, because the sense of the attributes is reversed, the boolean value imported is set to the opposite of the source value:
Sub %Set%(obj, sourceValue)
   obj.SetAttribute "Mandatory", not sourceValue
End Sub
In the following example, from an object generation, the NumberID attribute is generated to the Comment attribute and a text string is prepended to make clear the origin of the value:
Function %AdjustValue%(sourceValue, sourceObject, targetObject)
   Dim targetValue
   targetValue = "The original process NumberID is " +cstr(sourceValue)
   %AdjustValue% = targetValue
End Function
The following tabs are also available for metaclass mappings:
  • Initialization - Specifies a script to initialize the metaclass to be created. In the following example, the value of the Stereotype attribute is set to SimpleType:
    Sub %Initialize%(obj)
       obj.Stereotype = "SimpleType"
    End Sub
  • Attribute Mappings - Lists the mappings of attributes under the metaclass. Select a mapping and click the Properties tool to open its property sheet. To control the order in which attributes are created, in order to respect dependencies between them, use the arrows at the bottom of the list.
  • Collection Mappings - Lists the mappings of collections under the metaclass.
  • Post-Process - Specifies a script to modify the metaclass after creation and execution of mappings. In the following example, the value of the Code attribute is copied to the Name attribute:
    Sub %PostProcess%(obj)
       ' Copy code into name
       obj.Name = obj.Code
    End Sub