Thank you for the quick answer! This makes absolutely sense and the rules work now as
expected.
Unfortunately, I was not able to find this somewhere in the documentation. It would be
nice to see it in the documentation of drools fusion.
Best,
Wolfgang
Von: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] Im
Auftrag von Wolfgang Laun
Gesendet: Montag, 16. Jänner 2012 15:58
An: Rules Users List
Betreff: Re: [rules-users] Problem with Negative Patterns and Temporal Constraints
I don't see that the "not" CE excludes the AnalysisCue bound to $cue from
being
matched by the pattern inside the "not". I recommend using
not(AnalysisCue(this != $cue, this after[0ms,2500ms] $cue) from
since "[0ms,..." does not inhibit the same event being matched by both
patterns,
which precludes the rule from firing.
-W
2012/1/16 Weiss, Wolfgang
<Wolfgang.Weiss@joanneum.at<mailto:Wolfgang.Weiss@joanneum.at>>
Hi all!
We have the problem that the following rule never fires:
rule "test-rule"
agenda-group "evaluation"
salience 100
when
$cue : AnalysisCue() from entry-point "LowLevelCueStream"
not(AnalysisCue(this after[0ms,2500ms] $cue) from entry-point
"LowLevelCueStream")
then
logger.debug("... some message ..");
end
We found out that the problem is the combination of the negation with the conditional
element "not" and the temporal constraint "[0ms,2500ms]". Using the
temporal operator "this after $cue" without a temporal constraint works correct
in its semantics.
Interestingly, when adding a constraint (cueType == 1) to the type in the negative pattern
the rule begins to work. The rule would look like as follows:
rule "test-rule"
agenda-group "evaluation"
salience 100
when
$cue : AnalysisCue() from entry-point "LowLevelCueStream"
not(AnalysisCue(cueType == 1, this after[0ms,2500ms] $cue) from entry-point
"LowLevelCueStream")
then
logger.debug("... some message ..");
end
unfortunately the rule then fires with a delay of 4 to 5 seconds. The second parameter of
the temporal constraint influences the delay.
When changing the first parameter of the temporal constraint to a value greater than 0 the
rule works as expected! The constraint would then look like as follows: "[1ms,
2500ms]". Whereas in our case, we want to evaluate the time window from 0 - 2500ms.
Our system works in the stream mode and we could reproduce this behaviour with the
versions 5.3.1 and 5.4.0 Beta 1.
Can anybody confirm if this is a bug in Drools, or did I overlook here something?
Best regards,
Wolfgang Weiss
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users