resolveTemp over several associations [message #990544] |
Wed, 12 December 2012 19:32  |
Eclipse User |
|
|
|
Hello, I just started working with ATL and wonder if/how it is possible to do the following transformation:
Source Model:
System --> Car --> Seat, where "-->" stands for "contains multiple".
Target Model:
CarSystem --> CarSeat where Filesystem corresponds to Sytem, but CarSeat has an attribute which combines the name of Car and Seat, e.g. if car="Mercedes" and "Seat"="BlackSeat", then CarSeat.name should be "Mercedes-BlackSeat".
I found some tutorials which used resolveTemp to generate the required link, but the problem here is that there are multiple associations over 2 levels and furthermore one target class combines two source classes.
Please help me to solve the problem! Please take especially a loop at the nested collect-resolve-temp line. If there is only one level it works for me, but if I want to collect all the seats, which is at level 2, it doesn't work. Why? How to solve that in ATL (if possible without DO-constructs).
This is my current solution which doesn't work (simplified):
rule System2Carsystem {
from
s1: in:System
to
s2: out!CarSystem(
containsCars <- s1.containsCars->collect(c|
c.containsSeats->collect(g| thisModule.resolveTemp(g, 'cs'))
)
)
}
rule SeatToCarSeat {
from
car: in!Car,
seat: in!Seat
to
cs: out!CarSeat(
name <- car.name + '-' + seat.name
)
}
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04834 seconds