[rules-users] Erratic behaviour of Drools

Wolfgang Laun wolfgang.laun at gmail.com
Sun Jun 15 15:59:00 EDT 2014


OK, it's a bug all right. 5.4.0 had some problems. It might be worth
trying a later 5.x version.
-W

On 15/06/2014, Poissy.B <poissy.b at gmail.com> wrote:
> Yes it does fire if I comment either of them, and I get the exact same
> response.
>
> I am using Drools 5.4.0.Final runtime.
>
> Actually Products is the name property of an object of type
> DataObjectReference (wich implements ItemAwareElementAdapter). The point of
> providing the output was just to show you that the
> List<ItemAwareElementAdapter> returned by both getGivenResources() and
> getReceivedResources() is indeed not empty so the "exists" constraint
> should have been matched.
>
> Thanks!
>
>
> On Sun, Jun 15, 2014 at 2:06 PM, Wolfgang Laun <wolfgang.laun at gmail.com>
> wrote:
>
>> See inline.
>>
>> On 15/06/2014, Poissy.B <poissy.b at 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
>> >
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>


More information about the rules-users mailing list