See inline.
Does the rule fire when you comment out either "exists" conditional element,
On 15/06/2014, Poissy.B <poissy.b@gmail.com> wrote:
> 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:
i.e., it doesn't matter which one is removed?
Which Drools version are you using?
-W
I can't say that a display of fact type "Products" is clearly indicating the
>
> **************************
> ** 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
> **************************
presence of an ItemAwareElementAdapter. That said, the rule shouldn't
fire even with a single "exists", so I assume this is an interface implemented
by Products.
_______________________________________________
>
> >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
>
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users