Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Problems with transformation in UML Models

Hi Marco,

thanks for the example, it helped me to discover and fix another bug in the development version.

Now to your problem. This seems to be an issue related to EMFCompare, which is used for computing and displaying the diff. How it works is that we make a complete copy of the input model, transform it and compare it to the original model. I rechecked that Henshin does the right thing and it does: it only removes the A-class and its incoming references, nothing else. So this problem must be caused by EMFCompare.

I noticed also something else in your example. Your instance model is typed over the "static" UML meta model (it does not use the metamodel in your UML.ecore file). On the other hand, your Henshin file imports and uses the UML.ecore file. This can lead to problems at runtime. Currently the interpreter wizard resolves these issues automatically, but in general it is not the right way to do it. The right way to do it would be one of these options:

Option 1: Use the static UML2 metamodel in your Henshin file. For this, click on "Import Packages -> From Registry", choose "Runtime version" and select this URL: "http://www.eclipse.org/uml2/3.0.0/UML" (the one you also use in the instance model).

Option 2: Use the dynamic UML2 metamodel (the one in UML.ecore) in your instance model. To create a dynamic instance model, select the UML.ecore file, click on "Henshin -> Create Dynamic Instance" and edit it with the sample reflective editor.

Bottom line: you should consistently use the same metamodels in your transformation and your instance models.

Regarding EMFCompare, I do not really know what to do. You could try to invoke EMFCompare directly using the two models (input and output model) and see if you get the same result (which I strongly suspect) and ask the EMFCompare guys for help.

Cheers,
Christian





On 09/04/2012 01:52 PM, Marco Konersmann wrote:
Hi,

I have difficulties when transforming models that are based on the ecore meta model for UML.
The transformations always delete all elements and add them again, when they should not be touched.

I attached a trivial example for the model I use and two transformation rules as an Eclipse Project. I also included the UML meta model file for convenience.
The model is a UML "Model" as root and two "Classes" with the name "A" and "B".
The first rule (testRule) is a "Delete the class with the name 'A' that is a packagedElement in the model".
The execution then results in:
* remove A
* remove B
* add B

while I expected it to be
* remove A
only.

The second rule (testRule2) just has a LHS: "preserve Model". This results in
* remove A
* remove B
* add A
* add B

These changes make it nearly impossible for me to analyse the results of transformations in more complex UML models using the wizard, because for n elements I have about 2n changes in the model, regardless of the existence of a real change.

Interestingly this does not occur when I use a self-made meta-model.

Best regards
Marco







_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev


Back to the top