[rules-users] Re: Pattern matching

Edson Tirelli tirelli at post.com
Tue Feb 19 07:36:49 EST 2008


   Done in trunk too:

http://jira.jboss.com/jira/browse/JBRULES-1472

   []s
   Edson

2008/2/18, Edson Tirelli <tirelli at post.com>:
>
>
>    This is fixed on 4.0.x branch. I will fix in trunk.
>
>    []s
>    Edson
>
> 2008/2/8, Edson Tirelli <tirelli at post.com>:
> >
> >
> >    Ok, I see the problem. It is a bug that happens when mixing alpha and
> > beta constraints under ||.
> >    I will fix it.
> >
> >    []s
> >    Edson
> >
> >
> >
> > 2008/2/8, Jai Vasanth <jaivasanth at gmail.com>:
> > >
> > > Sorry... eval(reason == 'override')  is not the right way to check for
> > > string equality doh. Yes yours is definitely the way to go. I have had the
> > > '==' work for many cases. In this case it seems to be not working when
> > > there are multiple boolean disjunctions along with them.
> > >
> > > Jai
> > >
> > > On Feb 8, 2008 8:52 AM, Jai Vasanth <jaivasanth at gmail.com> wrote:
> > >
> > > > Very interesting. I tried it too , I dont think its about the '=='
> > > > because it seems to be working for eval( reason == 'override'). So it is
> > > > more to do with having the eval method call.
> > > > Nice find. Not too sure if this is a bug, or if there is a reason
> > > > why drools works this way.
> > > >
> > > >
> > > > Thanks
> > > >
> > > > Jai
> > > >
> > > >
> > > > On Feb 7, 2008 5:43 PM, ST <super_thunder2 at hotmail.com> wrote:
> > > >
> > > > > I got it working by using the inline eval expression.  The
> > > > > following is the
> > > > > modified version of the rules.
> > > > >
> > > > > rule "Remove smaller or non-overriden"
> > > > >    dialect "java"
> > > > >    when
> > > > >        L : Response( $r : value && status != "override" )
> > > > >        Response(  value > $r || eval (status.equals("override")) )
> > > > >    then
> > > > >        System.out.println("Retracting " + L);
> > > > >        retract( L );
> > > > > end
> > > > >
> > > > > The Response class has two fields one is value and the other is
> > > > > status.  For
> > > > > convenience, I added a constructor where the first parameter is
> > > > > the value and
> > > > > the second is the status.  I have added the following objects into
> > > > > the working
> > > > > memory for testing.
> > > > >
> > > > >        final Response response1 = new Response(5,"override");
> > > > >        final Response response2 = new Response(6,"not override");
> > > > >        final Response response3 = new Response(7,"not override");
> > > > >        final Response response4 = new Response(8,"not override");
> > > > >        session.insert( response1 );
> > > > >        session.insert( response2 );
> > > > >        session.insert( response3 );
> > > > >        session.insert( response4 );
> > > > >
> > > > >        session.fireAllRules();
> > > > >
> > > > > The result shows that the object, Response(5,"override"), is the
> > > > > only one left
> > > > > after the all activated rules have been evaluated.
> > > > >
> > > > > I am not sure why "==" does not work in this example.  Is this a
> > > > > known bug?
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > rules-users mailing list
> > > > > rules-users at lists.jboss.org
> > > > > https://lists.jboss.org/mailman/listinfo/rules-users
> > > > >
> > > >
> > > >
> > >
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> >
> >
> > --
> >   Edson Tirelli
> >   JBoss Drools Core Development
> >   Office: +55 11 3529-6000
> >   Mobile: +55 11 9287-5646
> >   JBoss, a division of Red Hat @ www.jboss.com
>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   Office: +55 11 3529-6000
>   Mobile: +55 11 9287-5646
>   JBoss, a division of Red Hat @ www.jboss.com
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080219/d3beacb5/attachment.html 


More information about the rules-users mailing list