Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » succesive "collect"
succesive "collect" [message #483218] Mon, 31 August 2009 15:57 Go to next message
debutante is currently offline debutanteFriend
Messages: 6
Registered: July 2009
Junior Member
Good afternoon,

can we applicate two succesive "collect" like this

"classes <-
DSLC!StructureElement.allInstances()->collect(e|e.chapiter='true')- >collect(c
| thisModule.SE2C(c) )"

thank you
Re: succesive "collect" [message #483448 is a reply to message #483218] Tue, 01 September 2009 15:47 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
Hello,

In fact, collect() will return a Sequence of Sequences. So to iterate
over all elements, despite the fact that they are contained by sub
sequences, you have to call the flatten() function first (see
http://wiki.eclipse.org/ATL/User_Guide#Sequence_data_type_op erations for
details).

e.g. in your case:

classes <- DSLC!StructureElement.allInstances()
-> collect(e|e.chapiter) -> flatten()
-> collect(c | thisModule.SE2C(c) )

Best regards,

William

debutante a écrit :
> Good afternoon,
>
> can we applicate two succesive "collect" like this
>
> "classes <-
> DSLC!StructureElement.allInstances()->collect(e|e.chapiter='true')- >collect(c
> | thisModule.SE2C(c) )"
>
> thank you
>
Re: succesive "collect" [message #483504 is a reply to message #483448] Tue, 01 September 2009 19:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi William

The specification for an OCL collect is that it flattens to a non-unique
variant of the individual returns.

Regards

Ed Willink

William Piers wrote:
> Hello,
>
> In fact, collect() will return a Sequence of Sequences. So to iterate
> over all elements, despite the fact that they are contained by sub
> sequences, you have to call the flatten() function first (see
> http://wiki.eclipse.org/ATL/User_Guide#Sequence_data_type_op erations for
> details).
>
> e.g. in your case:
>
> classes <- DSLC!StructureElement.allInstances()
> -> collect(e|e.chapiter) -> flatten()
> -> collect(c | thisModule.SE2C(c) )
>
> Best regards,
>
> William
>
> debutante a écrit :
>> Good afternoon,
>>
>> can we applicate two succesive "collect" like this
>>
>> "classes <-
>> DSLC!StructureElement.allInstances()->collect(e|e.chapiter='true')- >collect(c
>> | thisModule.SE2C(c) )"
>>
>> thank you
>>
Re: succesive "collect" [message #484814 is a reply to message #483504] Wed, 09 September 2009 12:15 Go to previous message
debutante is currently offline debutanteFriend
Messages: 6
Registered: July 2009
Junior Member
think you,

so I have to call flatten fonction before calling a second "collect"?
Previous Topic:[ATL] inconsistency in handling of enums in emfvm
Next Topic:[ATL] dealing with XMLInjector / XMLExtractor with ATL 3.0
Goto Forum:
  


Current Time: Thu Apr 25 06:53:30 GMT 2024

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

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

Back to the top