[rules-users] Adding attributes to RUles in decision tree
Hi Everyone, Can any one please suggest in which cell the XOR-GROUP can be entered while creating a rules using decision table (excel sheet) ? I have been looking at the documentation and it states that XOR-GROUP is is keyword and can be added. However it doesn't really tells in what cell (row,column) can attributes pertaining to a rule(like agenda, activation groups, xor-group, name) can be entered. Logically it should be some where at the row level but I can not figure out where it should be put. Any help or directions will be appreciated. TIA, Saurabh ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Re: [rules-dev] Can't execute rules twice with a second classloader
can you make an integration test for us? As we'll need to be easily able to reproduce this. We'll add it to our code base and fix. We'll probably add it as aprt of the MiscTest class: http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java Aaron Dixon wrote: I am trying to sequentially perform two rules executions using two different classloaders in the same VM. I create completely new state for each execution, yet I still fail on the second execution. I believe this has to do with some internal static cached state that JBossRules is maintaining. A snippet of the code and exeception are shown in this email. public void demo() throws Exception { // Save original classloader ClassLoader original = Thread.currentThread().getContextClassLoader(); // Create Classloader 1 with parent of original FooClassLoader loader1 = new FooClassLoader(original); Thread.currentThread().setContextClassLoader(loader1); testRules(); // Success so far... // Create Classloader 2 with parent of original FooClassLoader loader2 = new FooClassLoader(original); Thread.currentThread().setContextClassLoader(loader2); testRules(); // Never make it to here. // Restore Thread.currentThread().setContextClassLoader(original); } private void testRules() throws Exception { PackageBuilder builder = new PackageBuilder(); Package pkg = buildPackage(new String[] { Foo.drl }, builder); RuleBase base = RuleBaseFactory.newRuleBase(); base.addPackage(pkg); StatelessSession session = base.newStatelessSession(); final ClassLoader loader = Thread.currentThread().getContextClassLoader(); Object inst = loader.loadClass(com.foo.Foo).newInstance(); session.execute(new Object[] { inst }); } Exception in thread main java.lang.ClassCastException: adixon.prototype.rules.classloader.demo.copy.FooShadowProxy at org.drools.base.adixon.prototype.rules.classloader.demo.copy.Foo$getName.getValue(Unknown Source) at org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:94) at org.drools.base.evaluators.StringFactory$StringEqualEvaluator.evaluate(StringFactory.java:85) at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:61) at org.drools.rule.LiteralConstraint.isAllowed(LiteralConstraint.java:82) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:121) at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:20) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:159) at org.drools.reteoo.Rete.assertObject(Rete.java:175) at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190) at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:584) at org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:63) at adixon.prototype.rules.classloader.demo.copy.Driver.testRules(Driver.java:47) at adixon.prototype.rules.classloader.demo.copy.Driver.go(Driver.java:33) at adixon.prototype.rules.classloader.demo.copy.Driver.main(Driver.java:17) ___ rules-dev mailing list [EMAIL PROTECTED] https://lists.jboss.org/mailman/listinfo/rules-dev ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Problem with Drools IDE (Eclipse)
I attempted to send this last night, but didn't see it show up to the user list so I'm going to try again, I apologize if this was sent more than once. When I attempt to open several views (Working Memory, Agenda, Global, etc) within an JBoss Rules enabled Eclipse, I receive the following error: java.lang.NoClassDefFoundError: org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextListener at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:161) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:501) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:471) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:430) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:413) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189) at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:408) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:161) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:501) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:471) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:430) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:413) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189) at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:408) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:289) at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227) at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1269) at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160) at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:788) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243) at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51) at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:235) at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:69) at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:327) at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:227) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:592) at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2077) at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1018) at org.eclipse.ui.internal.WorkbenchPage.access $18(WorkbenchPage.java:999) at org.eclipse.ui.internal.WorkbenchPage$19.run(WorkbenchPage.java:3666) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3663) at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3639) at org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHandler.java:165) at org.eclipse.ui.handlers.ShowViewHandler.openOther(ShowViewHandler.java:109) at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:77) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:239) at
Re: [rules-users] Rule compilation errors under heavy load
I think I've alread fixed this in trunk - when dealing with add/removing stuff I now do a block syncronisation on the pkgs instance. If that test is clean, we should add it to the list of integration tests, to track regressions. Mark Edson Tirelli wrote: Dean Thanks, we will investigate that asap. []s Edson 2007/7/12, Dean Jones [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: Hi Edson, On 7/12/07, Edson Tirelli [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Is it possible for you to provide a test case capable of reproducing the problem? I've written a quick test case, which is attached. When numberOfThreads==1, everything compiles okay. When numberOfThreads==100, I get function compilation errors and CompileExceptions from mvel. Clearly there is nothing shared between these threads as a new test class is created per thread. If you synchronise the calls to addPackage() and getPackage() using the class monitor i.e. synchronized (DroolsLoadTest.class) { builder.addPackage(packageDescr); builder.getPackage(); } then the problems go away. Hope this helps. At the same time, I would suggest you to not follow such approach in your application. Compilation is an extremely heavy process and should not be done for each request. The ideal approach is to pre-compile (for instance, we have a contributed ant-task for that) and serialize your rulebase to your database or filesystem, or at least, compile it only once and cache it at runtime. That's very sensible advice. Our situation is slightly different as users are allowed to change the rules used by a running service, so we need to reflect any changes when a new request comes in. We are planning to apply caching if performance is an issue, but we were trying to assess performance of application under load when this thread safety issue arose. Thanks for your help, Dean. ___ rules-users mailing list rules-users@lists.jboss.org mailto: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 http://www.jboss.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] Complex validation logic for hierarchies with Drools
Please do! We will all thank you. Regarding checking all the conditions in the LHS, that's what the engine does best, so always avoid ifs in the RHS... in the LHS they get indexed, shared, hashed, etc, whenever possible, improving the performance of the whole system. []s Edson 2007/7/13, Oleg Yavorsky [EMAIL PROTECTED]: Edson, Thank you very match. I've found a lot of ideas from your response. I didn't think about moving all conditions to LHS first and planned to use LHS only as a filter to find object to validate in RHS. I'll try to implement prototype and share experience in a list if you don't mind. Oleg. *Edson Tirelli [EMAIL PROTECTED]* wrote: Oleg, As I mentioned to you, it is perfectly fine and easy to use the rules engine to validate your object tree as long as you instruct your users that they must write structured rules. What I mean is: as much as DSL templates allow you to write rules that resemble natural language, it is not really natural language. The main advice is to group objects and attributes together. So, instead of writing the rule as: 3. ServiceDescription contained inside ClientService with type BRONZE should has status ACCEPTED They need to write the rule as: 3. If there is a ClientService whose type is BRONZE and a ServiceDescription contained inside it whose status is different of ACCEPTED then report error As you can see, all the constraints/attributes are listed right after each object type. The above rule can be translated to: rule 3. Validate status for BRONZE when There is a ClientService - whose type is BRONZE There is a ServiceDescription - contained inside it - whose status is different of ACCEPTED then report error end As you can see, the rule definition is very close to the actual rule, if you take the appropriate care when writing it, having the attribute/constraints right after each object type. Now, the DSL mapping will transform the above rule into: rule 3. Validate status for BRONZE when cs : ClientService( type == BRONZE ) sd : ServiceDescription( this memberOf cs.children, status != ACCEPTED ) then # report error end When you try to extrapolate the above example to your real business example, to make your DSL template completely generic, you may find the need to explain to your users the concept of variable though. So, what he would do is actually name each of your objects. Example (replace X and Y for any identifier that makes sense for the user): 3. If there is a ClientService named X whose type is BRONZE and a ServiceDescription name Y contained inside X whose status is different of ACCEPTED then report error If the user names each object, it will be much easier to write generic templates, since your rule would become: rule 3. Validate status for BRONZE when There is a ClientService named X - whose type is BRONZE There is a ServiceDescription named Y - contained inside X - whose status is different of ACCEPTED then report error end And the DSL would translate that to: rule 3. Validate status for BRONZE when X : ClientService( type == BRONZE ) Y : ServiceDescription( this memberOf X.children, status != ACCEPTED ) then # report error end I don't think that it is too hard to explain to users that they need to name each of his objects and this adds a great flexibility to the rules when adding constraints between objects of the same type. The final (and hardest) problem you will face is that you mentioned that your objects may be any level deep inside each other and you want to abstract that from users. In this case I see only 2 options: 1. The first option is do what you are already doing and create a helper function that goes deep a hierarchy checking for the existence of the relationship. 2. The second option is to create a relationship object that will flatten your tree structure transforming it in a pure relational structure. This is a very common solution used in databases that do not support hierarchy queries. The idea is that you create an object with attributes parent, child and optionally the level (distance) between each other, and you assert a copy of it for each related object in your object hierarchy (in computational theory we call this set of objects the result of the transitive closure calculation). The result is really a trade-off between memory and query time. You need to check if for your use case, the performance gains and expressiveness flexibility pays off the memory cost. Hope it helps. []s Edson 2007/7/12, Oleg Yavorsky [EMAIL PROTECTED]: Hi. I've got a lot of domain objects represented as instances of classes generated from XSD using Castor. My goal is to implement validation framework for whole tree which contains complex when conditions (see bellow). Furthermore, rules definitions should be very easy for unexperienced user to change so I need DSL. Now I use reflection
Re: [rules-users] Re: Using JDK dynamic proxies as facts
Chris, I'm thinking about using dynamic proxies in my rules too. I'll be glad to hear about your success with them. I think that there could be problem with matching of facts as they won't be of original class but of Proxy$... one. CGLIB approach doesn't have such problem as it just modifies original classes' bytecode. I could be wrong, anyway. Oleg. Mark Proctor [EMAIL PROTECTED] wrote:That is not the only thing that determines shadowing. If you look the shadowing is actually determined here: if ( !ruleBase.getConfiguration().isShadowProxy() || cls == null || !ruleBase.getConfiguration().isShadowed( cls.getName() ) ) { return; } By default shadowing is turned on for all (none final) bjects, except stuff in the org.drools namespace, you have to set exclusion lists.too. So if your package has a null namespace it will still attempt to shadow it. Mark Chris West wrote: OK, I just solved my own problem. My proxy had no package, since the jdk based proxy is only in a package if it has at least 1 non public interface, according to the javadoc. The suspect code beginning on line 333 is: String pkgName = cls.getPackage().getName(); if ( org.drools.reteoo.equals( pkgName ) || org.drools.base.equals( pkgName ) ) { // We don't shadow internal classes this.shadowEnabled = false; return; } The getPackage() method returns null. In this case, it would be good if JBoss Rules handled the null and went on to shadow the object anyway, since it is obviously not in the org.drools packages. Now I'll continue trying to build a test case for my original problem. Shall I enter a JIRA for this issue? Thanks, -Chris West On 7/12/07, Chris West [EMAIL PROTECTED] wrote: Hello, I'm trying to use objects that are generated as dynamic proxies (through the java.lang.reflect.Proxy class) as facts in JBoss Rules 4.0 MR3. My project was using CGLib to generate proxies, and they were working just fine in 3.0.6. However, when I tried 4.0, the CGLib based proxies seemed to have a final method that kept the proxies from being proxied as shadow facts. So I rewrote my code to try to use JDK based proxies, and version 4.0 MR3 accepts them and apparently creates shadow facts, but now my rules don't fire correctly. So, in an attempt to create a simple program to illustrate the problem, I ran into a different problem. The attached eclipse project illustrates this problem. The error is: java.lang.NullPointerException at org.drools.reteoo.Rete$ObjectTypeConf.init(Rete.java:333) at org.drools.reteoo.Rete.assertObject(Rete.java:152) at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190) at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772) at org.drools.common.AbstractWorkingMemory.insert (AbstractWorkingMemory.java:584) at com.sample.DroolsTest.main(DroolsTest.java:42) Has anyone successfully used JDK based dynamic proxies as facts? Thanks, -Chris West - ___ 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 - Вы уже с Yahoo!? Испытайте обновленную и улучшенную Yahoo! Почту!___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rule compilation errors under heavy load
Hi Mark, On 7/13/07, Mark Proctor [EMAIL PROTECTED] wrote: I think I've alread fixed this in trunk - when dealing with add/removing stuff I now do a block syncronisation on the pkgs instance. If that test is clean, we should add it to the list of integration tests, to track regressions. I just tried running my test against a build from the trunk (after faffing around with maven for a while) and I still get varying numbers of mvel exceptions and function compilation errors. Dean. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem with Drools IDE (Eclipse)
Good Afternoon, Unfortunately, Drools eclipse plugin isn't compatible with Eclipse Europa ( 3.3 ), try using 3.2 instead. Regards. Fernando Meyer http://fmeyer.org [EMAIL PROTECTED] PGP: 0xD804DDFB On Jul 13, 2007, at 10:28 AM, Eric Miles wrote: I attempted to send this last night, but didn't see it show up to the user list so I'm going to try again, I apologize if this was sent more than once. When I attempt to open several views (Working Memory, Agenda, Global, etc) within an JBoss Rules enabled Eclipse, I receive the following error: java.lang.NoClassDefFoundError: org/eclipse/debug/internal/ui/ contexts/provisional/IDebugContextListener at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass (DefaultClassLoader.java:161) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass (ClasspathManager.java:501) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl (ClasspathManager.java:471) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImp l(ClasspathManager.java:430) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass (ClasspathManager.java:413) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClas s(DefaultClassLoader.java:189) at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass (BundleLoader.java:340) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInterna l(BundleLoader.java:408) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass (BundleLoader.java:369) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass (BundleLoader.java:357) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass (DefaultClassLoader.java:83) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass (DefaultClassLoader.java:161) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass (ClasspathManager.java:501) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl (ClasspathManager.java:471) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImp l(ClasspathManager.java:430) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass (ClasspathManager.java:413) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClas s(DefaultClassLoader.java:189) at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass (BundleLoader.java:340) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInterna l(BundleLoader.java:408) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass (BundleLoader.java:369) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass (BundleLoader.java:357) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass (DefaultClassLoader.java:83) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass (BundleLoader.java:289) at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass (BundleHost.java:227) at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass (AbstractBundle.java:1269) at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExe cutableExtension(RegistryStrategyOSGI.java:160) at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableE xtension(ExtensionRegistry.java:788) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutab leExtension(ConfigurationElement.java:243) at org.eclipse.core.internal.registry.ConfigurationElementHandle.createEx ecutableExtension(ConfigurationElementHandle.java:51) at org.eclipse.ui.internal.WorkbenchPlugin.createExtension (WorkbenchPlugin.java:235) at org.eclipse.ui.internal.registry.ViewDescriptor.createView (ViewDescriptor.java:69) at org.eclipse.ui.internal.ViewReference.createPartHelper (ViewReference.java:327) at org.eclipse.ui.internal.ViewReference.createPart (ViewReference.java:227) at org.eclipse.ui.internal.WorkbenchPartReference.getPart (WorkbenchPartReference.java:592) at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2077) at org.eclipse.ui.internal.WorkbenchPage.busyShowView (WorkbenchPage.java:1018) at org.eclipse.ui.internal.WorkbenchPage.access$18 (WorkbenchPage.java:999) at org.eclipse.ui.internal.WorkbenchPage$19.run(WorkbenchPage.java: 3666) at org.eclipse.swt.custom.BusyIndicator.showWhile (BusyIndicator.java:67) at org.eclipse.ui.internal.WorkbenchPage.showView (WorkbenchPage.java:3663) at org.eclipse.ui.internal.WorkbenchPage.showView
[rules-users] negation for matches
Folks, How can I negate the matches?, like for those that don't match certain criteria do that I tried something like this but it doesn't work: rule SupplierView: Supplier code's first two characters should be numeric. when $s : SupplierView(!(suppCode matches \\d\\d.*)) then ValidationErrorFacade.getInstance().registerError($s, new ValidationError(Supplier code's first two characters should be numeric.)); end Thanks, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer.___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] negation for matches
You can try: $s : SupplierView(suppCode not matches \\d\\d.*) From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manukyan, Sergey Sent: Friday, July 13, 2007 4:49 PM To: Rules Users List Subject: [rules-users] negation for matches Folks, How can I negate the matches?, like for those that don't match certain criteria do that I tried something like this but it doesn't work: rule SupplierView: Supplier code's first two characters should be numeric. when $s : SupplierView(!(suppCode matches \\d\\d.*)) then ValidationErrorFacade.getInstance().registerError($s, new ValidationError(Supplier code's first two characters should be numeric.)); end Thanks, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] negation for matches
If you are using MR3 or later, the correct syntax is not matches. Before this version, you must use a predicate. []s Edson 2007/7/13, Manukyan, Sergey [EMAIL PROTECTED]: Nope .. it doesn't work either…. -- *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Sarika Khamitkar *Sent:* Friday, July 13, 2007 5:06 PM *To:* Rules Users List *Subject:* RE: [rules-users] negation for matches You can try: $s : SupplierView(suppCode not *matches* \\d\\d.*) -- *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Manukyan, Sergey *Sent:* Friday, July 13, 2007 4:49 PM *To:* Rules Users List *Subject:* [rules-users] negation for matches Folks, How can I negate the matches?, like for those that don't match certain criteria do that I tried something like this but it doesn't work: *rule* SupplierView: Supplier code's first two characters should be numeric. *when* $s : SupplierView(!(suppCode *matches* \\d\\d.*)) *then* ValidationErrorFacade.getInstance().registerError($s, *new*ValidationError(Supplier code's first two characters should be numeric.)); *end* Thanks, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. ___ 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] how to create local variable
Or what about having a rule that creates the substring? Class SupplierCode { private String code; private SupplierView parent; public SubString(SupplierView parent, String code) { this.code = code; this.parent = parent; } public String getCode() { return this.code; } public SupplierView getParent() { return this.parent; } } rule suppliercode when $sv : SupplierView( $sc : suppCode ) then insert(new SupplierCode($sv, $sc.substring(4, 6))); end rule main when $sv : SupplierView(corporate == true) $sc : SupplierCode( code in ('25, '30'), parent == $cs ) then ValidationErrorFacade.getInstance().registerError($cs, new ValidationError(Headquarter Supplier Code should end on 25 or 30.)); end This way you are also making the business rule as to what supplier codes to accept a Drools rule (and no use of eval!) (Sorry, a boring day at work and I felt an urge to contribute!) Mike From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manukyan, Sergey Sent: 12 July 2007 21:40 To: Rules Users List Subject: RE: [rules-users] how to create local variable Thank you Edson, I liked the solution with matches, it is much cleaner -Sergey From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli Sent: Thursday, July 12, 2007 4:19 PM To: Rules Users List Subject: Re: [rules-users] how to create local variable It is not possible to assign the result of an arbitrary method call to a variable right now. So, your best option is probably to do (please note the use of inline-eval): rule SupplierView: Headquarter Supplier Code should end on 25 or 30. when $cs : SupplierView(corporate == true, eval( suppCode.substring(4, 6).equals( 25 ) || suppCode.substring(4, 6).equals( 30 ) ) ) then ValidationErrorFacade.getInstance().registerError($cs, new ValidationError(Headquarter Supplier Code should end on 25 or 30.)); end A more clean solution is to use matches operator. If your rule states that Supplier Code must END with 25 or 30, you can do: rule SupplierView: Headquarter Supplier Code should end on 25 or 30. when $cs : SupplierView(corporate == true, suppCode matches .*25 || matches .*30 ) then ValidationErrorFacade.getInstance().registerError($cs, new ValidationError(Headquarter Supplier Code should end on 25 or 30.)); end Hope it helps. []s Edson 2007/7/12, Manukyan, Sergey [EMAIL PROTECTED]: Folks, I have a rule where I am repeating part of it twice : ($cs.getSuppCode().substring(4, 6)), and I would like to replace it with variable... how can I do that? The solution with in doesn't worl because it is a java code needed to perform calculations for variable. Please see the rule below: rule SupplierView: Headquarter Supplier Code should end on 25 or 30. when $cs : SupplierView(corporate == true) eval($cs.getSuppCode().substring(4, 6) == 25 || $cs.getSuppCode().substring(4, 6) == 30) then ValidationErrorFacade.getInstance().registerError($cs, new ValidationError(Headquarter Supplier Code should end on 25 or 30.)); end Thanks, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users --
Re: [rules-users] How to know the number of rules fired?
with JSR94 only you are screwed, its a useless spec, don't use it. With normal Drools, just use an AgendaEventListener. Mark Diouf Mouhamed wrote: Hi all, I have a little problem: I'm using the JSR94 and I want to know, at the end of an execution, the number of the rules fired? My second question is using only JBoss rules how can I know this number (without using JSR94). Thanks, Mouhamed Diouf ___ 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