member$ and create$ were used for creation of multifield value (see here member$)(set-fact-duplication TRUE)slot definition - the domain of slots can be set by using (allowed-values). However listing of all values from range e.g. [18, 120] is inefficient.accumulate CE and thus it is fired one instead of several times (for each base-modifier fact).allowed-type can be defined using JAVA enum types.(pop-focus). However, this construct can be approximately simulated in drools using lock-on-active property which prevents rule, with this property set to true, from firing until their agenda-group will not loose a focus. In comparison to (pop-focus) this property does not remove focus from the current module and thus other rules can also be fired after rule having this property set to true.(create$) function, can be represented using Java collections (sometimes such rules must be expressed in java dialect): (create$ 160 60 0 -10 -20 -30 -40 -40 -50 -50 -60)
Java:
List<Integer> modifiers = Arrays.asList(160, 60, 0, -10, -20, -30, -40, -40, -50, -50, -60);
CLIPS or Jess: (focus base-charge bonus-malus base-charge-modifiers)
and corresponding code in Drools:
ksession.getAgenda().getAgendaGroup("base-charge-modifiers").setFocus(); ksession.getAgenda().getAgendaGroup("base-charge").setFocus(); ksession.getAgenda().getAgendaGroup("bonus-malus").setFocus(); ksession.getAgenda().getAgendaGroup("initial").setFocus();
Nevertheless, this can be done only within the Java file. In order to provide more more reliable translation from CLIPS/Jess to Drools the above setup of focus stack can be translated in the following way:
agenda-group (e.g. initial) on the focus stack.agenda-group only one rule is defined - LHS-less rule that asserts all the initial facts. Such rule corresponds to deffacts CLIPS/Jess construct.drools.setFocus("base-charge-modifiers"); drools.setFocus("base-charge"); drools.setFocus("bonus-malus");
the order of the agenda-grop names must be reversed in comparison to the order of the names within deffacts construct.
accumulate CE and thus it is fired one instead of several times (for each base-modifier fact).