[rules-users] Testing for non-existance of an object in list
Joe Ammann
joe at pyx.ch
Sat Aug 3 16:59:41 EDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130803/b8ba206f/attachment.html
More information about the rules-users
mailing list