Re: [rules-users] rule limit
On 6 October 2011 01:09, Davide Sottara dso...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
For an even less technical solution you could have a person with a big stick standing behind the users... I think what we are all wondering is why you want to limit the number of rules! Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: 06 October 2011 08:14 To: Rules Users List Subject: Re: [rules-users] rule limit On 6 October 2011 01:09, Davide Sottara dso...@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-tp3394660p339 8277.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
The author gets paid (by slyfox (!)) according to the number of rules ;-) -W On 6 October 2011 10:24, Swindells, Thomas tswinde...@nds.com wrote: For an even less technical solution you could have a person with a big stick standing behind the users... I think what we are all wondering is why you want to limit the number of rules! Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: 06 October 2011 08:14 To: Rules Users List Subject: Re: [rules-users] rule limit On 6 October 2011 01:09, Davide Sottara dso...@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-tp3394660p339 8277.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
thanks for all of the responses, fun to read :) Sorry I thought it was pretty strait forward question. I would assume somehow the parser 'knows' how many rules are in a drl file I do not want an over ambitious user to just create rule after rule after rule (though I suppose he could technically do a lot even in one rule) rule a //1 when then end rule b //2 when then end rule c //3 when then end and so on... -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-rule-limit-tp3394660p3400312.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
Am 06.10.2011 18:48, schrieb slyfox: thanks for all of the responses, fun to read :) Sorry I thought it was pretty strait forward question. I would assume somehow the parser 'knows' how many rules are in a drl file I do not want an over ambitious user to just create rule after rule after rule (though I suppose he could technically do a lot even in one rule) You probably can't prevent him from doing it first hand. But when it comes to compiling/loading the rules, you can of course check the number of rules and issue an error message if it exceeds your limit. See answer by Davide Sottara for technical details. However I'm still not convinced that this rather technical measure will make your life easier in the long run. Still having the impression that educating the user of your system to find a useful structure in their rules will pay off more than just putting up road closed signs. Best regards Ansgar ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
is this something I missed in the doc or would you mind pointing me in the direction of how to accomplish this? thanks Bobby -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-rule-limit-tp3394660p3398077.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
Hi Slyfox, nice to read you. Am 05.10.2011 23:49, schrieb slyfox: is this something I missed in the doc As you are talking about the doc, it seems you have a particular part of the solution already in mind (the product/tool you'd like to use to enforce the size limit). Up to now, you did not describe these ideas anywhere. If you really expect anyone to help you, please let us know your actual use case and what you have thought up so far. It is simply not possible to find a quality answer in reasonable time without this knowledge -- finding the correct answer would involve a lot of guessing what you *really* want to know and then answering the guessed question(s). When asking a very broad question like can it be done, the best you can expect to get is a very broad answer (Yes, it can be done in this case). or would you mind pointing me in the direction of how to accomplish this? If you give more details on what you're trying to *achieve*, I promise to give it a try. If not, oh well, ehm, let me put it like this: as you're certainly storing the file on some media like a hard disk which cannot be unlimited in capacity, the file it holds is also implicitly limited in the number of rules in that file. Of course, this is absolutely not the answer you were looking for, but hey, how can one know better with that little information you gave first hand? It's all good, and I'd really like to help you, but please please please allow me and the fellow list members to get a clue what problem you're actually trying to solve. Describe what you're trying to build, how the problem you're experiencing surfaced, maybe what you already tried to solve it, how you think a rule number limit could solve your problem, these sorts of things. Best regards Ansgar ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
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 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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
On 06/10/2011 00:09, Davide Sottara 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 Maybe someone can design a Rube Goldberg machine to address this? Mark 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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] rule limit
Is it possible to limit the number of rules in a drl file? Thanks, Bobby ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rule limit
Am 04.10.2011 23:27, schrieb Bobby Richards: Is it possible to limit the number of rules in a drl file? Yes. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users