Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Consolidate multiple input elements into one output element
[ATL] Consolidate multiple input elements into one output element [message #519320] Mon, 08 March 2010 14:09 Go to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
Hello!

I have troubles getting my head around the following problem:

Suppose i have:

-input metamodel mmA
-output metamodel mmB

mmA contains an element A, so an instance of mmA (=mA) can have multiple A elements. I would like to transform this to 1 B element, consolodating (ie. union) attributes etc. from the A's.

What is the best strategy for doing something like this? Because selecting on A yields multiple matches, but i want, for multiple matches, 1 'to' clause.

Hope someone can help me out with this.


My company: Sytematic, building business software from models.
Re: [ATL] Consolidate multiple input elements into one output element [message #521935 is a reply to message #519320] Fri, 19 March 2010 11:31 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: March 2010
Junior Member
Hi Marten, hi all,

I have the same problem, I need to consolidate multiple input elements into one output variable (a string having input elements attached by means of the + symbol), do you know now how to dolve it, I will wonder if you can help me, please, is very important and urgent.
thak you very much in advance.
my email is raul.mazo@hotmail.com
Re: [ATL] Consolidate multiple input elements into one output element [message #521949 is a reply to message #519320] Fri, 19 March 2010 07:26 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Marten Sijtema a écrit :
> Hello!
>
> I have troubles getting my head around the following problem:
>
> Suppose i have:
>
> -input metamodel mmA
> -output metamodel mmB
>
> mmA contains an element A, so an instance of mmA (=mA) can have multiple
> A elements. I would like to transform this to 1 B element, consolodating
> (ie. union) attributes etc. from the A's.
>
> What is the best strategy for doing something like this? Because
> selecting on A yields multiple matches, but i want, for multiple
> matches, 1 'to' clause.
>
> Hope someone can help me out with this.

As ATL is declarative, think through SET approach.

You want:
{a1, a2, ... an} -> {b}

so you may try writing a rule using 'allInstances' which gives you a set
as input of the rule and then 'each' function on it to compute 'b'....
--
Cordialement

Vincent MAHÉ

Ingénieur plate-forme - Cesar/Artemisia - Équipe Espresso
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
Re: [ATL] Consolidate multiple input elements into one output element [message #524498 is a reply to message #519320] Thu, 01 April 2010 07:55 Go to previous message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
I fixed it. I created a helper that queries over the source model, and puts the result of this query in a sequence. The helper is called from the using { } section of a normal rule, and the result is put in a variable, and then added to an element from the 'to' section.

thanks for the help.


My company: Sytematic, building business software from models.
Previous Topic:[Xtend] Workflow error at running
Next Topic:[Xtend] Debugging Irritation
Goto Forum:
  


Current Time: Wed Oct 23 19:33:59 GMT 2019

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

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

Back to the top