[ATL] Two input models with cross references into one output model [message #626283] |
Wed, 22 September 2010 13:15 |
Thomas Messages: 151 Registered: July 2009 |
Senior Member |
|
|
Hi everybody,
I have two input model referring to the same Metamodel (MM_A). One of the
models(M_A1) references an element from the other input model(M_A2) which
means I have an inter-model dependency here. Now I want to transform the
model M_A1 into an output model M_B1 referring to another meta model (MM_B).
All the references of M_A1 should be transformed to elements of MM_B. This
means I would end up with a model without inter model dependencies.
The problem now is that my matched rules are not called for the referenced
elements from M_A2. This is shown in the example below. In model M_A1 I have
Parent and Child elements which are all part of MM_A. One of the childs has
a Child which comes from M_A2. For those elements the rule
MM_A_Child2MM_B_Child is not called. The runtime tries to insert the element
directly to M_B1 which would lead to a inter model reference in the output
model. If I copy the rule MM_A_Child2MM_B_Child and turn it into a lazy rule
and call it directly on the elements of M_A2 everything works. Unfortunately
this leads to redundant code I do not want to have. Is there any solution
for that?
The same setup has been discussed here[1] already but with no reference to a
solution.
Thanks and regards,
Panajotes.
rule MM_A_Parent2MM_B_Parent {
from
i : MM_A!Parent
to
o : MM_B!Parent (
hasChild<- i.childs,
hasChild<- i.childs -> collect(c|c.childs) -- the childs here are
elements from M_A2 but also refer to MM_A!Child
)
}
rule MM_A_Child2MM_B_Child {
from
i : MM_A!Child
to
o : MM_B!Child ()
}
[1] http://www.eclipse.org/forums/index.php?t=msg&goto=42988 &
|
|
|
Powered by
FUDForum. Page generated in 0.02753 seconds