Variables in technical rules
You can define variables in the condition part of a technical
rule and use it subsequently.
when
{
?x: Fish(color==yellow; type==angel);
}
then
{
retract ?x;
insert Fish(yellow, shark);
}
The presence of the ?x variable at the beginning
of the condition serves as a marker, which identifies any object that
matches this condition. You can then refer to the matched object in
other conditions or in the action part of the rule. Consequently,
when the first action asks for the removal of the object referenced
by the ?x rule variable, the yellow angel fish object
is removed from the set of objects provided to the rule engine for
execution.