Some Question of ATL [message #1755781] |
Wed, 08 March 2017 06:59 |
Nicholas Kong Messages: 59 Registered: July 2016 Location: China |
Member |
|
|
Hi Everyone,
I am the fresh user to using ATL. But now, I met some question.
If there are some one who can answer these questions, please reply me.
1) When I use ATL to write the model transformation rule, is it support to separate one ATL to many? as Java or other program language can import other rule from different file.
Because I want to use ATL to transfor a meta-model, which one has more than 100 Elements. I have had wrote almost 5000 lines for model transformation. Now, I just find how to sperate helper from one atl as libary. But does any one who knows how to separe the transforamtion rule to different file.
2) Is there any function can do like :
for(int i=1; i<*.length; i++){
index <- i
}
in ATL? Does ATL support variable defination?
3) IF I want to transfor a big model ATL, some time may be I modify some part of model, need transfor it again. Does ATL supprot incremental transformation?
[Updated on: Wed, 08 March 2017 07:33] Report message to a moderator
|
|
|
Re: Some Question of ATL [message #1755793 is a reply to message #1755781] |
Wed, 08 March 2017 09:12 |
|
Nicholas Kong wrote on Wed, 08 March 2017 07:591) When I use ATL to write the model transformation rule, is it support to separate one ATL to many? as Java or other
Yes, ATL supports library modules for helpers, which can be imported in the "uses" section of a module. In addition, there is module superimposition. Finally, the ATL/EMFTVM runtime provides an improved module import mechanism.
Nicholas Kong wrote on Wed, 08 March 2017 07:592) Is there any function can do like :
for(int i=1; i<*.length; i++){
index <- i
}
in ATL? Does ATL support variable defination?
The preferred way of programming in ATL is declarative, i.e. without variables. Your example is not ideal, because only the last assignment of "index" matters, and your code can be rewritten as follows:
index <- if *.length <= 1 then OclUndefined else *.length - 1 endif
That said, you can declaratively "do something" for each element in a collection as follows:
element.property->collect(p | calculateSomething(p))
You can compare this to Java 8 streams.
Nicholas Kong wrote on Wed, 08 March 2017 07:593) IF I want to transfor a big model ATL, some time may be I modify some part of model, need transfor it again. Does ATL supprot incremental transformation?
No, it doesn't. However, you can still speed up repetitive transformations by packaging your transformation in an Eclipse plugin, and then keep it loaded in memory. In addition, you can have your transformation operate directly on the model in memory (i.e. the one loaded by the editor).
Cheers,
Dennis
|
|
|
|
Powered by
FUDForum. Page generated in 0.03627 seconds