Contents > 7 SDMetrics Metamodel and XMI Transformation Files > 7.2 XMI Transformation Files > 7.2.2 XMI Transformations and Triggers

7.2.2 XMI Transformations and Triggers

To illustrate how to define XMI transformations and triggers, we consider again the example of "operation" metamodel elements in Section 7.1 "SDMetrics Metamodel". An operation model element has four attributes: an id, a name, a context (operation owner), and a visibility.

Below is the representation of an operation as expressed in an XMI 1.0 file. The places that contain information we are interested in are set in boldface:

                          <!-- 1. operation id  -->
                                     <!-- 2. operation name  -->
  <Foundation.Core.ModelElement.visibility xmi.value="public"/>
                                     <!-- 3. operation visibility  -->
  <Foundation.Core.ModelElement.isSpecification xmi.value="false"/>
  <Foundation.Core.Feature.ownerScope xmi.value="instance"/>
  <Foundation.Core.BehavioralFeature.isQuery xmi.value="false"/>
  <Foundation.Core.Operation.isAbstract xmi.value="false"/>
    <Foundation.Core.Classifier xmi.idref="xmi.1605"/>
                            <!-- 4. operation context  -->
The following XMI transformation describes how the required information is retrieved from an XMI 1.0 document:

<xmitransformation modelelement="operation"
                   xmipattern="Foundation.Core.Operation" recurse="true">
  <trigger name="id" type="attrval" attr="" />
  <trigger name="name" type="ctext" src="" />
  <trigger name="visibility" type="cattrval"
           src="Foundation.Core.ModelElement.visibility" attr="xmi.value"/>
  <trigger name="context" type="gcattrval"
           src="Foundation.Core.Feature.owner" attr="xmi.idref"/>
The XMI transformation is enclosed within the xmitransformation tags. The opening tag takes the following attributes: Each trigger in our transformation describes how to retrieve the information for one SDMetrics metamodel attribute. Each trigger has two required attributes: The meaning of the remaining attributes is dependent on the trigger type. We describe each trigger type in following. Trigger Type "attrval" Trigger Type "ctext" Trigger Type "cattrval" Trigger Type "gcattrval" Trigger Type "constant" Trigger Type "ignore" Trigger Type "xmi2assoc"