Hi, all
I have the following ATL rule.
rule mmA2mmB{
from
A : MMA!TypeC
to
B : MMB!TypeC(
refOne <- newElem,
refTwo <- newElem
),
newElem : MMB!TypeD(
attr <- '12345'
)
}
I am expected something like this:
<TypeC>
<refOne attr='12345'>
<refTwo attr='12345'>
</TypeC>
But, here is what I got
<TypeC>
<refTwo attr='12345'>
</TypeC>
Of course, we could do something like below to overcome this issue:
rule mmA2mmB{
from
A : MMA!TypeC
to
B : MMB!TypeC(
refOne <- newElem,
refTwo <- newElemSame
),
newElem : MMB!TypeD(
attr <- '12345'
)
newElemSame : MMB!TypeD(
attr <- '12345'
)
}
But, it becomes very unpractical if you want to use pattern match from other rule.
(wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#Simple_target_pattern_element)
May I ask is there other way to achieve my expectation? or any reason why ATL
won't allow me to reuse the elements?
[Updated on: Tue, 14 February 2012 14:55]
Report message to a moderator