[ATL] Problem with Helper in Rule [message #537948] |
Fri, 04 June 2010 09:56 |
Roger80 Messages: 79 Registered: May 2010 |
Member |
|
|
Please could you tell me what is wrong with the helper?
I try to find out the "id" of the Event. If the id = '1' then change to 'StartEvent' else let '1'
-- @path Families=/EPL2BPMN/EPK.ecore
-- @path Persons=/EPL2BPMN/BPMN.ecore
module EPL2BPMN;
create OUT : BPMN from IN : EPK;
helper context EPK!Event def: id : String =
if self.Event.id = '1' then
'StartEvent'
else
'1'
endif;
rule Event {
from
e : EPK!Event
to
b : BPMN!StartEvent
(
id <- e.id,
name <- e.name
)
}
rule Flow {
from
e : EPK!ControlFlow
to
b : BPMN!SequenceFlow
(
sourceRef <- e.source,
targetRef <- e.target
)
}
Thank you.
[Updated on: Fri, 04 June 2010 09:56] Report message to a moderator
|
|
|
Re: [ATL] Problem with Rule [message #537963 is a reply to message #537948] |
Fri, 04 June 2010 10:46 |
Tassilo Horn Messages: 93 Registered: July 2009 |
Member |
|
|
Roger80 <roger.boehlen@students.fhnw.ch> writes:
Hi Roger,
> Please could you tell me what is wrong with the helper?
If you don't tell us what exactly doesn't work, we can only use our
crystal balls... Do you get an exception or only different results as
you have expected?
> helper context EPK!Event def: id : String =
> if self.Event.id = '1' then
> 'StartEvent'
> else
> '1'
> endif;
Without knowing the EPK metamodel, the self.Event.id looks a bit
suspicious to me. Does the EPK!Event class have an Attribute id? If
yes, then this should most probably be "self.id".
And in that case, I'm not sure if defining an attribute helper with a
name equal to an attribute is a good idea.
I'm no ATL expert, but I'm interested what would happen then? Would ATL
prefer the helper over the attribute in rules, i.e. I could redefine
attributes using attribute helpers?
And how about using "id" in the "id" helper? Would that be a (infinite)
recursion, or is the id attribute used? And using id from other
helpers: attribute or helper?
Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03528 seconds