Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Cross References

Topics

Topic

Detail

See also

Abstract

Cross References are an important part of transformations. They are used 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
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 create the cross references using the TRANSFORM_REFERENCE macro that is defined for this purpose. It has three optional parameters.

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

This generates a reference that can be used in the ways described above. It resembles the following.

 

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

 

Where:

If <name> is not specified it gets the name of the current template
If <sourceGUID> is not specified it gets the GUID of the current Class
If <namespace> is not specified it 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 templates 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.

 

DDL Transformation

 

 

 

 

 

 

 

 

 

 

 

 

XRef element

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 TRANSFORM_CLASSIFIER macro.

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

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, a TRANSFORM_CLASSIFIER is inappropriate and instead the GUID can be given directly to a classifier attribute.

If a classifier is specified for any type it overrides the type specified.