Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [SOLVED] [ATL] Put root element on all other elements
[SOLVED] [ATL] Put root element on all other elements [message #549214] Mon, 26 July 2010 07:18 Go to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Hi all

I try to put a root element over all other elements. I studied, the reference guide of ATL, but I was not able to find something. To understand my question a little bit better here is what I have and what I want to reach:

What I have

  <Task id="2" name="Request creation"/>
  <Task id="5" name="Request check"/>
  <Task id="11" name="Request decision"/>
  <Task id="15" name="Inform about loan request"/>
  <StartEvent id="1" name=" Loan request "/>
  <IntermediateThrowEvent id="3" name="Request created"/>
  <IntermediateThrowEvent id="9" name="Request complete"/>
  <EndEvent id="16" name="Loan request finished"/>
  <SequenceFlow sourceRef="1" targetRef="2"/>
  <SequenceFlow sourceRef="2" targetRef="3"/>
  <SequenceFlow sourceRef="3" targetRef="4"/>
  <SequenceFlow sourceRef="4" targetRef="5"/>
...


What I need:

<process id = '1'>
  <Task id="2" name="Request creation"/>
  <Task id="5" name="Request check"/>
  <Task id="11" name="Request decision"/>
  <Task id="15" name="Inform about loan request"/>
  <StartEvent id="1" name=" Loan request "/>
  <IntermediateThrowEvent id="3" name="Request created"/>
  <IntermediateThrowEvent id="9" name="Request complete"/>
  <EndEvent id="16" name="Loan request finished"/>
  <SequenceFlow sourceRef="1" targetRef="2"/>
  <SequenceFlow sourceRef="2" targetRef="3"/>
  <SequenceFlow sourceRef="3" targetRef="4"/>
  <SequenceFlow sourceRef="4" targetRef="5"/>
...
</process>


Thank you very much for your help.

Cheeers Roger

[Updated on: Mon, 26 July 2010 16:28]

Report message to a moderator

Re: Put root element on all other elements [message #549226 is a reply to message #549214] Mon, 26 July 2010 07:54 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 26/07/2010 09:18, Roger80 a écrit :
> Hi all
>
> I try to put a root element over all other elements. I studied, the
> reference guide of ATL, but I was not able to find something. To
> understand my question a little bit better here is what I have and what
> I want to reach:
>
> What I have
>
>
> <Task id="2" name="Request creation"/>
> <Task id="5" name="Request check"/>
> <Task id="11" name="Request decision"/>
> <Task id="15" name="Inform about loan request"/>
> <StartEvent id="1" name=" Loan request "/>
> <IntermediateThrowEvent id="3" name="Request created"/>
> <IntermediateThrowEvent id="9" name="Request complete"/>
> <EndEvent id="16" name="Loan request finished"/>
> <SequenceFlow sourceRef="1" targetRef="2"/>
> <SequenceFlow sourceRef="2" targetRef="3"/>
> <SequenceFlow sourceRef="3" targetRef="4"/>
> <SequenceFlow sourceRef="4" targetRef="5"/>
> ..
>
>
> What I need:
>
> <process id = '1'>
> <Task id="2" name="Request creation"/>
> <Task id="5" name="Request check"/>
> <Task id="11" name="Request decision"/>
> <Task id="15" name="Inform about loan request"/>
> <StartEvent id="1" name=" Loan request "/>
> <IntermediateThrowEvent id="3" name="Request created"/>
> <IntermediateThrowEvent id="9" name="Request complete"/>
> <EndEvent id="16" name="Loan request finished"/>
> <SequenceFlow sourceRef="1" targetRef="2"/>
> <SequenceFlow sourceRef="2" targetRef="3"/>
> <SequenceFlow sourceRef="3" targetRef="4"/>
> <SequenceFlow sourceRef="4" targetRef="5"/>
> ..
> </process>
>
> Thank you very much for your help.
>
> Cheeers Roger

You may have a look on the "entrypoint" sample in the ATL user guide
(http://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language)
--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Re: Put root element on all other elements [message #549232 is a reply to message #549226] Mon, 26 July 2010 08:35 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Ok, now I have the process tag at the beginning of the output file, but it is directly closed. I want to close it at the end of the transfromation.

<Process id="1"/>
<Task id="2" name="Request creation"/>
<Task id="5" name="Request check"/>
<Task id="11" name="Request decision"/>
<Task id="15" name="Inform about loan request"/>
<StartEvent id="1" name=" Loan request "/>
<IntermediateThrowEvent id="3" name="Request created"/>
<IntermediateThrowEvent id="9" name="Request complete"/>
<EndEvent id="16" name="Loan request finished"/>
<SequenceFlow sourceRef="1" targetRef="2"/>
<SequenceFlow sourceRef="2" targetRef="3"/>
<SequenceFlow sourceRef="3" targetRef="4"/>
<SequenceFlow sourceRef="4" targetRef="5"/>

I want to have this result:

<Process id="1">
<Task id="2" name="Request creation"/>
<Task id="5" name="Request check"/>
<Task id="11" name="Request decision"/>
<Task id="15" name="Inform about loan request"/>
<StartEvent id="1" name=" Loan request "/>
<IntermediateThrowEvent id="3" name="Request created"/>
<IntermediateThrowEvent id="9" name="Request complete"/>
<EndEvent id="16" name="Loan request finished"/>
<SequenceFlow sourceRef="1" targetRef="2"/>
<SequenceFlow sourceRef="2" targetRef="3"/>
<SequenceFlow sourceRef="3" targetRef="4"/>
<SequenceFlow sourceRef="4" targetRef="5"/>
<Process/>

Thanks and cheers for your help.

Roger
Re: [ATL] Put root element on all other elements [message #549238 is a reply to message #549214] Mon, 26 July 2010 08:45 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You can link every element created to the process created in the entrypoint rule.
Re: [ATL] Put root element on all other elements [message #549247 is a reply to message #549238] Mon, 26 July 2010 09:12 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
And how is it working? I search a little bit around and found something like:

entrypoint rule:
...
children <- i.contents

and then in every rule:

children <- Sequence{} and then they put some things into Sequence...but I am not sure if this is the right thing and I don't know how it is working.

Thanks for your help and cheers

Roger
Re: [ATL] Put root element on all other elements [message #549251 is a reply to message #549214] Mon, 26 July 2010 09:23 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Store somewhere the process created in the entrypoint rule so that it is available everywhere.

thisModule.process <- {NameOfTheProcessYouCreated};

and then in the other rules :

thisModule.process.{NameOfTheReferenceToStoreTheElementInThe Process} <- {TheElementToStoreInTheProcess};
Re: [ATL] Put root element on all other elements [message #549274 is a reply to message #549251] Mon, 26 July 2010 11:01 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Hi again

I tried to do it, but the success was not that good. What I did is the following:

 helper def: Process : BPMN!Process = OclUndefined;  --here I store it that it is available everywhere
	
	
entrypoint rule Metamodel() {
	to
		t : BPMN!Process
	do {
		t.id <- '1';
		thisModule.Process <- t; --Reference
	}
}


rule Application {
from
	c : EPK!Application 
	
to

	b : BPMN!DataObject
	
	(	
		thisModule.process.t <- b; --here I try to reference but there is always a error.
		id <- c.id,
	 	name <- c.name
		
),


Thanks for your further help...

Cheers Roger
Re: [ATL] Put root element on all other elements [message #549287 is a reply to message #549214] Mon, 26 July 2010 11:34 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You have to put imperative code in do blocks.
Re: [ATL] Put root element on all other elements [message #549289 is a reply to message #549287] Mon, 26 July 2010 11:39 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
What do you mean with that?
Re: [ATL] Put root element on all other elements [message #549295 is a reply to message #549214] Mon, 26 July 2010 12:05 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
do{
thisModule.process.t <- b; --here I try to reference but there is always a error.
}
Re: [ATL] Put root element on all other elements [message #549308 is a reply to message #549295] Mon, 26 July 2010 12:37 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Hi all

helper def: Process : BPMN!Process = OclUndefined;
	
	
entrypoint rule Metamodel() {
	to
		t : BPMN!Process
	do {
		t.id <- '1';
		thisModule.Process <- t;
	}
}



rule Application {
from
	c : EPK!Application 
	
to

	b : BPMN!DataObject
	(
				id <- c.id,
	 	name <- c.name
	),
	g : BPMN!DataAssociation
	(
		sourceRef <- c.name,
		targetRef <- c.name,
		assignment2 <- ansi
	),
	ansi : BPMN!Assignment
	(
			to	<-  '',
			from <- c.test(c.id)
	)
	do {	
		thisModule.process.t <- b;
	}
}


So, do I make the right references or what do I do wrong?
Now, I get the following error:

org.eclipse.m2m.atl.engine.emfvm.VMException
	at __applyApplication#67(EPL2BPMN.atl[144:3-144:29])
		local variables: self=EPL2BPMN : ASMModule, link=TransientLink {rule = Application, sourceElements = {c = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@a62f5b (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1bd2184 (name: Application) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {g = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@12330a6 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@36151c (name: DataAssociation) (instanceClassName: null) (abstract: false, interface: false)), b = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@14f1730 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@4b59dd (name: DataObject) (instanceClassName: null) (abstract: false, interface: false)), ansi = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@17b6cae (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1ea9246 (name: Assignment) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}, c=IN!Loan application, b=OUT!Loan application, g=OUT!<unnamed>, ansi=OUT!<unnamed>
	at __exec__#8(EPL2BPMN.atl)
		local variables: self=EPL2BPMN : ASMModule, e=TransientLink {rule = Application, sourceElements = {c = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@a62f5b (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1bd2184 (name: Application) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {g = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@12330a6 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@36151c (name: DataAssociation) (instanceClassName: null) (abstract: false, interface: false)), b = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@14f1730 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@4b59dd (name: DataObject) (instanceClassName: null) (abstract: false, interface: false)), ansi = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@17b6cae (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1ea9246 (name: Assignment) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}
	at main#48(EPL2BPMN.atl)
		local variables: self=EPL2BPMN : ASMModule
Re: [ATL] Put root element on all other elements [message #549319 is a reply to message #549214] Mon, 26 July 2010 13:04 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You have to use the right reference in Process compatible with the element you are storing, I doubt the name of this reference is t...
Re: [ATL] Put root element on all other elements [message #549326 is a reply to message #549319] Mon, 26 July 2010 13:22 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
I really do not understand what you mean, maybe I am too dumb. Where do I find the reference? I try to store my process in a helper, which you can see below. Is that correct?

helper def: Process : BPMN!Process = OclUndefined;


Sorry, but i do not get the point. Thanks for your help. I need just to solve this and another issue and then I am done.

Cheers Roger
Re: [ATL] Put root element on all other elements [message #549327 is a reply to message #549214] Mon, 26 July 2010 13:23 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
I was talking about thisModule.process.t <- b;
Can't help you there, look in your meta-model.
Re: [ATL] Put root element on all other elements [message #549343 is a reply to message #549327] Mon, 26 July 2010 13:43 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Aha ok, but I do not have any reference from my class process in my meta model, do I need references?

[Updated on: Mon, 26 July 2010 14:11]

Report message to a moderator

Re: [ATL] Put root element on all other elements [message #549365 is a reply to message #549343] Mon, 26 July 2010 14:12 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
So, what I did, I created a reference from the class Process to the class DataAssociation and the name of the reference is t. I also put containment to true. But still the same error...

Then my binding in the first class looks like:

thisModule.process.t <- b;
t is my reference in the output meta model from process to DataAssociation. Is that correct? b is the charakter is use for the DataAssociation class.

Cheers Roger
Re: [ATL] Put root element on all other elements [message #549378 is a reply to message #549214] Mon, 26 July 2010 14:36 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Watch your cases : thisModule.Process.t <- b; ....
Re: [ATL] Put root element on all other elements [message #549405 is a reply to message #549378] Mon, 26 July 2010 15:10 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Ok, I was able to manage it but it was just done for one element.
  <Process id="1">
    <DataObject id="39" name="Loan Application"/>
    <DataAssociation sourceRef="Loan Application" targetRef="Loan Application">
      <assignment2 to="" from="15"/>
    </DataAssociation>
  </Process>

  <DataObject id="35" name="Loan application"/>
  <DataAssociation sourceRef="Loan application" targetRef="Loan application">
    <assignment2 to="" from="2"/>
  </DataAssociation>


But as you can see, the other "DataObject Elements" are still outside the process tag, why that? I am tired, please help me.... *buuuhhuhuuuhhuhu*

I think
Re: [ATL] Put root element on all other elements [message #549418 is a reply to message #549214] Mon, 26 July 2010 15:22 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
The reference has to be 0..*
Re: [ATL] Put root element on all other elements [message #549450 is a reply to message #549418] Mon, 26 July 2010 16:28 Go to previous message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
For all who want to know how it works.

Create an entrypoint rule and a helper:

helper def: Process : BPMN!Process = OclUndefined;
	
	
entrypoint rule Metamodel() {
	to
		t : BPMN!Process
	do {
		--thisModule.metamodel <- t;
		t.id <- '1';
		thisModule.Process <- t;
	}
}


Then you have to create references on for every element you want to have under this tag:
So, in this example, you have to go to the class Process in your Meta model and you have to define a reference from Process to let's say Task. Containment = true, name = Task.
And then you have to add the folloing code to the class Task:

do {	
		thisModule.Process.Task <- b; <-- b is the reference of your class you transform to.
	}


Thank you and cheers

Roger
Previous Topic:[ATL] global elements in xmi file
Next Topic:[ATL] Put all lanes under one lane set
Goto Forum:
  


Current Time: Fri Mar 29 14:07:46 GMT 2024

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

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

Back to the top