[rules-users] constraints and shadow facts

Benoit VILLAUMIE bvillaumie at karavel.com
Thu Aug 21 07:56:48 EDT 2008


Hello,

I am using drools 4.0.7 with eclipse 3.3 plugin, and JVM 1.6.0_04-b12

I am a drools beginner and I first try to implement basics rules.

I have faced a very strange behaviour I don't understand. Below the use 
case & rules :
----------------------------------------
Rules
----------------------------------------

    package poc

    import poc.FlashFact;

    *rule "always"*
        when
            $f : FlashFact()
        then
            System.out.println("*** always ... "+$f);
    end

    *rule "one (eval)"*
        when
            $f : FlashFact()
            eval($f.getHomepage().equals("one"))
           
        then
            System.out.println("*** one (eval) ... "+$f);
    end

    *rule "one (==)"*
        when
            $f : FlashFact(homepage == "one")
        then
            System.out.println("*** one (==) ... "+$f);
    end

----------------------------------------
Use Cases
----------------------------------------
I insert 2 FlashFact instances (one with homepage == "one", another with 
"dummy")

when I lauch the rules (without shadows proxy), the output is :

*** one (eval) ... poc.FlashFact[one]
*** always ... poc.FlashFact[one]
*** always ... poc.FlashFact[dummy]

/*=> I don't understand why rule one(==) is not fired ?*/

when I lauch the rules (with shadow proxy), the output is :

*** one (==) ... poc.FlashFact[one]
*** one (eval) ... poc.FlashFact[one]
*** always ... poc.FlashFact[one]
*** always ... poc.FlashFact[dummy]

The == and eval does not behave the same way with/without shadow proxy.

Moreover, I have run the State example provided with Drools in my 
workspace and it worked fine (== without shadow proxy).

Can someone has a deep understanding of this difference of behaviour ?

Thanks for your reply.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080821/436c6c98/attachment.html 


More information about the rules-users mailing list