Cédric Brun bio photo

Cédric Brun

Building kick-ass products in Eclipse and on Eclipse.

Email Twitter
The following message is posted on this blog on behalf of Patrick Könemann

Cédric already announced it two weeks ago: MPatch is integrated into EMF Compare!

Did you ever want to transfer changes from one model to another?

Or do you frequently perform the same changes on your models?

MPatch is a technology that stores model changes as self-contained artifacts, just like patches, that are also applicable to other models! Let me show an example of how MPatch works:

This is just a simple model, a base version on the left and a modified version on the right.
Modeled with the IBM Rational Software Architect, but any kind of EMF model is supported.
The changes are highlighted: 3 deleted attributes, 1 updated attribute, 1 new class, 3 new generalizations.

EMF Compare is a nice tool for calculating such changes. The result is shown below.
All changes are nicely highlighted in the treeviews and one can browse through them.
This is where MPatch comes into play: the export menu lists a new option!

An export wizard is started that guides the user through the MPatch creation task.
In the end, the changes are stored in a file, extract_id.mpatch for example.
This file can now be applied to other models, even if their contents differ!

The model below is a different one -- again we want to extract the id attribute into a common superclass.
However, the attributes, the classes, and even the number of attributes and classes differ!

Let's see how MPatch handles the situation.
Selecting Apply MPatch triggers a wizard with the same name.
The crucial part is the so-called resolution of symbolic references -- they are responsible for selecting the proper model elements of your target model.
Let's have a closer look:

  • The first change is not applicable because there is no attribute called Title -- ignore this!
  • The second change is applicable because a similarly named package (data vs. customerdata) is found -- ok.
  • The third change is applicable because I manually selected Contract and Invoice -- ok.
  • The fourth change is applicable because similar named attributes (id vs. inv_id / con_id) are found -- ok.

Following the wizard to its end updates the given model and this is the result:

To wrap up, an Mpatch is not only a self-contained patch for models, it is even able to make the changes applicable to different models!

Installation instructions and a lot more information on the project website: http://modeldiff.imm.dtu.dk.