[rules-users] Drools 6.x and Custom Operators(Evaluators) and Accumulators - Using them as regular functions?

Mark Proctor mproctor at codehaus.org
Tue Aug 5 17:24:46 EDT 2014


you no longer need to declare custom accumulators, instead they are specified via imports. See docs, notice the “import” bit.

http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html/DroolsLanguageReferenceChapter.html#d0e6601

7.8.3.7.4.1. Accumulate CE (preferred syntax)
….

The code for the function is very simple, as we could expect, as all the "dirty" integration work is done by the engine. Finally, to use the function in the rules, the author can import it using the "import accumulate" statement:

import accumulate <class_name> <function_name>
For instance, if one implements the class some.package.VarianceFunction function that implements thevariance function and wants to use it in the rules, he would do the following:

Example 7.77. Example of importing and using the custom "variance" accumulate function

import accumulate some.package.VarianceFunction variance

rule "Calculate Variance"
when
    accumulate( Test( $s : score ), $v : variance( $s ) )
then
    // the variance of the test scores is $v
end

On 5 Mar 2014, at 23:13, mattmadhavan <mmadhavan at facs.org> wrote:

> Hello,
> I am still suck on Drools 5.4/5.5 since I have issues with Custom
> operators/Evaluators in 5.6.
> 
> I am not able to move to Drools 6.x because the spring configuration is
> screwed up. There is no option to configure Custom operator/Evaluators in
> kie-spring.
> 
> Looks like I just cannot move to 6.x because most of my rules are highly
> dependent on the Custom operator/evaluator I created!
> 
> I am mighty confused.
> 
> Any ideas?
> 
> Thanks
> Matt
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-6-x-and-Custom-Operators-Evaluators-and-Accumulators-Using-them-as-regular-functions-tp4028543p4028553.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140805/e04a10c3/attachment-0001.html 


More information about the rules-users mailing list