[rules-users] Existensial not question
wasabifan
bryan.rickman at kewill.com
Wed Sep 19 09:38:53 EDT 2007
I have several rules I am working on that I am having problems implementing.
Most of our tests are composed of at least one "pass" and one "fail" rule.
Basically, there are some tests where exceptions need to be thrown based on
a date or number being inside a range where these exceptions occur (causing
a possible failure).
The problem is that we are testing several objects, so using the existensial
not, is problematic.
For example, in the pass, if we write:
rule "pass example"
when
Fact1($number : number)
not ExceptionRange(startRange <= $number, stopRange >= $number)
then
System.out.println("Pass" + $number);
end
For the fail, it would be like:
rule "fail example"
when
Fact1($number : number)
ExceptionRange(startRange <= $number, stopRange >= $number)
then
System.out.println("Fail" + $number);
end
Is there a way to rewrite the pass rule, so that it checks the existence of
a range satisfying each number from Fact1? If I understand not correctly,
it will either pass once, and only once if ANY range matches at least one
number from Fact1. Or it would pass for all Fact1's if any Fact1's match
any exception range.
A little clarification here would be appreciated, and if you know of a
workaround to actually test for getting exactly one and only one pass or
fail (exclusively) for each Fact1 asserted.
Thanks,
Bryan Rickman
--
View this message in context: http://www.nabble.com/Existensial-not-question-tf4481066.html#a12777641
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list