A transformation is a set of transforms that you can configure, specify as public in the plug-in manifest file, and run using a transformation configuration.
The relationship between the source and target elements is defined by a set of rules that is contained in a transformation. The application of these rules is based on extractors that specify how to traverse the source set of elements. The transformation might depend on a profile to apply more information to its rules.
Transformations enable you convert UML models to code, convert code to UML models, and convert models to models at a different level of abstraction. There are four categories of transformations:
Also, transformations can implement patterns to convert elements from one form to another.
The most common starting point for a transformation is a platform-independent model (PIM), such as a class model. A class model contains design elements with no reference to implementation specifics. You can create, modify, and annotate class models, and then use transformations to generate a platform-specific model (PSM), such as a Java™ topic diagram or code-level text.
As a part of their packaging, patterns can also define and provide transformation extensions that define additional rules to be applied when they cross specific levels of abstraction or specific metamodels. A common implementation of this concept is a design pattern that provides transformation rules to generate specific code. These rules would extend a code transformation, for example, a Java or C++ transformation, to provide pattern-specific code to the generated output.
A very basic process of model transformation includes the following steps, which you can perform iteratively:
The result of a completed transformation is the target model, or text, and a record of the transformation for traceability purposes. In model-to-text transformations, the output could be Java or C++ code, Data Definition Language (DDL) files for database creation and population, unit tests, or visualization diagrams that match corresponding modeling diagrams. The record of transformation includes a map from the element in the source model to the corresponding elements of the target, and shows which parts of the mapping were used for each part of the transformation.
You can create new transformations by using the transformation API. To
create a transformation that you can configure by using a transformation configuration,
you must add the com.ibm.xtools.transform.core.transformationProviders extension
to the plugin.xml file in the plug-in that contains the transformation. The
transformation provider defines extensions of type Transformation for each
transformation that it provides. Adding these extensions automatically registers
the transformation, or transformations, with the transformation service. The
transformation service is generic and has no assumptions about the source
model, the target model, or the implementation of the transformation itself.
Although the transformation service contains a default transformation engine,
a transformation author could use an engine that is completely different.
However, by building transformations on the default engine, transformation
authors can take advantage of the logical debugging environment, the extensibility
mechanism, and any future improvements to that architecture.