Contents > 7 SDMetrics Metamodel and XMI Transformation Files > 7.2 XMI Transformation Files > 7.2.3 Tips on Writing XMI Transformations > The "linkbackattr" Trigger Attribute The "linkbackattr" Trigger Attribute

Whenever a cross-reference is established from a model element e1 to a model element e2 via a cross-reference attribute, you can optionally store a cross-reference back from e2 to e1.

If we take again the example of states in UML1.x activity partitions, we could add a cross-reference attribute "inPartition" to metamodel element "state", and populate that attribute with information in which partition a state lies as follows:

<xmitransformation modelelement="activitygraph" xmipattern="UML:ActivityGraph">
<trigger name="contents" type="attrval" attr="contents"
<trigger name="contents" type="gcattrval" src="UML:Partition.contents" 
         attr="xmi.idref" linkbackattr="inPartition" />
The semantic of the "linkbackattr" is as follows. When a trigger retrieves information for a cross-reference attribute (such as "contents" for partitions), we check if the referenced element has a cross-reference attribute of the name specified by the "linkbackattr" (i.e., attribute "inPartition" that we defined for states). If so, we set the value of that attribute to point back to the referencing model element (the partition containing the state).