See inline.
On 15/06/2014, Poissy.B <poissy.b(a)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:
Does the rule fire when you comment out either "exists" conditional element,
i.e., it doesn't matter which one is removed?
Which Drools version are you using?
-W
**************************
** 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
**************************
I can't say that a display of fact type "Products" is clearly indicating
the
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