Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] How to correctly build rules?

This reminds me: does the interpreter wizard correctly handle root nodes? E.g. when a new root node is added.

Cheers,
Christian

Am 09.10.2012 20:05, schrieb Christian Krause:
Hi Jens,

Am 05.10.2012 19:29, schrieb Jens Bürger:
Henshin even seems to apply a transformation, but instead of adding the desired stereotype, it (aims to) remove the two other stereotypes (the one from aNode and the CommunicationPath) -- maybe I misunderstood how transformation rules work here?

Could it be that the stereotypes are root nodes? If you execute your transformation programmatically, try this: call graph.getRoots() to see the root objects before and after the transformation. If they are in fact roots, then you should see the added stereotype after the rule application.

If that is as expected, all you need to do is to add the new root object to the resource. A simple way of doing it would be:

resource.getContents().clear();
resource.getContents().addAll(graph.getRoots());

Then you can save the resource and everything should be as expected.

By the way: you should also make sure that the EGraph knows all the root objects:

// Create and init the EGRaph:
EGraph graph = new EGraphImpl(resource);
...

This automatically adds all roots to the graph.

Hope it works. If you have questions, please ask..

Cheers,
Christian



Back to the top