Contents > 7 SDMetrics Metamodel and XMI Transformation Files > 7.2 XMI Transformation Files > 7.2.2 XMI Transformations and Triggers > 7.2.2.3 Trigger Type "cattrval"
7.2.2.3 Trigger Type "cattrval"
This trigger retrieves the value from an XMI attribute of a child
element in the XMI tree.
In our example, the visibility information of the operation is stored
in the attribute "xmi.value" of the child element
"Foundation.Core.ModelElement.visibility". We retrieve its value with the
trigger
<trigger name="visibility" type="cattrval"
src="Foundation.Core.ModelElement.visibility" attr="xmi.value"/>
The "src" and "attr" attributes of the trigger specify the
element/attribute we are interested in.
We can also use this trigger for multi-valued attributes. For example,
a partition in a UML2 activity may be serialized in XMI2.0 as follows:
<group xmi:type='UML:ActivityPartition' name='mySwimlane' xmi:id='xmi12'>
<containedNode xmi:idref='xmi35'/>
<containedNode xmi:idref='xmi61'/>
<containedNode xmi:idref='xmi115'/>
</group>
In the SDMetrics metamodel for UML2, the model element "activitygroup"
that stores partitions has a multi-valued attribute "nodes" (see
Appendix A.2 "Metamodel for UML 2.x"). With the trigger
<trigger name="nodes" type="cattrval" src="containedNode"
attr="xmi:idref" />
SDMetrics will pick up each "containedNode" child XML element, and
store the values of their "xmi:idref" attributes in the multi-valued
SDMetrics metamodel attribute "nodes" of the activity partition.
Prev |
Up |
Next |
Section 7.2.2.2 "Trigger Type "ctext"" | Contents | Section 7.2.2.4 "Trigger Type "gcattrval"" |