RE: [rules-users] generalize a rule in security.drl file
The use of regular expressions in your pattern match would help. rule GeneralisedRestrictAccessClient when check : PermissionCheck( name matches /*Edit.xhtml, action == render ) then check.grant(); end You'd best check the RegEx syntax though! Cheers, Mike _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mohamed Mhissen Sent: 08 November 2007 09:26 To: rules-users@lists.jboss.org Subject: [rules-users] generalize a rule in security.drl file I use restrictions to control access to my pages. In my security.drl file, I have : Code: rule RestrictAccessClientEdit when check: PermissionCheck(name == /ClientEdit.xhtml, action == render) Role(name == admin) then check.grant (); rule RestrictAccessOrderEdit when check: PermissionCheck(name == /OrderEdit.xhtml, action == render) Role(name == admin) then check.grant(); end; I want to generalize this restriction so to apply it to all pages publishing: *Edit.xhtml I tried like that : Code: check: PermissionCheck(name == /*Edit.xhtml, action == render) Any help would be very welcome, Thanks, -- Mohamed Mhissen [EMAIL PROTECTED] +33.6.65.04.28.79 smime.p7s Description: S/MIME cryptographic signature ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] inconsistency with 'collect' and the '||' operator
This looks like a bug. Can you please open a JIRA and attach a self contained test you are using to reproduce the problem? This helps us to speed up getting the solution. Thanks, Edson 2007/11/7, Adrian Cowham [EMAIL PROTECTED]: I'm running into an issue where the || operator embedded in a collect isn't working as expected. My collect statement is as follows... $request : AccessRequest($name : username, $ID : sessionID, $loc : accessLocation, $day : dayOfAccess) $locationRules : ArrayList(size 0) from collect (AccessRule((allowedLocation == ANY || allowedLocation == $loc)) from $group.getRules()) I don't get comilation or runtime errors but I don't the expected behavior either. That is, I don't get the intersection of AccessRules that have allowedLocation equal to ANY or allowedLocation equal to the bound $loc variable. Instead, the empty set is returned. When I modify the rule to look like $request : AccessRequest($name : username, $ID : sessionID, $loc : accessLocation, $day : dayOfAccess) $locationRules : ArrayList(size 0) from collect (AccessRule(allowedLocation == $loc)) from $group.getRules()) I get the expected output. However, when I modify the rule to look like $request : AccessRequest($name : username, $ID : sessionID, $loc : accessLocation, $day : dayOfAccess) $locationRules : ArrayList(size 0) from collect (AccessRule((allowedLocation == ANY)) from $group.getRules()) ...it returns the empty set even though there are rules that have allowedLocation set to ANY (i confirmed this by debugging my java code). I haven't seen any documentation that uses the collect statement this way but according to my understanding of the grammer this should work. For some reason the allowedLocation == ANY embedded in the collect isn't working. What's interesting to note is that the following rule works flawlessly (notice the absence of the collect statement)... rule test when # does the user that just requested access exist in a group $request : AccessRequest($name : username, $ID : sessionID, $loc : accessLocation, $day : dayOfAccess) $rule : AccessRule(allowedLocation == ANY || allowedLocation == $loc, allowAccess == true) then System.out.println(Test passed); end Any help on the matter would be greatly appreciated. Thanks. a ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] multiprocessor and performance
Mario, Each working memory executes single threaded and as such will use only one processor. As long as you have each of your requests creating a working memory (ideally from a shared pre-loaded/pre-compiled rulebase) and executing in a separate thread, it should be using all your processors. What I mean is, drools does not constrain/limit processor use... can you double check that you have the requests running concurrently, each on its own thread, or provide us a test case so that we can verify if there is any problem in drools causing this behavior? Thanks, Edson 2007/11/8, Mario [EMAIL PROTECTED]: Hi all, I've got a fairly simple web application with DRools 4.0.3 deployed on a Tomcat 5.5, where I'm running a stress test of about 100 users doing fact changes every half a second. There are about 20 rules and about 20 facts. Each action loads and compiles the rule base, creates a new working memory and creates the facts inside it. I know it's not efficient (rules should be loaded only once in the application, working memory should be created only once in the session) but that's not my question. This is a 4-way machine. 1. if I don't load and use drools, the web application uses all 4 processors 2. if drools does the above mentioned work, only ONE processor is used, at about 100% CPU. Does it make sense that way? Do I have to set anything so the other processors are used as well? Otherwise, I'd have a general performance question: is it more efficient to empty the WM (one fact at a time) each time many facts need to be reloaded, or just drop it and create it again? I'm talking about some 200 facts, and a few hundred rules. Thanks a lot, M ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] multiprocessor and performance
Hi all, I've got a fairly simple web application with DRools 4.0.3 deployed on a Tomcat 5.5, where I'm running a stress test of about 100 users doing fact changes every half a second. There are about 20 rules and about 20 facts. Each action loads and compiles the rule base, creates a new working memory and creates the facts inside it. I know it's not efficient (rules should be loaded only once in the application, working memory should be created only once in the session) but that's not my question. This is a 4-way machine. 1. if I don't load and use drools, the web application uses all 4 processors 2. if drools does the above mentioned work, only ONE processor is used, at about 100% CPU. Does it make sense that way? Do I have to set anything so the other processors are used as well? Otherwise, I'd have a general performance question: is it more efficient to empty the WM (one fact at a time) each time many facts need to be reloaded, or just drop it and create it again? I'm talking about some 200 facts, and a few hundred rules. Thanks a lot, M ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RE: rules-users Digest, Vol 12, Issue 16
Sikkandar, regard a rule-semaphore as a guard: It's a variable which you use on left hand side of rules: rule 1 when Guard g other conditions then RHS end You can set the semaphore in any other rule to control which other rules you want to disable or enable... (If you need background on semaphores, have a look in Operating- Systems literature) regards, Gernot Am 08.11.2007 um 08:40 schrieb Sikkandar Nawabjan: am sorry i understand partially. i don't know to use semaphores to control rule. can you give some example Message: 4 Date: Wed, 07 Nov 2007 20:23:05 + From: Mark Proctor [EMAIL PROTECTED] Subject: Re: [rules-users] RE: How to stop firing rules from dependent object To: Rules Users List rules-users@lists.jboss.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 you'll have to setup rules that detect the state of the working memory that then uses semaphores to control which rules can fire. Mark Sikkandar Nawabjan wrote: Hi, I have 2 Objects and its corresponding drl/dsls to validate the rule ObjectA - A.drl,A.dsl ObjectB - B.drl,B.dsl when i insert ObjectA i want the rules in A.drl to be fired. when i insert ObjectB along with ObjectA i want to fire rules only from B.drl There are some rule in B.drl requires ObjectA.so i need to insert always ObjectA with ObjectB. At the same time i don't want the rule from A.drl How to do that? Thanks and Regs, Basha Sikkandar Basha Tech Lead WPEPDS UST Globalhttp://intranet.ustri.com/email/UST-logo.jpg B5N 144, Bhavani Technopark, Trivandrum, India [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] global.com T: +91-471-2335777 Extn: 6802036 M: +91-9946555330 F: +91-471-2527276 From: [EMAIL PROTECTED] on behalf of rules-users- [EMAIL PROTECTED] Sent: Thu 11/8/2007 5:21 AM To: rules-users@lists.jboss.org Subject: rules-users Digest, Vol 12, Issue 16 Send rules-users mailing list submissions to rules-users@lists.jboss.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.jboss.org/mailman/listinfo/rules-users or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of rules-users digest... Today's Topics: 1. inconsistency with 'collect' and the '||' operator (Adrian Cowham) 2. Re: inconsistency with 'collect' and the '||' operator (Adrian) 3. RE: Combine DSL and Java Code? (Raj, Govinda (Mohan)) 4. Re: RE: How to stop firing rules from dependent object (Mark Proctor) 5. Re: inconsistency with 'collect' and the '||' operator (Mike D) 6. Re: Combine DSL and Java Code? (Edson Tirelli) -- Message: 1 Date: Wed, 7 Nov 2007 10:35:17 -0800 From: Adrian Cowham [EMAIL PROTECTED] Subject: [rules-users] inconsistency with 'collect' and the '||' operator To: rules-users@lists.jboss.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 I'm running into an issue where the || operator embedded in a collect CE isn't working as expected. The rule I have is rule Grant Access when $request : AccessRequest($name : username, $ID : sessionID, $loc : accessLocation, $day : dayOfAccess) $user : NetworkUser(username == $name) $group : UserGroup(users contains $user) $locationRules : ArrayList(size 0) from collect (AccessRule((allowedLocation == ANY || allowedLocation == $loc), allowAccess == false) from $group.getRules()) then # access granted end The issue I'm having is with AccessRule((allowedLocation == ANY || allowedLocation == $loc), allowAccess == false), this translate to all access rules that have the allowed location set to ANY or set to the location the user is logging in from. I created a UserGroup named super.users that contains a user named root and a single rule that allows access from ANY location. However, when I simulate a login with root -- next part -- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/ 20071107/451e832f/attachment-0001.html -- Message: 2 Date: Wed, 7 Nov 2007 19:53:36 + (UTC) From: Adrian [EMAIL PROTECTED] Subject: [rules-users] Re: inconsistency with 'collect' and the '||' operator To: rules-users@lists.jboss.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Adrian Cowham adrian.cowham at gmail.com writes: I'm running into an issue where the || operator embedded in a collect CE isn't working as expected. The rule I have is rule Grant Access when $request :
[rules-users] generalize a rule in security.drl file
I use restrictions to control access to my pages. In my security.drl file, I have : *Code:* rule RestrictAccessClientEdit when check: PermissionCheck(name == /ClientEdit.xhtml, action == render) Role(name == admin) then check.grant(); rule RestrictAccessOrderEdit when check: PermissionCheck(name == /OrderEdit.xhtml, action == render) Role(name == admin) then check.grant(); end; I want to generalize this restriction so to apply it to all pages publishing: *Edit.xhtml I tried like that : *Code:* check: PermissionCheck(name == /*Edit.xhtml, action == render) Any help would be very welcome, Thanks, -- Mohamed Mhissen [EMAIL PROTECTED] +33.6.65.04.28.79 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] generalize a rule in security.drl file
Hi Mohamed! Mohamed Mhissen wrote: I use restrictions to control access to my pages. [...] rule RestrictAccessClientEdit when check: PermissionCheck(name == /ClientEdit.xhtml, action == render) Role(name == admin) then check.grant (); [...] I want to generalize this restriction so to apply it to all pages publishing: *Edit.xhtml I tried like that : *Code:* check: PermissionCheck(name == /*Edit.xhtml, action == render) You can do this with the matches operator (cf. Drools manual section 6.5.2.1.1.3.1., Matches Operator), e.g., like this: check: PermissionCheck(name matches ^\/.*Edit\.xhtml$, action == render) HTH, Christian ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RuntimeDroolsException: Unable to load
Hello Edson, Frankly, I wouldn't spend a lot of time on this. The alternate approach is to inject the working memory into the Seam component as described in the docs. Assuming that works (which I'm sure it will), then there's no reason to use the approach I was attempting. Let me mess with it today, and I'll let you know. Once again, thanks for everyone's help. -robert. On Nov 7, 2007, at 8:50 AM, Edson Tirelli wrote: Robert. Fernando is taking a look in that. []s Edson ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RuntimeDroolsException: Unable to load
Hello, I downloaded Seam 2.0.0.GA, built the drools example (it's a simple number guess application). It fails exactly the same way. I'm guessing the Seam guys tested this before releasing, so I'm assuming (as Edson pointed out) a JVM issue with Mac OS X Leopard? On Nov 8, 2007, at 6:57 AM, Robert Morse wrote: Hello Edson, Frankly, I wouldn't spend a lot of time on this. The alternate approach is to inject the working memory into the Seam component as described in the docs. Assuming that works (which I'm sure it will), then there's no reason to use the approach I was attempting. Let me mess with it today, and I'll let you know. Once again, thanks for everyone's help. -robert. On Nov 7, 2007, at 8:50 AM, Edson Tirelli wrote: Robert. Fernando is taking a look in that. []s Edson ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Can a rule be assigned both agenda-group and ruleflow-group ?
Hi everybody: I would like to use Drools to capture validation logics that will be shared at UI level and back-end level. That is, I need to fire a specific rule on-demand to validate a field input and fire it again as part of the final validation. To fire a specific rule, I use the agenda-group attribute. To fire it again as part of a larger group, I then try to create a ruleflow. I found that if I add a ruleflow-group to a rule, it's can no longer be fired by setFocus(). Is that normal, or I did something wrong? I thought of creating a ruleflow for each rule, but that sounds like a hack to me, Drools probably offer a more elegant solution (I'm only 2 wks into Drools). What is best way to implement my problem: to fire a rule individually and to fire it again as part of a group? TIA Linh -- View this message in context: http://www.nabble.com/Can-a-rule-be-assigned-both-agenda-group-and-ruleflow-group---tf4772952.html#a13653679 Sent from the drools - user 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] compound LHS error, getting Parser error. Contact Dev Team
I have a compound LHS statement that is causing the parser to fail. Here is my exact stacktrace: org.drools.compiler.DroolsParserException: Unknown error while parsing. This is a bug. Please contact the Development team. at org.drools.compiler.DrlParser.compile(DrlParser.java:183) at org.drools.compiler.DrlParser.parse(DrlParser.java:61) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:165) at com.kronos.webta.service.security.access.rules.WriteRestrictionsRulesTest.setUpBeforeClass(WriteRestrictionsRulesTest.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) This is the statement that is causing me problems: not(UserRole((role == Role.TIMEKEEPER, delegateFor == $supId) || (role == Role.SUPERVISOR, delegateFor == $tkpId)) from $actorRoles) Remote out one of the conditions from the ||, it compiles fine. Such as: not(UserRole(role == Role.SUPERVISOR, delegateFor == $supId) from $actorRoles) or not(UserRole(role == Role.TIMEKEEPER, delegateFor == $tkpId) from $actorRoles) Is my syntax incorrect or is there a bug? Thanks! ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools and BRMS (60,000+ rules)
Hello, I am wondering if anyone has any experience in managing very large rule sets and facts and could share their experiences in the design and management of this. We are embarking on a new Student Information System project here at UBC in conjunction with several other American universities. We have pretty much decided to use Drools as our rules engine and maybe also the Drools BRMS for our business rules management. Our first application is the course curriculum application/module where we will manage course co-requisites, pre-requisites, etc. and we estimate that we will have about 20,000 course rules. We currently have about 15,000 course rules (QuickRules) in production now. We will also have security rules, input/form validation rules, student awards rules, degree rules, enrolment rules, admission rules, student financial rules etc. which will total about 40,000 rules. So currently we are looking at managing about 60,000 rules (not including versioning). If we include versioning then there would probably be more than 100,000 rules. Example: A single course could have 10 or more rules per course version. We currently have about 2000 course and most courses have more than 1 version. We are looking into developing our own rules management system to define dependencies between rules, courses (facts) and course + rule versions. E.g. Course CHEM101 version 1 links to CHEM101 a single rule or a rule set/package version 1 by a rule id. We need the ability to notify users when rules are modified which impacts other rules and what impact changing a rule can cause for example a degree program. E.g. changing a course's pre-requisite may affect other courses' pre-requisites; rules about rules. We also need the ability to find out why a student was not able to register for a course etc. We will also need to show the course dependency graph visually (the RDBMS can probably help us here). Later, we are hoping to use the Drools Solver for course and exam scheduling and also to use it for student degree planning and student awards. We will need to translate the rules into English language syntax for publication in the course calendar and later into other languages (first French) since the SIS application will be used internationally. Listing requirements could just be shown in bulleted form. Probably can't use the DSL in this case since we would need to support several languages or maybe I am wrong here? If we use the Drools BRMS to store all of our rules on a relational database, will we be able to write SQL queries to get at specific rules/packages to link facts (courses) to rules? Or do we have to go through the BRMS to get at the rules. Does BRMS have a facility to validate rules against facts so you can see if your rules execute correctly against your data/facts before committing your rules. Or maybe we need a testing framework for this. Other issues are the performance of the Drools Solver and having thousands of rules compiled, loaded and running. During registration we could have thousands of rules executing concurrently. The rules engine and the BRMS would be services as part of an SOA infrastructure (and an OSGi service environment). Anyone got any experience with Drools in an OSGi environment with respect to class loading issues when compiling rules and facts from other bundles since rules and facts may be in different bundles? Bundle buddy class loading? Later, we will need translators to/from other rule engines; maybe ruleML and JCR can help us here. So far, I think Drools can do most of this; am I correct here? Does any of this sound plausible? Thanks very much for any tips, thoughts or comments. Len Len Carlsen Enrolment Services - Student Systems University of British Columbia ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RuntimeDroolsException: Unable to load -- Solved
Solved. Actually, Mark Proctor solved this several days ago when he asked if Seam came with its own Drools jars. It does. If you use the non-Seam bundled drools jars, you will get this exception. Sorry for wasting anyone's time on this, but I'm curiousany ideas what is different between the standard Drools distribution and what comes with Seam? On Nov 8, 2007, at 10:12 AM, Robert Morse wrote: Hello, I downloaded Seam 2.0.0.GA, built the drools example (it's a simple number guess application). It fails exactly the same way. I'm guessing the Seam guys tested this before releasing, so I'm assuming (as Edson pointed out) a JVM issue with Mac OS X Leopard? On Nov 8, 2007, at 6:57 AM, Robert Morse wrote: Hello Edson, Frankly, I wouldn't spend a lot of time on this. The alternate approach is to inject the working memory into the Seam component as described in the docs. Assuming that works (which I'm sure it will), then there's no reason to use the approach I was attempting. Let me mess with it today, and I'll let you know. Once again, thanks for everyone's help. -robert. On Nov 7, 2007, at 8:50 AM, Edson Tirelli wrote: Robert. Fernando is taking a look in that. []s Edson ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Rules for Hierarchical Type Calculation Formulas
We have been using a custom rules engine successfully for our 1000+ rules for our student loans application, but these rules are decision based types rules (if then else). For assessing loan amounts for our student loan application, we have over 400+ calculation formulas plus decision logic. These formulas are mostly simple: TotalEligilbleLoanAmount = Min(TotalNeed - TotalResource, MaxAllowedAmount) TotalNeed = Tuition + LivingAllowance + ChildCareExpenses ChildCareExpenses = NumberOfChildren * PerChildAmount TotalResource = EmploymentEarnings + Scholarships + Assets (however there are 400+ formulas and the hierarchy gets up to 20 deep) Is it possible to implement something like this in Drools? Will it be maintainable and performant? Thanks Don This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal, and or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users