[rules-users] problems with Otherwise()
Matt Geis
mgeis at yahoo.com
Tue Aug 7 19:05:22 EDT 2007
I've got the following three rules in my DRL, but I'm seeing odd results.
rule "matchfound"
when
s : String()
then
System.out.println("got a match, string found in working memory");
end
rule "intmatchfound"
when
i : Integer()
then
System.out.println("got a match, Integer found in working memory");
end
rule "no matching rule"
when
Otherwise()
then
System.out.println("no rule applied, using otherwise rule");
end
If I assert a String, then the 'matchfound' rule fires. If I assert an Integer, 'intmatchfound' fires. If I assert an object of a different type or do not assert anything, the rule I would expect to fire ('no matching rule') never fires. The only way I can get it to fire is if I explicitly assert an instance of Otherwise.
I was under the impression that Drools would automatically assert it when it sees that no other rule has fired.
Am I doing something wrong here? Did usage of Otherwise change?
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC
More information about the rules-users
mailing list