Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] one to many Transformation ([ATL])
[ATL] one to many Transformation [message #537802] Thu, 03 June 2010 16:57 Go to next message
Pejman  is currently offline Pejman Friend
Messages: 18
Registered: June 2010
Junior Member
Hi,

I want to create multiple instances in the target model from a single source element. The problem is the number is an integer attribute of the source element which is variable. So is there any way that I can use ATL for this purpose?

Thanks in advance
Pej
Re: [ATL] one to many Transformation [message #537912 is a reply to message #537802] Fri, 04 June 2010 07:36 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
you can use a distinct foreach pattern (even though it's deprecated it still works nicely)

to
t : distinct MM!EE foreach(e in XX)(

)

XX has to be a collection though. If you have to iterate on an Integer, then you can use a Number Sequence :
helper def : numberSeq : Sequence(Integer) =
Sequence{1,2,3, etc..}
;
and then use as collection

thisModule.numberSeq->subSequence(1,myInteger)
Re: [ATL] one to many Transformation [message #538132 is a reply to message #537912] Sat, 05 June 2010 13:57 Go to previous messageGo to next message
Pejman  is currently offline Pejman Friend
Messages: 18
Registered: June 2010
Junior Member
Thanks Sylvain for your answer.

So the sequence of integers(Sequence{1,2,3, etc..}) should be created manually.More specifically the end of sequence should be defined by me. In that case one should know what is the maximum number of instances need to be created and thus them maximum size of the collection statically and at implementation time(not run time). At run time the number of instances that are gonna be created should be lower than that maximum.Am I right?

Thanks,
Pejman

[Updated on: Sat, 05 June 2010 13:59]

Report message to a moderator

Re: [ATL] one to many Transformation [message #538601 is a reply to message #538132] Tue, 08 June 2010 07:58 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Pejman wrote on Sat, 05 June 2010 09:57
Thanks Sylvain for your answer.

So the sequence of integers(Sequence{1,2,3, etc..}) should be created manually.More specifically the end of sequence should be defined by me. In that case one should know what is the maximum number of instances need to be created and thus them maximum size of the collection statically and at implementation time(not run time). At run time the number of instances that are gonna be created should be lower than that maximum.Am I right?

Thanks,
Pejman

With this solution I'm afraid the answer is yes.
But if the number varies then that's because it depends on something. Then you could iterate on that something instead of a fixed length.
Re: [ATL] one to many Transformation [message #538731 is a reply to message #538601] Tue, 08 June 2010 13:54 Go to previous message
Pejman  is currently offline Pejman Friend
Messages: 18
Registered: June 2010
Junior Member
Actually I have solved the problem using a recursive helper function which takes the integer as an input and decrease it in each iteration and instantiating one instance of the certain class. Apparently there is no better solution since the only available information is the value of an integer attribute in the input model.
Previous Topic:[ATL] construct/obtain .asm file programmatically
Next Topic:[QVTo] 1-to-* transformation does only result in one deeper transformationtree
Goto Forum:
  


Current Time: Thu Dec 05 09:43:25 GMT 2024

Powered by FUDForum. Page generated in 0.05964 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top