This is another example of a tree to model bx transformation, which can be used to establish an incremental import and export for a textual or XML-based format.
The diagram below depicts a concrete example of an XML file (above) and the corresponding "Sense" model below.
Sense models consist essentially of Actors connected by Channels. There are also certain Capabilities and ProcessorTypes of the model, where Capabilities can be performed by Actors and are connected to ProcessorTypes.
To store such a model in an XML file (which is a tree without any linking conventions), (1) some form of referencing (via certain attributes that are unique in a certain scope) must be used, and (2) types have to be encoded using names and attributes.
This is all captured by the bx transformation, which should be able to propagate changes (import/export) incrementally.
Properties [optional section]
Variants [optional section]
This example was posed as a challenge by Arend Rensink at a bx seminar in Banf Canada 2013.
On one of the evenings we got together and sketched the required TGG rules for the transformation, which I later on implemented (digitalized) with eMoflon (cf. provided implementation in the Artefacts section).
Arend also has a forward and backward implementation in Epsilon, so this might be interesting for a comparison of some sorts one day.
References [optional section]
Anthony Anjorin, Arend Rensink
Artefacts [optional section]
A virtual machine hosted on Share is available with a workspace containing both (Ecore) metamodels, the concrete example used above, and a TGG formalizing the consistency relation as a set of rules: