Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Order of Transformation
Order of Transformation [message #1017286] Mon, 11 March 2013 09:42 Go to next message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member
Dears,
I use ATL in a simple transformation.

I need to know how to keep the order of the input model elements after the transformation.

for example:
If I have 2 different entities (input_1 and input_2) in the input model need to be transformed to their corresponding 2 output entities (output_1 and output_2).
I will make 2 rules, one to transform each entity as follows:

rule input_1_to_output_1
{}
rule input_2_to_output_2
{}

If the input file is as follows:

<input_1 ></input_1 >
<input_2 ></input_2 >
<input_1 ></input_1 >

The rules will run sequentially (rule 1 then rule 2)writing to the output file and the result will be:

<output_1 ></output_1 >
<output_1 ></output_1 >

<output_2 ></output_2 >

so it transformed all input_1 first then input 2 and this changed the order of lines in the output.

In my problem I need them to be ordered.
How can I solve this?




Re: Order of Transformation [message #1017750 is a reply to message #1017286] Tue, 12 March 2013 09:31 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Hello,

If model elements have to be ordered, this has to be explicitly specify in the corresponding metamodel, for instance by creating an ordered reference in one class (pointing to instances of other classes).
If your model elements are contained directly at the root of the model or in an non-ordered reference, then it is normal that your case can happen.

Best regards,

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: Order of Transformation [message #1021863 is a reply to message #1017750] Wed, 20 March 2013 16:21 Go to previous messageGo to next message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member

Can this be made in EMF metamodel, not KM3?
Re: Order of Transformation [message #1022088 is a reply to message #1021863] Thu, 21 March 2013 05:06 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Of course you can work directly on the Ecore files to specify your metamodels.
KM3 is just a textual notation that is intended to simplify the definition of such metamodels in Ecore, but its use is by no way mandatory.

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: Order of Transformation [message #1023190 is a reply to message #1022088] Sat, 23 March 2013 10:46 Go to previous messageGo to next message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member
Thanks a lot.
Re: Order of Transformation [message #1031973 is a reply to message #1023190] Tue, 02 April 2013 08:27 Go to previous messageGo to next message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member
I tried to solve this problem by making an ordered reference, but this didn't work.

My metamodel is a metamodel for a flowchart.
I have a class called Flowchart which has a reference called nodes to the class Node.
The metamodel is as follows:

http://imageshack.us/a/img839/6451/flowchartmm140.jpg

And the detailed properties of the nodes reference in class Flowchart is as follows:
http://imageshack.us/a/img221/646/nodesproperties.jpg

And the details of the flowchart reference in class Node is as follows:
http://imageshack.us/a/img827/502/flowchartproperties.jpg

And a sample Input is as follows:
http://img191.imageshack.us/img191/7912/flowchartsampleinput.jpg

And I still have unordered output.

How can I solve this?

[Updated on: Tue, 02 April 2013 08:31]

Report message to a moderator

Re: Order of Transformation [message #1035798 is a reply to message #1031973] Sun, 07 April 2013 08:31 Go to previous message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member
Can anyone help in this case?
Previous Topic:How to call a rule from an other rule
Next Topic:Using UML profile as metamodel
Goto Forum:
  


Current Time: Tue Jul 22 03:37:27 EDT 2014

Powered by FUDForum. Page generated in 0.02766 seconds