Cross References

Cross References are an important part of transformations. You can use them to:

·Find the transformed Class to synchronize with
·Create connectors between transformed Classes
·Specify a classifier of a type
·Determine where to transform to for future transformations


Each cross reference has three different parts:

·A Namespace, corresponding to the transformation that generated the element
·A Name, which is a unique reference to something that can be generated in the above transformation, and
·A Source, which is the GUID of the element that this element was created from


When writing the templates for a transformation it is easiest to generate the cross references using the macro defined for this purpose:

  TRANSFORM_REFERENCE (<name>, <sourceGuid>, <namespace>)

The three parameters are optional. The macro generates a reference that resembles the following.


XRef{namespace="<namespace>" name="<name>" source="<sourceGuid>"



·If <name> is not specified the macro gets the name of the current template
·If <sourceGUID> is not specified the macro gets the GUID of the current Class
·If <namespace> is not specified the macro gets the name of the current transformation

The only time that this should be specified is when creating a connector to a Class created in a different transformation.

A good example of the use of cross references is in the DDL transformation provided with Enterprise Architect. In the Class template a cross reference is created with the name Table. Then up to two different connectors can be created, each of which must identify the two Classes it connects using cross references, while having its own unique cross reference.

Specify Classifiers

Objects, attributes, operations and parameters can all reference another element in the model as their type. When this type is created from a transformation you must use a cross reference to specify it, using the macro:

  TRANSFORM_CLASSIFIER (<name>, <sourceGuid>, <namespace>)

This macro generates a cross reference within a classifier element, where the parameters are identical to the TRANSFORM_REFERENCE macro but the name Classifier is generated instead of XRef.

If the target classifier already exists in the model before the transformation, TRANSFORM_CLASSIFIER is inappropriate, so instead the GUID can be given directly to a classifier attribute.

If a classifier is specified for any type, it overrides that type.

Learn more