[rules-users] rule limit

Wolfgang Laun wolfgang.laun at gmail.com
Thu Oct 6 03:13:38 EDT 2011


On 6 October 2011 01:09, Davide Sottara <dsotty at gmail.com> wrote:
> As far as I know, the parser does not check the number of rules in a DRL
> Maybe you could do something like this:
>
> (i) use a KnowledgeBuilder to load the DRL resource;
> (ii) before you add the packages to the knowledgeBase, iterate over
> kBuilder.getKnowledgePackages() to find the package generated from your DRL;
> (iii) use getRules().size() on the package to check if the number of rules
> exceeds your desired threshold

This would limit the number of rules per package and not per DRL file.

Crude and not foolproof,  but very cheap is a bash oneliner:
     LIMIT=10; PATH=some.drl; if [ $(grep '^\s*rule\>' $PATH | wc -l)
-gt $LIMIT ]; then echo more than $LIMIT rules in $PATH; fi

-W


>
> D.
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/rules-users-rule-limit-tp3394660p3398277.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
>



More information about the rules-users mailing list