Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] : problem with Sequence in Sequence
[ATL] : problem with Sequence in Sequence [message #39516] Mon, 21 May 2007 09:15 Go to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

I have defined an helper for an UML transformation which takes all the
operations of the class from a package

helper context UML!Package def : getOperations() : Sequence(UML!Operation)
=
(
self.ownedMember->select(a|a.oclIsTypeOf(UML!Class))->collect(a |
a.ownedOperation).asSequence()
);

But when I check what there is returned by this helper I have this trace :

Sequence {Sequence {_in!opcs_pop, _in!opcs_push, _in!pop, _in!push},
Sequence {}, Sequence {}, Sequence {}, Sequence {}}

A sequence in a sequence O_o . . . How can I do to have Just One sequence
???

Thanks

PS : if anybody knows (or have a source?) what is the best solution for
defining a rule
1 element -> many elements (i have to define for one operation many
signals)
I take it ;)

i did something like that :
s : _IF!System (
id <- p.name,
signal <- theSignals,
),
theSignals : distinct _IF!Signal foreach (e in seq)(
id <- e. ...
)
Re: [ATL] : problem with Sequence in Sequence [message #39549 is a reply to message #39516] Mon, 21 May 2007 09:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rchevrel.sodius.com

This is a multi-part message in MIME format.
--------------080600060208040609090005
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Tristan,

It is completely normal to obtain sequence of sequences: select return a
sequence and collect return a sequence for each element in input
sequence, so you obtain sequence of sequences.

Use "flatten" operation to create a sequence from a sequence of sequences
(Sequence {Sequence {_in!opcs_pop, _in!opcs_push, _in!pop, _in!push},
Sequence {}, Sequence {}, Sequence {}, Sequence {}}->flatten()
become: Sequence{_in!opcs_pop, _in!opcs_push, _in!pop, _in!push})

For your P.S., the way to do this is exactly the one you propose, so
try it or send more information :)

Regards,

*R
Re: [ATL] : problem with Sequence in Sequence [message #39579 is a reply to message #39549] Mon, 21 May 2007 09:49 Go to previous message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

Thank you so much the flatten method is exactly what i was looking for !!!!
it works good now

Tristan

PS : and thank you for my previous PS i just wanted a confirmation !
Previous Topic:[ATL] Table2SVGPieChart - Extract to XML?
Next Topic:[ATL] How to construct a metamodel in KM3 from a DTD
Goto Forum:
  


Current Time: Thu Mar 28 22:45:48 GMT 2024

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

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

Back to the top