[rules-users] problems with Otherwise()

Mark Proctor mproctor at codehaus.org
Tue Aug 7 20:51:05 EDT 2007


Otherwise() was removed, I wasn't happy with the implementation, heh 
wasn't even aware that anyone was using it. Sorry.

Mark
Matt Geis wrote:
> 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
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   




More information about the rules-users mailing list