Introduction: Create, configure, and run a model-to-model transformation
In this tutorial, you create a model-to-model transformation that transforms classes in a source model into interfaces and implementation classes in a target model. The generated implementation class requires copies of the operations in the source class, and the generated interface requires copies of only the public operations of the source class.
This tutorial might require some optionally installable components. To ensure that you installed the appropriate optional components, see the System requirements list.
A transformation is a type of pattern implementation strategy that takes a source element, or set of elements, and changes them into a new target element, or set of elements. Transformations enable you to transition between models and code, as well as between models of different levels of abstraction. Creating a transformation, also called transformation authoring, is a model-driven process that enables you to create transformations that contain detailed implementation information, or create transformations that specify mapping relationships between models or metamodels.
Model-to-model transformation mapping projects enable you to specify source and target metamodels and create a mapping model that defines the relationships between the elements in the metamodels. You can incrementally generate extensible transformation source code that implements the relationships. Working with this level of abstraction enables you to focus on the problem domain instead of the solution domain.
- You create a model-to-model transformation mapping project that contains a mapping model. A mapping project can contain multiple mapping models. When you create a mapping project, the transformation service registers one transformation. Each transformation has one transformation provider, a transform called MainTransform, and one transform for each mapping declaration in the project.
- You add mapping declarations, also called maps, to the mapping model. A mapping model can contain one or more mapping declarations.
- You add mapping rules to the mapping declarations in a mapping model.
- You generate transformation source code from the mapping model or mapping models in the mapping project. The model-to-model transformation authoring tools generate one transformation for each mapping model in the mapping project. For each mapping declaration, the authoring tools generate a Java™ source file that implements a transform. For each move or custom mapping rule in a mapping declaration, a rule is generated in the transform source code. For each submap mapping rule in a mapping declaration, a content extractor is generated in the transform source code.
Learning objectives
This tutorial consists of two modules that you must complete in sequence. In these modules, you perform the following tasks:- Create a model-to-model transformation authoring project that contains a transformation framework and a mapping model
- Create mapping declarations in the mapping model
- Refine the mapping declarations by completing the following tasks:
- Specify an input object and an output object for each mapping declaration
- Create mapping rules by defining the relationships between the attributes of the input and output objects in a mapping declaration
- Generate and compile the transformation source code
- Configure a runtime workbench to test the model-to-model transformation
- In a runtime workbench, create and apply a transformation configuration that runs the model-to-model transformation
Time required
This tutorial should take approximately 60 minutes to finish. If you explore other concepts related to this tutorial, it might take longer to complete.Skill level
Advanced
Audience
The intended audience for this tutorial is developers.
System requirements
To complete this tutorial, you must have the transformation authoring component installed.
You must also enable the Modeling capability.
Prerequisites
To complete this tutorial, you should be familiar with the following concepts:
- Eclipse Modeling Framework (EMF)
- Eclipse plug-in projects
- Ecore models
- Eclipse workbench