[rules-users] [Drools4]: Filter executed rules by *.drl file

Vincent Legendre vincent.legendre at eurodecision.com
Tue Jul 19 11:46:14 EDT 2011


In my opinion, for 300 drl files, the better is to use a specific KB for 
each DRL (or some KAgent).
This way you don't have to pollute your rules with control facts (and 
you can eventually re-use some part of DRL files into multiple context 
KB), and the RETE is tightened to the strict minimum (no eval of useless 
constraints).

Moreover, I am not sure if drools compiler can really handle some 
removal or addition of rules dynamically in a existing KB without having 
to recompile all rules (so keeping up-to-date a big KB can be costly).

If you (still) want to use your solution 1 (ie control facts), you can 
also use rule inheritance (which make a rule inherit the conditions of 
another "parent" rule, and the parent rule will contain the check on the 
control fact) :
  rule context-rule
       enabled false // this rule won't fire by itself
    when
          Context(task = "bar")
    then
          // not used anyway
  end

rule X extends context-rule
    when
         // specific conditions
    then
         // fired when specific conditions AND context-rule's conditions 
are met
end



More information about the rules-users mailing list