Structure Preservation/Model Copy

This is a modularisation pattern.

Summary

This is the simplest special case of the Phased Construction pattern, in which the entity types of the source language S are in 1-1 relation to those of the target T, and the objects of each pair S_i and T_i of entities are also in a 1-1 relation. Such transformations occur as copying transformations in ATL and other languages.

Application conditions

This pattern is appropriate if the transformation should maintain a 1-1 relation between the source and target models. In particular, the pattern is used when a model needs to be copied to a closely-related language. These transformations can be used as simple sub-components within more complex transformations, such as migration transformations where only a small part of a model changes significantly in structure from source to target.

Solution

Write the transformation rules in the phased construction form

for s : S_i satisfying SCond
create t : Ti satisfying TCond and Post

where Post copies the feature values of s to corresponding features of t. If identities of Si instances are copied to those of Ti instances, this mapping must be in an injective (inequality-preserving) manner. Either top-down or bottom-up construction strategies can be used, as with Phased Construction.

Applications and examples

The pattern is applicable to the same categories of transformations as Phased Construction, but is particularly relevant for migration transformations.

Transformations which copy models are examples of this pattern. The inverse of a structure preservation transformation is itself typically a structure preservation transformation.

Related patterns

The pattern is a special case of Phased Construction. The pattern is referred to as the mapping pattern in (Iacob et al, 2008). In (Goldschmit et al, 2011) a pattern for implementing copy transformations in QVT-R using marking relations is described, and (Tisi et al) considers the generic specification of copy transformations in ATL. Structure Preservation can be used as a basis for implementing update-in-place transformations by selective copy, for languages which do not directly support update-in-place processing. The ATL and QVT-R solutions in (Kolahdouz-Rahimi et al) are examples of this technique.

The Implicit Copy pattern is another solution to the problem of defining transformations that preserve large parts of a model structure, but this pattern requires suitable language facilities to be present in the transformation language (as in Epsilon Flock).

(Goldschmidt et al., 2011) T. Goldschmidt, G. Wachsmuth, Refinement transformation support for QVT relational transformations, FZI, Karlsruhe, Germany, 2011.

(Iacob et al, 2008) M. E. Iacob, M. W. A. Steen, L. Heerink, Reusable model transformation patterns, Enterprise Distributed Object Computing Conference Workshops, 2008, pp. 1--10, doi:10.1109/EDOCW.2008.51.

(Tisi et al., 2010) Tisi, J. Cabot, F. Jouault, Improving higher-order transformations support in ATL, ICMT 2010, LNCS vol. 6142, pp. 215--229, 2010.