[rules-users] not sure if this is a bug of drools or my bad usage...

Edson Tirelli ed.tirelli at gmail.com
Mon Mar 7 23:25:56 EST 2011


   Simon,

   The behavior seems correct to me as B is justified by either A or C (or
both). Of course, from the initial state, A is required for C to first
exist, but once it starts to exist, your rules say that B and C justify each
other and so both remain in memory.

   This is design as intended, but do you think that is wrong?

   Edson

2011/3/7 Simon Chen <simonchennj at gmail.com>

> Hi all,
>
> An interesting finding:
>
> I have three simple rules:
> rule "A2B"
>        when
>                A()
>        then
>                insertLogical(new B());
> end
> rule "B2C"
>        when
>                B()
>        then
>                insertLogical(new C());
> end
> rule "C2B"
>        when
>                C()
>        then
>                insertLogical(new B());
> end
>
> Basically, once we have an A(), we'll logically insert a B(). Once we
> have a B(), we'll logically insert a C(). Once we have a C(), we'll
> logically insert a B().
>
> So, I first insert an A(), print all the objects. Retract A(), and
> print all the objects. Here's what I got:
> com.sample.B at 42
> com.sample.C at 43
> com.sample.A at 548997d1
> after retract!
> com.sample.B at 42
> com.sample.C at 43
>
> So, B() and C(), which should be logically depend on A(), somehow are
> not retracted. The problem I see is the truth maintenance system allow
> B() and C() to depend on each other, thus not affected by losing A().
>
> Is this a bug or my bad usage?
>
> Thanks.
> -Simon
> _______________________________________________
> 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 by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110307/f9065830/attachment.html 


More information about the rules-users mailing list