Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » if else statment in a rule transformation
if else statment in a rule transformation [message #1067638] Tue, 09 July 2013 18:16 Go to next message
achraf lyazidi is currently offline achraf lyazidi
Messages: 10
Registered: May 2013
Junior Member
hi everyone, i want to make an if/else statement in one of my rules, the idea is if(A) i transform from a to b, and else i transform from a to c.

this is what i did, but i got the following error :Quote:
no viable alternative at input 'if'


rule task {
	from 
		a : modeler_bpmn!task
	to
	    if (a.documentation='middle'){
	    	b : bpmn5!Task
			(
				name <- a.name,
				incomingRTT <- a.incoming,
				outgoingLTT <- a.outgoing
			)
	    }
	    else {
	    	c : bpmn5!FirstTask
			(
				name <- a.name,
			        incomingConnections <- a.incoming,
		    	        outgoingLTT <- a.outgoing
			)
	    }


Thanks you.
Re: if else statment in a rule transformation [message #1067648 is a reply to message #1067638] Tue, 09 July 2013 19:32 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 164
Registered: September 2012
Senior Member

Op 09-07-13 20:16, achraf lyazidi schreef:
> hi everyone, i want to make an if/else statement in one of my rules, the idea
> is if(A) i transform from a to b, and else i transform from a to c.

The "if" condition normally goes in the "from" part of your rule:

rule task {
from a : modeler_bpmn!task
(
a.documentation='middle'
)
to
b : bpmn5!Task
(
name <- a.name,
incomingRTT <- a.incoming,
outgoingLTT <- a.outgoing
)
}

rule firsttask {
from a : modeler_bpmn!task
(
a.documentation<>'middle'
)
to
c : bpmn5!FirstTask
(
name <- a.name,
incomingConnections <- a.incoming,
outgoingLTT <- a.outgoing
)
}

Cheers,
Dennis


Cheers,
Dennis
Re: if else statment in a rule transformation [message #1067870 is a reply to message #1067648] Thu, 11 July 2013 02:20 Go to previous message
achraf lyazidi is currently offline achraf lyazidi
Messages: 10
Registered: May 2013
Junior Member
Thank you a lot Dennis, it work.
Previous Topic:Help for using properties through collection
Next Topic:EMFTVM - Resolving source elements in refining mode
Goto Forum:
  


Current Time: Sun Sep 21 16:29:49 GMT 2014

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

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