[rules-users] Erratic behaviour of Drools

Poissy.B poissy.b at gmail.com
Sun Jun 15 13:16:36 EDT 2014


Hello,

I am a little bit confused as I don't get what I am doing wrong. Here is my
rule:

**************************
rule "Exchange Pattern"
    when
        $p2: ProcessAdapter()
        $mainProcess: ProcessAdapter( isMainProcess(), this!=$p2)
        MessageFlowAdapter ( fromProcess == $mainProcess, toProcess==$p2)
        MessageFlowAdapter ( fromProcess == $p2, toProcess==$mainProcess)
        exists ItemAwareElementAdapter( ) from
$mainProcess.getReceivedResources($p2)
        exists ItemAwareElementAdapter( ) from
$mainProcess.getGivenResources($p2)
    then
        System.out.println("** FOUND EXCHANGE PATTERN betwwen
"+$mainProcess.getParticipant().getName()+" AND
"+$p2.getParticipant().getName());
        System.out.println("Given:
"+$mainProcess.getGivenResources($p2)+$mainProcess.getGivenResources($p2).size());
        System.out.println("Received:
"+$mainProcess.getReceivedResources($p2)+$mainProcess.getReceivedResources($p2).size());
        System.out.println("Intersection:
"+$mainProcess.intersectGivenAndReceivedResourcesWithProcess($p2)+$mainProcess.intersectGivenAndReceivedResourcesWithProcess($p2).size());
end
**************************

This rule is never fired, although I know it should.

When I comment out the ONE OF the two "exists" constraints, I get this
output:

**************************
** FOUND EXCHANGE PATTERN betwwen Amazon AND Ship.Comp.
Given: [Products (ID:DataObjectReference_2)]1
Received: [Products (ID:DataObjectRefeference_GEN7)]1
Intersection: [Products (ID:DataObject_2)]1
**************************

>From the output you can see that the rule should have been fired with the
two "exists" constrains as both conditions are met, but it doesn't.
I am kind of new to Drools so I may be doing an horrible mistake but google
haven't been my friend so far. Any help will be very appreciated!

Thanks.
Anis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140615/0a05e983/attachment.html 


More information about the rules-users mailing list