[rules-users] Negation semantics in Drools

Edson Tirelli tirelli at post.com
Thu Apr 16 22:54:02 EDT 2009


   Ha, thanks a lot Greg. I need new glasses... he is actually comparing
with the parameter "second", but when creating the win fact, using the
parameter "first".

not Win(first == m.second)
  insert(new Win(m.first));

   Yes, in this case the engine is working exactly as it should.

   Anyway, I added the (fixed) test case to the codebase, just in case. :)

   Thanks,
       Edson

2009/4/16 Greg Barton <greg_barton at yahoo.com>

> You don't have to worry.  The engine is acting as it should.
>
> The rule Paul had was this, a bit simplified for clarity:
>
> rule "direct"
> when
>    m : Move()
>    not Win(first == m.second)
> then
>        insert(new Win(m.first));
> end
>
> If the insertion order is [Move(1,2), Move(2,3)] then the rule matches
> first on Move(2,3) and Win(2) is inserted.  No other rule fires because now
> Move(1,2) and Win(2) match up, removing the instantiation with Move(1,2)
> from the agenda.
>
> If the insertion order is [Move(2,3), Move(1,2)] then the order is this:
>
> matched Move(1,2) insert Win(1)
> matched Move(2,3) insert Win(2)
>
> The insertion of Win(1) in the first firing does NOT prevent the
> instantiation with Move(2,3) from then firing.
>
> So it's all good. :)  Sample code and output attached.
>
> --- On Thu, 4/16/09, Greg Barton <greg_barton at yahoo.com> wrote:
>
> > From: Greg Barton <greg_barton at yahoo.com>
> > Subject: Re: [rules-users] Negation semantics in Drools
> > To: "Rules Users List" <rules-users at lists.jboss.org>
> > Date: Thursday, April 16, 2009, 8:50 PM
> > It is on the latest snapshot release,
> > 5.0.0.20090417.005612-483
> >
> > --- On Thu, 4/16/09, Edson Tirelli <tirelli at post.com>
> > wrote:
> >
> > >     We need to investigate if that is still happening
> > in
> > > latest trunk.
> >
> >
> >
> > _______________________________________________
> > 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
 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/20090416/da995cb0/attachment.html 


More information about the rules-users mailing list