The output that a transformation
generates can replace or merge with an existing model. You must specify
the merge properties in the transformation configuration that you
create before you run the transformation. The availability of a merge
depends on the specification of a merge strategy for the output metamodel.
Before you begin
A transformation configuration
file must be defined, typically in the project that contains the input
model that the transformation will process, or in the project that
contains the target model that the transformation overwrites or merges
into. A transformation configuration file has .tc as a file name extension,
and defines how the model-to-model transformation runs. The
target metamodel must declare a CompareMerge
content type extension. If
the metamodel of the target model does not declare a CompareMerge
extension, the transformation overwrites the target model.
About this task
To specify merge options for model-to-model transformation
output:
Procedure
- In the Project Explorer view, right-click
the transformation configuration file; then click Open.
- In the Transformation Configuration editor, click the Properties tab.
- Specify how the model that the transformation generates
should be merged with target model.
- Click .
Example
For example, assume that the transformation generates
an output model called MyOutputModel.input, which is an instance of
the input.ecore metamodel. Assume that the plugin.xml file of the
input.ecore metamodel plug-in contains a merge extension that specifies
the default Ecore merge strategy. If you create a transformation configuration
that specifies MyOutputModel.input as the target model in a transformation
configuration, and specifies the override merge option, the transformation
replaces the contents of MyOutputModel.input with the contents of
the temp.input model that the transformation generates at run time.
If
you specify other merge options in the transformation configuration,
such as automatic, silent, or visual and the input.ecore metamodel
plug-in specifies the default EMF merge strategy, the transformation
merges the contents of temp.input with MyOutputModel.input.
If
the input.ecore metamodel plug-in does not specify a merge strategy,
no merge occurs, regardless of the information in the transformation
configuration. The transformation runs as though the override merge
option is specified.