[rules-users] Large number of rules in Drools

Davide Sottara dsotty at gmail.com
Mon Jan 9 21:10:57 EST 2012


What Wolfgang was hinting at (assuming I understood correctly the thread of
the discussion) is the difference between a set of rules like this:

... 

rule "n-th test"
when
  $b : Bean( field == "x_n" )
then
  $b.setSomething( "y_n" )
end

...



and rule-base like this:

declare Holder
  selector : Object
  target : Object
  sal : int
end

rule "meta"
salience $sal
when
  $b : Bean( $f : field )
  Holder( selector == field, $tgt : target, $sal : sal )
then
  $b.setSomething( $tgt );
end

rule "init"
when
then
  // for j ...
  insert( new Holder( x[j], y[j], j ) );
end  



Of course, which approach is better would depend on the actual problem. If
you could share a few rules and highlight any patterns, that would be
helpful. 
For example, consider that one of the advantages of RETE-based systems is
the possibility to share evaluations between rules. 
So if your rules are all checking different fields for different values,
then maybe you should consider the latter approach.
Best
Davide

--
View this message in context: http://drools.46999.n3.nabble.com/Large-number-of-rules-in-Drools-tp3630385p3646521.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list