Download Automated transformations from ECA rules to Jess

Transcript
5.2.5.
Transition to Expression
As shown in Section 4.1.3, Transitions can be mapped to Expressions in different ways,
depending on the type of the Transition. Below we show the mapping used to transform
Transitions that have type “Changed” (i.e., they trigger when the event or the negation of the
event happens).
Because in Jess the OR operator is a function, we also output a Function in our Jess model.
This is possible, because Function inherits from Expression.
lazy rule TransitionChanged2Function
{
from
ecadl_transition : MMECADL!Transition
(ecadl_transition.type = 'Changed')
to
jess_function : MMJess!Function
This mapping is one-to-many. A Transition of type ‘Changed’ is transformed to form a
Function, which contains both the event and the negation of the event.
(
name <- 'or',
value <- '',
expression <- Sequence
{
thisModule.Expression2Expression(
ecadl_transition.expression),
jess_function_neg
}
),
jess_function_neg : MMJess!Function
(
name <- 'not',
value <- '',
expression <thisModule.Expression2Expression(ecadl_transition.expression)
)
}
43