Hi,
Thanks for taking the time to read this.
I have a number of activated rules. The first of these rules to fire includes a function call which includes a query iteration. However, the subsequent rules in the conflict set (i.e. the subsequent activated rules) fire before the query call completes. This behavior is best illustrated by an example:
Jess> (run 1)
FIRE 1 MAIN::rule_1 f-6
==> f-7 (MAIN::__query-trigger-myQuery)
FIRE 1 MAIN::rule_2 f-5, f-6
If the firing is left to run then the query will eventually return
<== f-7 (MAIN::__query-trigger-myQuery)
but only after all other activated rules have fired.
My problem is that rule_2 depends upon the result of firing rule_1, and causes an illegal operation (division by 0) as a result of rule_1 not returning first.
I am able to circumvent this by having an extra fact asserted by rule_1, which rule_2 needs i.e. :
(defrule rule_1 .... =>
(callQuery) (assert (foo)))
(defrule rule_2 ... (foo) => ...)
In this case, since rule_2 can only be activated after the query has returned, it works...it does seem an illogical way of doing things though.
The release notes do mention something about the run-query command executing 'run(10)' - but this does not explain why subsequent rules don't fire after the query returns.
Is there something that i'm missing here?
Thanks in advance,
Pol
Yahoo! Mail - For a better Internet experience