[rules-users] Testing for non-existance of an object in list

Wolfgang Laun wolfgang.laun at gmail.com
Sun Aug 4 04:05:59 EDT 2013


The rule is correct, and it works with similar scenarios.There may be
a bug, due to circumstances. Can you post a simple but complete set of
files to reproduce this?

-W

On 03/08/2013, Joe Ammann <joe at pyx.ch> wrote:
> Hi all
>
> I'm still struggling with the handling of lists and membership in the
> LHS of rule. I'm trying to formulate a rule that only fires if a certain
> object is not yet a member of a list.
>
> Here's what I currently have (Drools 5.5.0 btw):
>
>     rule "R2030: UpdateDQAttribute"
>     dialect "mvel"
>     agenda-group "PROCESS_CHECKRESULTS"
>     when
>         pv : PriceViolation ( p : changedPrice.price, dqc : check )
>         ps : PriceSeries ( id == p.seriesId )
>         i : Instrument ( id == ps.instrument.id )
>         dqa : DQAttribute ( rootId == i.id, objectId == p.id )
>         not dqcv : DQCheckViolation ( check.id == dqc.id ) from
>     dqa.checkViolations
>     then
>         # debug
>         for (DQCheckViolation dqcv : dqa.checkViolations) {
>             logger.debug("dqc: {}, dqcv: {}", dqc.id, dqcv.check.id);
>
>         }
>     end
>
> The rule fires and the log statement produces
>
>     PriceCheck: dqc: 6fc6636b-9b7c-4302-bce7-1680eec57830, dqcv:
>     6fc6636b-9b7c-4302-bce7-1680eec57830
>
> The ids are the same, so I would have expected that last LHS condition
> to avoid that the rule fires.
>
> --
> CU, Joe
>
>


More information about the rules-users mailing list