[ATL] Consolidate multiple input elements into one output element [message #519320] |
Mon, 08 March 2010 14:09 |
Marten Sijtema 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 #521949 is a reply to message #519320] |
Fri, 19 March 2010 07:26 |
Vincent MAHE 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02983 seconds