[rules-users] Nested Collect probably

Wolfgang Laun wolfgang.laun at gmail.com
Tue May 27 00:42:51 EDT 2014


It's not possible to use the conditional element "or" inside an
accumulate. (Reading up on the "or" CE should give you an idea why.)
And that's why I
used a boolean expression as a constraint within the third pattern.

-W

On 26/05/2014, Chris B <sunnycal99 at gmail.com> wrote:
> Actually it is a event from an application usecaseThanks for your reply and
> I
> think I am very close with your help.This rule is giving error Line 99:5
> mismatched input 'or' in rule "usecase-test"]rule "usecase-test"    when
> $e0 : Event ()    ParsedValue(event == $e0, ruleId == "0", varName ==
> "V0_1", $e0_V0_1_varStringValue : varStringValue)    ParsedValue(event ==
> $e0, ruleId == "0", varName == "V0_2", $e0_V0_2_varStringValue :
> varStringValue)    accumulate(     ParsedValue( ruleId == "0", varName ==
> "V0_1",  varStringValue == $e0_V0_1_varStringValue, $e : event )     and
>
> ParsedValue( event == $e, ruleId == "0", varName == "V0_2", varStringValue
> == $e0_V0_2_varStringValue )     and     (    	(    		ParsedValue( event ==
> $e, ruleId == "1", varName == "V1_1", varStringValue == "X1_1")    		and
> 	
> ParsedValue( event == $e, ruleId == "1", varName == "V1_2", varStringValue
> == "X1_2")    	)    	or *[<    	(    		ParsedValue( event == $e, ruleId ==
> "2", varName == "V2_1", varStringValue == "X2_1")    		and
> 		ParsedValue(
> event == $e, ruleId == "2", varName == "V2_2", varStringValue == "X2_2")
>
> )    );    $es: collectSet( $e );     $es.size() >= 5 )     	then
> System.out.println( "usecase-test" + $es.size());endThe Event comes from
> application and is parsed for values.The event from same application will
> have the same values for ruleId=0, varName-V0_1 and V0_2So any event with
> same values for V0_1 and V0_2 is coming from same application.The rule says
> if from same applicationyou have values which has this combinationruleId ==
> "1", varName == "V1_1", varStringValue == "X1_1"ruleId == "1", varName ==
> "V1_2", varStringValue == "X1_2"or this combinationruleId == "2", varName
> ==
> "V2_1", varStringValue == "X2_1"ruleId == "2", varName == "V2_2",
> varStringValue == "X2_2"or this combination sayruleId == "3", varName ==
> "V3_1", varStringValue == "X3_1"ruleId == "3", varName == "V3_2",
> varStringValue == "X3_2"ruleId == "3", varName == "V3_3", varStringValue ==
> "X3_3"In pure english it isFirst I have to identify if I am dealing with
> events from same applicationThis is by comparing (2) parsed values V0_1 and
> V0_2. If they are same across events .. then it having same source.Next
> lets
> check for other conditions..From Rule 1.. I want to check values of V1_1
> and
> V1_2, if there is a issueFrom Rule 2.. I want to check values of V2_1 and
> V2_2, if there is a issueNow I do not want to raise exception as soon as
> condition is met.. since the problem can occur and can be ignored. But if
> it
> happens more than 5 times from the same source, then I want to raise an
> alert.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Nested-Collect-probably-tp4029681p4029703.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list