Contents > 7 SDMetrics Metamodel and XMI Transformation Files > 7.2 XMI Transformation Files > 7.2.2 XMI Transformations and Triggers > 7.2.2.1 Trigger Type "attrval"

7.2.2.1 Trigger Type "attrval"

This trigger instructs SDMetrics to retrieve the value from an XMI attribute of the XMI element that represents the metamodel element. In our example, the "id" information is stored in the attribute "xmi.id" of the Foundation.Core.Operation element. We retrieve its value with the trigger
<trigger name="id" type="attrval" attr="xmi.id" />
The "attr" attribute of the trigger indicates the XML attribute we are interested in. In most cases, XML attributes only store single values. Exceptions are element references. For example, a partition ("swimlane") in an UML1.x activity graph may be serialized in XMI1.2 as follows:
<UML:Partition name="mySwimlane" xmi.id="xmi12" contents="xmi35 xmi61 xmi115" />
The XML attribute "contents" contains the XMI IDs of the states of the partition, separated by spaces. In the SDMetrics metamodel, the model element "partition" has a multi-valued attribute "contents" (see Appendix A.1 "Metamodel for UML 1.3/1.4"). With the trigger
<trigger name="contents" type="attrval" attr="contents" />
SDMetrics will extract each part of the XML attribute, and store it as separate value in the multi-valued SDMetrics metamodel attribute.