Implicit Copy

This is an optimisation pattern.

Summary

This is a pattern specific to migration transformations. The pattern avoids the explicit copying of identical source model structure to target model structure, by means of strategies for implicitly copying such structure.

Application conditions

The pattern is useful when the source and target languages contain large parts of similar or identical structure. Rules which consist mainly of copying entity types and features are a sign that this pattern is needed. Without using the pattern, a large number of rules, at least one for each source language entity type, will be needed.

Solution

Specify implicit copying of entity types and features from source to target by some mechanism such as the conservative copy strategy of Epsilon Flock (Rose et al., 2012). If source entity type E is identified as corresponding to target entity type F, then all the same-named and same-typed features of E are copied implicitly by default to those of F. Only differently-named/typed features need to be mapped explicitly.

Other techniques for Implicit Copy are to generate copy rules from source and target metamodels using a higher-order transformation (HOT), or a filtering approach where the source model is copied to the target and then filtered to remove any elements that fail to conform to the target metamodel (this technique is used by the COPE tool).

Benefits

The pattern makes a migration transformation specification more concise by avoiding explicit copying of corresponding data features. The transformation may not need to change even if the source language changes, e.g., by a simple enlargement of the feature sets of entity types within the metamodel.

Disadvantages

The implicit copy process needs to be made explicit for verification. Implicit copying may be semantically incorrect in some cases, e.g., there can be features with the same name and type in different entity types, but which have distinct meanings. Complex structural changes between the source and target (such as entity splitting) cannot be defined using this pattern.

Applications and examples

This pattern is specifically relevant to migration transformations, although it could be used in other categories of transformation, except model-to-text or text-to-model.

The Flock solution to the UML migration problem of TTC 2012 is an example of this pattern. For example, the rule

migrate ActionState to OpaqueAction

specifies the implicit copy of all features of ActionState to matching features of OpaqueAction.

The UML-RSDS tools generate copying transformations, of the Structure Preservation form, from language morphisms of the source to the target languages (http://www.dcs.kcl.ac.uk/staff/kcl/umlrsds.pdf). The pattern is potentially useful as an inbuilt facility for general-purpose model transformation languages.

Related patterns

This is one way of implementing the Structure Preservation pattern.

(Rose, 2012) L. Rose, M. Herrmannsdoerfer, S. Mazanek et al., Graph and Model Transformation Tools for Model Migration, Software and Systems Modeling, April 2012, doi:10.1007/s10270-012-0245-0.