[rules-users] Executing more than one rules having no infinite execution
Hi, I have a simple rule as following: import java.util.HashMap; rule first when a : CrestelRuleModel( $hmap : singleHashMap!=null); then System.out.println(Old Map: + $hmap); HashMap mapp = new HashMap(); mapp.put(hello, world); a.setSingleHashMap(mapp); System.out.println(New Map: + a.getSingleHashMap()); update(a); end; When I invoke the rule from my client, the rule is executed infinitely. So, I have placed a drools.halt() before end statement of above rule. So, it stopped executing infinitely as I wanted. But is it a good practice? Now, I want my input to be filtered by two rules, so I have placed rules like following: import java.util.HashMap; rule first when a : CrestelRuleModel( $hmap : singleHashMap!=null); then System.out.println(Old Map: + $hmap); HashMap mapp = new HashMap(); mapp.put(hello, world); a.setSingleHashMap(mapp); System.out.println(New Map: + a.getSingleHashMap()); update(a); drools.halt(); end; rule second when b : CrestelRuleModel( $hmap2 : singleHashMap!=null); then System.out.println(Old Map2: + $hmap2); HashMap mapp2 = new HashMap(); mapp2.put(hello2, world2); b.setSingleHashMap(mapp2); System.out.println(New Map2: + b.getSingleHashMap()); update(b); drools.halt(); end; But in above case, only the second rule executes. What to do in order to execute both the rules without any infinite loop? Kindly share some pointers on this. Thanks. PS: CrestelRuleModel is my POJO model having following fields, public class CrestelRuleModel { private ArrayList arrayListOfHashMap; private HashMap singleHashMap; private Object object; private String remarks; //Getters and Setters } Best Regards Hushen Savani | Crestel Billing ecTag image001.png___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Executing more than one rules having no infinite execution
Using drools.halt() is not considered a good practice at all. I would recommend you to read this post: http://ilesteban.wordpress.com/2012/11/16/about-drools-and-infinite-execution-loops/ Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 8:59 AM, Hushen Savani hushen.sav...@elitecore.comwrote: Hi, ** ** I have a simple rule as following: ** ** *import java.util.HashMap;* * * *rule first* *when* * a : CrestelRuleModel( $hmap : singleHashMap!=null);* *then* * System.out.println(Old Map: + $hmap);* * HashMap mapp = new HashMap();* * mapp.put(hello, world);* * a.setSingleHashMap(mapp);* * System.out.println(New Map: + a.getSingleHashMap());* * update(a);* *end;* ** ** When I invoke the rule from my client, the rule is executed *infinitely*.* *** ** ** So, I have placed a “*drools.halt()*” before “*end*” statement of above rule. So, it stopped executing infinitely as I wanted. But *is it a good practice?* ** ** Now, I want my input to be filtered by *two rules*, so I have placed rules like following: ** ** *import java.util.HashMap;* * * *rule first* *when* * a : CrestelRuleModel( $hmap : singleHashMap!=null);* *then* * System.out.println(Old Map: + $hmap);* * HashMap mapp = new HashMap();* * mapp.put(hello, world);* * a.setSingleHashMap(mapp);* * System.out.println(New Map: + a.getSingleHashMap());* * update(a);* * drools.halt();* *end;* * * *rule second* *when* * b : CrestelRuleModel( $hmap2 : singleHashMap!=null);* *then* * System.out.println(Old Map2: + $hmap2);* * HashMap mapp2 = new HashMap();* * mapp2.put(hello2, world2);* * b.setSingleHashMap(mapp2);* * System.out.println(New Map2: + b.getSingleHashMap());* * update(b);* * drools.halt();* *end;* ** ** But in above case, *only the “second” rule executes*. What to do in order to execute both the rules without any infinite loop? ** ** Kindly share some pointers on this. Thanks. ** ** ** ** *PS*: *CrestelRuleModel* is my POJO model having following fields, * * *public* *class* CrestelRuleModel { *private* *ArrayList* arrayListOfHashMap; *private* *HashMap* singleHashMap; *private* Object object; *private* String remarks; ** ** //Getters and Setters ** ** } ** ** Best Regards *Hushen Savani* | Crestel Billing [image: ecTag] ** ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users image001.png___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] documentation on rules engine and planner
Op 07-12-12 08:29, Michiel Vermandel schreef: Hi, I would like to read some documentation on how the rules engine (specifically for planner) works. I have a number of unanswered questions. Some type of questions: - If I have two rules in my drl file, will the engine execute first the first rule with all possible combinations of the planning entities matching the conditions of the rule and then the second rule with all possible combinations of the planning entities matching the conditions of the rule the order depends on the rule agenda, see drools expert manual http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html - Can I trace which rules are executed with what planning-variables and in which order You can put System.out.println() in the RHS. Drools expert does not support TRACE logging to support this for you currently. If you would like this, vote for this issue: https://issues.jboss.org/browse/JBRULES-3702 - What is the purpose of the last variable amount of parameters ($x, $y, $z) in the RHS logic insertLogical(new IntConstraintOccurrence( ... , $x, $y ,$z)) Those "causes" is to keep Drools Expert's insertLogical's behaviour happy because an IntConstraintOccurrence's equals/hashcode is called so only 1 can be in the working memory. Basically, they explain what caused that part of the score. It's interesting if you want to use them to explain why a solution has a certain score. But, on the other hand, it's a PITA and I am working on an alternative that's easier to use and faster, once drools expert supports ChangeMatchListeners. In any case, it's a valid issue that the docs don't explain this causes thing. I know there is http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html but it does not really answer the above questions. Thanks, Michiel - http://www.codessentials.com - Your essential software, for free! Follow us at http://twitter.com/#!/Codessentials ___ 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] documentation on rules engine and planner
Thanks for the explanation, Geoffrey. I voted for https://issues.jboss.org/browse/JBRULES-3702 and I hope other users do so too. I think it can be very handy for less experienced users (like myself) to get to understand how things work. Concerning the You can put System.out.println() in the RHS., that only shows when the then part is invoked. Sometimes I add a dummy method invoked to my planning entity which always returns true and prints all data I want. I put this method as a condition in the LHS. Though that is no permanent solution as I do not want to clutter my rules with such dummy conditions. Regards, Michiel - http://www.codessentials.com - Your essential software, for free! Follow us at http://twitter.com/#!/Codessentials From: Geoffrey De Smet ge0ffrey.s...@gmail.com To: Michiel Vermandel mverm...@yahoo.com; Rules Users List rules-users@lists.jboss.org Sent: Friday, December 7, 2012 9:35 AM Subject: Re: documentation on rules engine and planner Op 07-12-12 08:29, Michiel Vermandel schreef: Hi, I would like to read some documentation on how the rules engine (specifically for planner) works. I have a number of unanswered questions. Some type of questions: - If I have two rules in my drl file, will the engine execute first the first rule with all possible combinations of the planning entities matching the conditions of the rule and then the second rule with all possible combinations of the planning entities matching the conditions of the rule the order depends on the rule agenda, see drools expert manual http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html - Can I trace which rules are executed with what planning-variables and in which order You can put System.out.println() in the RHS. Drools expert does not support TRACE logging to support this for you currently. If you would like this, vote for this issue: https://issues.jboss.org/browse/JBRULES-3702 - What is the purpose of the last variable amount of parameters ($x, $y, $z) in the RHS logic insertLogical(new IntConstraintOccurrence( ... , $x, $y ,$z)) Those causes is to keep Drools Expert's insertLogical's behaviour happy because an IntConstraintOccurrence's equals/hashcode is called so only 1 can be in the working memory. Basically, they explain what caused that part of the score. It's interesting if you want to use them to explain why a solution has a certain score. But, on the other hand, it's a PITA and I am working on an alternative that's easier to use and faster, once drools expert supports ChangeMatchListeners. In any case, it's a valid issue that the docs don't explain this causes thing. I know there is http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html but it does not really answer the above questions. Thanks, Michiel - http://www.codessentials.com - Your essential software, for free! Follow us at http://twitter.com/#!/Codessentials ___ 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] debug
Guys, Is there a fix coming for this issue? I do not see how we can use 5.5.0 core if the eclipse debugger does not work. The mvel workaround does not work for me. Even if it did, I wrote a load of java dialect rules for 5.3.0 which I don't want to rewrite. Please advise? Should I stay with 5.3.0? I really want to start our project with the latest greatest. Any thoughts welcome Regards, Kevin -- View this message in context: http://drools.46999.n3.nabble.com/debug-tp3889772p4021125.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] documentation on rules engine and planner
Michiel Vermandel píše v Pá 07. 12. 2012 v 01:35 -0800: I voted for https://issues.jboss.org/browse/JBRULES-3702 and I hope other users do so too. I think it can be very handy for less experienced users (like myself) to get to understand how things work. In my opinion, this makes no sense - or, rather, is a subset of something already implemented. See the KnowledgeRuntimeLogger, which will produce an audit log of agenda operations. (Which can even be browsed in a special editor in Eclipse.) The question remains, how to expose this in Planner - and it is indeed a valid question. But let's not duplicate already existing functionality - Drools has known to do this for a long time. -- Lukáš Petrovický QE Lead, JBoss Enterprise BRMS Phone: +420 532 294 123 irc: lpetrovi, triceo ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] documentation on rules engine and planner
Op 07-12-12 10:35, Michiel Vermandel schreef: Thanks for the explanation, Geoffrey. I voted forhttps://issues.jboss.org/browse/JBRULES-3702 and I hope other users do so too. I think it can be very handy for less experienced users (like myself) to get to understand how things work. Concerning the "You can put System.out.println() in the RHS.", that only shows when the "then" part is invoked. Sometimes I add a dummy method "invoked" to my planning entity which always returns true and prints all data I want. I put this method as a condition in the LHS. Though that is no permanent solution as I do not want to clutter my rules with such dummy conditions. That doesn't make much sense to try understand in which order the patterns match: Drools expert will try to optimize matching the patterns with as little as calls as possible. It's similar to trying to understand how many times HashSet calls equals() on the objects you add to it: quite a lot: it depends on load, bucket size, ... Regards, Michiel - http://www.codessentials.com - Your essential software, for free! Follow us at http://twitter.com/#!/Codessentials From: Geoffrey De Smet ge0ffrey.s...@gmail.com To: Michiel Vermandel mverm...@yahoo.com; Rules Users List rules-users@lists.jboss.org Sent: Friday, December 7, 2012 9:35 AM Subject: Re: documentation on rules engine and planner Op 07-12-12 08:29, Michiel Vermandel schreef: Hi, I would like to read some documentation on how the rules engine (specifically for planner) works. I have a number of unanswered questions. Some type of questions: - If I have two rules in my drl file, will the engine execute first the first rule with all possible combinations of the planning entities matching the conditions of the rule and then the second rule with all possible combinations of the planning entities matching the conditions of the rule the order depends on the rule agenda, see drools expert manual http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html - Can I trace which rules are executed with what planning-variables and in which order You can put System.out.println() in the RHS. Drools expert does not support TRACE logging to support this for you currently. If you would like this, vote for this issue: https://issues.jboss.org/browse/JBRULES-3702 - What is the purpose of the last variable amount of parameters ($x, $y, $z) in the RHS logic insertLogical(new IntConstraintOccurrence( ... , $x, $y ,$z)) Those "causes" is to keep Drools Expert's insertLogical's behaviour happy because an IntConstraintOccurrence's equals/hashcode is called so only 1 can be in the working memory. Basically, they explain what caused that part of the score. It's interesting if you want to use them to explain why a solution has a certain score. But, on the other hand, it's a PITA and I am working on an alternative that's easier to use and faster, once drools expert supports ChangeMatchListeners. In any case, it's a valid issue that the docs don't explain this causes thing. I know there is
Re: [rules-users] InvalidItemStateException while accessing Guvnor
On 2012/12/7 2:19, worldofprasanna wrote: Hi All .. We are getting the following error message in Guvnor when trying to access it. org.drools.repository.RulesRepositoryException: javax.jcr.InvalidItemStateException: property /drools:repository/drools:package_area/com.lsi.sort/assets/Lotting Guidelines/drools:content: the property cannot be saved because it has been modified externally. Hi, You get this error when one user tries to save the asset with changes while the asset has already been changed by another user. Cheers, Jervis This occurs in our production system and it is occurring rarely (So We couldn t reproduce it locally in our environment). But this issue is resolved when we restarted the Server in which the Guvnor app is running. But this is nearly impossible as this occurs in production system. We are using Oracle DB as our Persistent Manager (as seen in the attachment) and running the guvnor in clustered environment. I presume that the issue might be related to versioning in Guvnor ? If so can anyone guide us to solve this versioning problem ? Herewith attached the repository.xml file. Thanks in advance, Prasanna Venkataraman. repository.xml http://drools.46999.n3.nabble.com/file/n4021115/repository.xml -- View this message in context: http://drools.46999.n3.nabble.com/InvalidItemStateException-while-accessing-Guvnor-tp4021115.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] change polling interval of 60 seconds in KnowledgeBase
Hello, Is it possible to change the polling interval of 60 seconds in knowledgeAgent ? -- View this message in context: http://drools.46999.n3.nabble.com/change-polling-interval-of-60-seconds-in-KnowledgeBase-tp4021130.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] documentation on rules engine and planner
Op 07-12-12 10:45, Lukáš Petrovický schreef: Michiel Vermandel píše v Pá 07. 12. 2012 v 01:35 -0800: I voted for https://issues.jboss.org/browse/JBRULES-3702 and I hope other users do so too. I think it can be very handy for less experienced users (like myself) to get to understand how things work. In my opinion, this makes no sense - or, rather, is a subset of something already implemented. See the KnowledgeRuntimeLogger, which will produce an audit log of agenda operations. (Which can even be browsed in a special editor in Eclipse.) The question remains, how to expose this in Planner - and it is indeed a valid question. But let's not duplicate already existing functionality - Drools has known to do this for a long time. Good point that we shouldn't duplicate such functionality. But I would like to argue that KnowledgeRuntimeLogger is currently clunky to enable. To enable it is a programmatic change, not a configuration change. I would argue: every Logger should be able to be enabled through normal logging configuration (= logback.xml, log4j.xml, ...). Just like in any other framework (hibernate, weld, spring, ...) So maybe for 6.0, we can replace KnowledgeRuntimeLogger by normal logging? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] InvalidItemStateException while accessing Guvnor
I tried replicating this error.I got a valid error message *Unable to save this asset, as it has been recently updated.* Is there a way to replicate this?. I am not able to get this error in our stage environment Is there any way we can avoid this error (maybe some kind of a retry) Thanks Kannan -- View this message in context: http://drools.46999.n3.nabble.com/InvalidItemStateException-while-accessing-Guvnor-tp4021115p4021133.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] change polling interval of 60 seconds in KnowledgeBase
See the javadoc on org.drools.agent.KnowledgeAgentFactory for how to change the polling interval. -W On 07/12/2012, Bacem ghali.ba...@gmail.com wrote: Hello, Is it possible to change the polling interval of 60 seconds in knowledgeAgent ? -- View this message in context: http://drools.46999.n3.nabble.com/change-polling-interval-of-60-seconds-in-KnowledgeBase-tp4021130.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] change polling interval of 60 seconds in KnowledgeBase
Hi, Bacem: You can change the polling interval as follows: ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); sconf.setProperty( drools.resource.scanner.interval, 10 ); // set the disk scanning interval to 10s ResourceFactory.getResourceChangeScannerService().configure(sconf); Greetings, Adrian 2012/12/7 Wolfgang Laun wolfgang.l...@gmail.com See the javadoc on org.drools.agent.KnowledgeAgentFactory for how to change the polling interval. -W On 07/12/2012, Bacem ghali.ba...@gmail.com wrote: Hello, Is it possible to change the polling interval of 60 seconds in knowledgeAgent ? -- View this message in context: http://drools.46999.n3.nabble.com/change-polling-interval-of-60-seconds-in-KnowledgeBase-tp4021130.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 -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter http://twitter.com/epidata * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] IntelliFest - Learning the Reason for Failure to Match
Did this white paper ever get published at jboss.org? On 11/5/2012 1:10 PM, Wolfgang Laun wrote: A White Paper containing a similar sceenario (and other material) will be out soon on some RedHat/JBoss site. From: Wolfgang Laun wolfgang.l...@gmail.com mailto:wolfgang.l...@gmail.com To: Rules Users List rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org, Date: 11/05/2012 05:19 AM Subject: Re: [rules-users] DROOLs callback API for L-value predicatematching events Sent by: rules-users-boun...@lists.jboss.org mailto:rules-users-boun...@lists.jboss.org Learning the reason for failure to match is the title of a section in my boot camp you missed at this year's IntelliFest a couple of weeks ago. You are getting close to the solution, but here's the outline of the rule programming design pattern: Write one rule (high salience) to create an auxiliary fact (Aux), containing a reference to the fact under investigation (Crf) and a Set. Write one rule each, combining Aux and Crf, restricting the latter with one of the required property values/range. On the RHS, add an identification to the set component of Aux. DO NOT MODIFY/UPDATE. Write another rule (low salience) combining Aux and Crf and see what Aux contains in the Set. Retract Aux. -W On 05/11/2012, Cotton, Ben ben.cot...@morganstanley.com mailto:ben.cot...@morganstanley.com wrote: Could a solution be as simple as this? Is this approach to consuming LCHUS_IRS_CURRENCY_RULE L-value matching events sound/complete (and not-vulnerable to any race condition?). Is there any DROOLS EventListener callback API that would be more appropriate to solve the problem? E.g. I want to be able to log when each of these 5 L-value predicates either MATCHES or FAILS TO MATCH (at the time of the event) rule LCHUS_IRS_CURRENCY_RULE //XLS Item=195 when IRDCurrencyRuleFact( productType == IRS, currency==GBP, upfrontFeePaymentDate IRDCurrencyRuleFact.terminationDate, maturity = 18275, //unit = days, i.e. 50 Years notional = 99,999,999,999.99 //max Notional ) then System.out.println(LCHUS); end Again the objective is to be able to join a high-resolution logging capability wrt to which of the specific 5 L-value predicates matched. Instinctively, to this DROOLs newbie, this approach seems workable but not ideal rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_1 when IRDCurrencyRuleFact(productType == IRS) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 1 match); //log event L-value predicate 1 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_2 when IRDCurrencyRuleFact(currency==GBP) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 2 match); //log event L-value predicate 2 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_3 when IRDCurrencyRuleFact(upfrontFeePaymentDate IRDCurrencyRuleFact.terminationDate) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 3 match); //log event L-value predicate 3 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_4 when IRDCurrencyRuleFact(maturity = 18275) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 4 match); //log event L-value predicate 4 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_5 when IRDCurrencyRuleFact(notional = 99,999,999,999.99) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 5 match); //log event L-value predicate 5 matched end Ben D Cotton III Morgan Stanley Co. OTC Derivatives Clearing Technology 1221 AOTA Rockefeller Ctr - Flr 27 New York, NY 10020 (212)762.9094 tel:%28212%29762.9094 ben.cot...@ms.com mailto:ben.cot...@ms.commailto:ben.cot...@ms.com From: rules-users-boun...@lists.jboss.org mailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Cotton, Ben (ISGT) Sent: Saturday, November 03, 2012 8:24 AM To: rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org Cc: O'Brien, Patrick (ISGT) Subject: [rules-users] DROOLs callback API for L-value predicate matching events Hi, Can someone please point me to
[rules-users] A basic doubt about Drools Fusion
Hi all: I have a very basic doubt about Drools Fusion. I have two simple Java classes: EventA { String id; Date timestamp; Long duration; } EventB { String id; Date timestamp; Long duration; } I have a DRL file, where I declare this two classes as Events: declare EventA @role(event) @timestamp(timestamp) @duration(duration) end declare EventB @role(event) @timestamp(timestamp) @duration(duration) end I have a simple rule: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end Finally, I have a test that starts a StatefulKnowledgeSession in STREAM mode, register an eventLister in the session in order to fire the rules when an event arrives: ksession.addEventListener(new DefaultAgendaEventListener() { @Override public void activationCreated(ActivationCreatedEvent event) { ((StatefulKnowledgeSession) event.getKnowledgeRuntime()).fireAllRules(); } }); And then the test insert in the time stream entry-point an instance of EventA with duration of 10 miliseconds, as follows: EventA eventA = new EventA(); eventA.setId(123); eventA.setTimestamp(new Date()); eventA.setDuration(10L); ksession.getWorkingMemoryEntryPoint(time stream).insert(event); At the end of the test, I have an sleep of 2 seconds just in case. I don't understand why the Basic Rule never fires. But if I add another condition to the same rule, something like this: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream not EventB($aId == id, this after [0s,5s] $eventA) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end The rules fires and I see this message in console: Event A 123 at Fri Dec 07 09:48:59 ART 2012 I don't understand why the first rule, that is more open, don't fire, and the second rule, that is more restrictive, fires without problems. Thank you very much! Greetings, Adrian. -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter http://twitter.com/epidata * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] A basic doubt about Drools Fusion
It could be the case, and I'm guessing here, that the AgendaEventListener is called just before the activation is placed into the agenda. So, the call to fireAllRules() finds an empty agenda. What you could do to check if this is what is happening, is to insert 2 EvenA objects. The second call of fireAllRules() should fire the activation of the first object (and you will miss the activation of the second). Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 1:55 PM, Adrián Paredes adri...@epidataconsulting.com wrote: Hi all: I have a very basic doubt about Drools Fusion. I have two simple Java classes: EventA { String id; Date timestamp; Long duration; } EventB { String id; Date timestamp; Long duration; } I have a DRL file, where I declare this two classes as Events: declare EventA @role(event) @timestamp(timestamp) @duration(duration) end declare EventB @role(event) @timestamp(timestamp) @duration(duration) end I have a simple rule: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end Finally, I have a test that starts a StatefulKnowledgeSession in STREAM mode, register an eventLister in the session in order to fire the rules when an event arrives: ksession.addEventListener(new DefaultAgendaEventListener() { @Override public void activationCreated(ActivationCreatedEvent event) { ((StatefulKnowledgeSession) event.getKnowledgeRuntime()).fireAllRules(); } }); And then the test insert in the time stream entry-point an instance of EventA with duration of 10 miliseconds, as follows: EventA eventA = new EventA(); eventA.setId(123); eventA.setTimestamp(new Date()); eventA.setDuration(10L); ksession.getWorkingMemoryEntryPoint(time stream).insert(event); At the end of the test, I have an sleep of 2 seconds just in case. I don't understand why the Basic Rule never fires. But if I add another condition to the same rule, something like this: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream not EventB($aId == id, this after [0s,5s] $eventA) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end The rules fires and I see this message in console: Event A 123 at Fri Dec 07 09:48:59 ART 2012 I don't understand why the first rule, that is more open, don't fire, and the second rule, that is more restrictive, fires without problems. Thank you very much! Greetings, Adrian. -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter http://twitter.com/epidata * ___ 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] Drools + Semantic Web : EulerGUI
It's too bad indeed ! I've looked for a rules, BPMS, inference, IA, Meetup in London, but found none . I can be here longer. I may move my meeup to attend yours. JMV 2012/12/7 Mauricio Salatino sala...@gmail.com Hi Jean-Marc, Ouch! I will be doing a jBPM5 and Drools talk at the same time the same day in the same city! I would love to go and see your talk, I guess that I will miss that this time. Are you going to be around later this week? we can probably arrange to meet. Is the content of the talk gonna be published online somewhere? On Fri, Dec 7, 2012 at 12:53 PM, Jean-Marc Vanel jeanmarc.va...@gmail.com wrote: Hi London Drools users ! I come to London. I'm available for a talk about what I do with Drools + Semantic Web + Controlled English with EulerGUI [1]. I've set a Meetup in London on dec. 12, in need of a location : http://www.meetup.com/LondonSWGroup/events/94447932/ First I'll be in Oxford from today to tuesday at AGI (Artificial General Intelligence) conference [2] . The thread for me there will be how can an agent learn from its experience? . [1] http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/documentation.html#L5890 [2] http://agi-conference.org/2012/ [3] http://www.meetup.com/LondonSWGroup/events/94447932/ -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://deductions-software.com/ +33 (0)6 89 16 29 52 chat : irc://irc.freenode.net#eulergui ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://deductions-software.com/ +33 (0)6 89 16 29 52 chat : irc://irc.freenode.net#eulergui ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools + Semantic Web : EulerGUI
If you do that it will be great.. so we can both attend to each others meetup. I'm really interested in the EulerGUI tool, I've being looking at it since it started Cheers On Fri, Dec 7, 2012 at 1:40 PM, Jean-Marc Vanel jeanmarc.va...@gmail.comwrote: It's too bad indeed ! I've looked for a rules, BPMS, inference, IA, Meetup in London, but found none . I can be here longer. I may move my meeup to attend yours. JMV 2012/12/7 Mauricio Salatino sala...@gmail.com Hi Jean-Marc, Ouch! I will be doing a jBPM5 and Drools talk at the same time the same day in the same city! I would love to go and see your talk, I guess that I will miss that this time. Are you going to be around later this week? we can probably arrange to meet. Is the content of the talk gonna be published online somewhere? On Fri, Dec 7, 2012 at 12:53 PM, Jean-Marc Vanel jeanmarc.va...@gmail.com wrote: Hi London Drools users ! I come to London. I'm available for a talk about what I do with Drools + Semantic Web + Controlled English with EulerGUI [1]. I've set a Meetup in London on dec. 12, in need of a location : http://www.meetup.com/LondonSWGroup/events/94447932/ First I'll be in Oxford from today to tuesday at AGI (Artificial General Intelligence) conference [2] . The thread for me there will be how can an agent learn from its experience? . [1] http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/documentation.html#L5890 [2] http://agi-conference.org/2012/ [3] http://www.meetup.com/LondonSWGroup/events/94447932/ -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://deductions-software.com/ +33 (0)6 89 16 29 52 chat : irc://irc.freenode.net#eulergui ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://deductions-software.com/ +33 (0)6 89 16 29 52 chat : irc://irc.freenode.net#eulergui ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] A basic doubt about Drools Fusion
Thank you, Esteban. You are right! If I insert two events A: rulesTest.addEventA(123); rulesTest.addEventA(456); The second call of fireAllRules() activates the rule for the first object: Event inserted com.epidataconsulting.drools.model.EventA Event A 123 at Fri Dec 07 11:54:21 ART 2012 Event inserted com.epidataconsulting.drools.model.EventA But not for the second. How I can do to correct this behavior? Thanks! Adrian 2012/12/7 Esteban Aliverti esteban.alive...@gmail.com It could be the case, and I'm guessing here, that the AgendaEventListener is called just before the activation is placed into the agenda. So, the call to fireAllRules() finds an empty agenda. What you could do to check if this is what is happening, is to insert 2 EvenA objects. The second call of fireAllRules() should fire the activation of the first object (and you will miss the activation of the second). Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 1:55 PM, Adrián Paredes adri...@epidataconsulting.com wrote: Hi all: I have a very basic doubt about Drools Fusion. I have two simple Java classes: EventA { String id; Date timestamp; Long duration; } EventB { String id; Date timestamp; Long duration; } I have a DRL file, where I declare this two classes as Events: declare EventA @role(event) @timestamp(timestamp) @duration(duration) end declare EventB @role(event) @timestamp(timestamp) @duration(duration) end I have a simple rule: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end Finally, I have a test that starts a StatefulKnowledgeSession in STREAM mode, register an eventLister in the session in order to fire the rules when an event arrives: ksession.addEventListener(new DefaultAgendaEventListener() { @Override public void activationCreated(ActivationCreatedEvent event) { ((StatefulKnowledgeSession) event.getKnowledgeRuntime()).fireAllRules(); } }); And then the test insert in the time stream entry-point an instance of EventA with duration of 10 miliseconds, as follows: EventA eventA = new EventA(); eventA.setId(123); eventA.setTimestamp(new Date()); eventA.setDuration(10L); ksession.getWorkingMemoryEntryPoint(time stream).insert(event); At the end of the test, I have an sleep of 2 seconds just in case. I don't understand why the Basic Rule never fires. But if I add another condition to the same rule, something like this: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream not EventB($aId == id, this after [0s,5s] $eventA) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end The rules fires and I see this message in console: Event A 123 at Fri Dec 07 09:48:59 ART 2012 I don't understand why the first rule, that is more open, don't fire, and the second rule, that is more restrictive, fires without problems. Thank you very much! Greetings, Adrian. -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter http://twitter.com/epidata * ___ 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 -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter
Re: [rules-users] A basic doubt about Drools Fusion
I think you have 2 main options here: - Invoke fireUnitlHalt() in an independent thread. - Invoke fireAllRules() after each insert() you have. Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 3:57 PM, Adrián Paredes adri...@epidataconsulting.com wrote: Thank you, Esteban. You are right! If I insert two events A: rulesTest.addEventA(123); rulesTest.addEventA(456); The second call of fireAllRules() activates the rule for the first object: Event inserted com.epidataconsulting.drools.model.EventA Event A 123 at Fri Dec 07 11:54:21 ART 2012 Event inserted com.epidataconsulting.drools.model.EventA But not for the second. How I can do to correct this behavior? Thanks! Adrian 2012/12/7 Esteban Aliverti esteban.alive...@gmail.com It could be the case, and I'm guessing here, that the AgendaEventListener is called just before the activation is placed into the agenda. So, the call to fireAllRules() finds an empty agenda. What you could do to check if this is what is happening, is to insert 2 EvenA objects. The second call of fireAllRules() should fire the activation of the first object (and you will miss the activation of the second). Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 1:55 PM, Adrián Paredes adri...@epidataconsulting.com wrote: Hi all: I have a very basic doubt about Drools Fusion. I have two simple Java classes: EventA { String id; Date timestamp; Long duration; } EventB { String id; Date timestamp; Long duration; } I have a DRL file, where I declare this two classes as Events: declare EventA @role(event) @timestamp(timestamp) @duration(duration) end declare EventB @role(event) @timestamp(timestamp) @duration(duration) end I have a simple rule: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end Finally, I have a test that starts a StatefulKnowledgeSession in STREAM mode, register an eventLister in the session in order to fire the rules when an event arrives: ksession.addEventListener(new DefaultAgendaEventListener() { @Override public void activationCreated(ActivationCreatedEvent event) { ((StatefulKnowledgeSession) event.getKnowledgeRuntime()).fireAllRules(); } }); And then the test insert in the time stream entry-point an instance of EventA with duration of 10 miliseconds, as follows: EventA eventA = new EventA(); eventA.setId(123); eventA.setTimestamp(new Date()); eventA.setDuration(10L); ksession.getWorkingMemoryEntryPoint(time stream).insert(event); At the end of the test, I have an sleep of 2 seconds just in case. I don't understand why the Basic Rule never fires. But if I add another condition to the same rule, something like this: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream not EventB($aId == id, this after [0s,5s] $eventA) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end The rules fires and I see this message in console: Event A 123 at Fri Dec 07 09:48:59 ART 2012 I don't understand why the first rule, that is more open, don't fire, and the second rule, that is more restrictive, fires without problems. Thank you very much! Greetings, Adrian. -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter http://twitter.com/epidata * ___ 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 -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A
Re: [rules-users] A basic doubt about Drools Fusion
There should be a listener for afterActivationCreated, right? On Fri, Dec 7, 2012 at 3:16 PM, Esteban Aliverti esteban.alive...@gmail.com wrote: I think you have 2 main options here: - Invoke fireUnitlHalt() in an independent thread. - Invoke fireAllRules() after each insert() you have. Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 3:57 PM, Adrián Paredes adri...@epidataconsulting.com wrote: Thank you, Esteban. You are right! If I insert two events A: rulesTest.addEventA(123); rulesTest.addEventA(456); The second call of fireAllRules() activates the rule for the first object: Event inserted com.epidataconsulting.drools.model.EventA Event A 123 at Fri Dec 07 11:54:21 ART 2012 Event inserted com.epidataconsulting.drools.model.EventA But not for the second. How I can do to correct this behavior? Thanks! Adrian 2012/12/7 Esteban Aliverti esteban.alive...@gmail.com It could be the case, and I'm guessing here, that the AgendaEventListener is called just before the activation is placed into the agenda. So, the call to fireAllRules() finds an empty agenda. What you could do to check if this is what is happening, is to insert 2 EvenA objects. The second call of fireAllRules() should fire the activation of the first object (and you will miss the activation of the second). Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Fri, Dec 7, 2012 at 1:55 PM, Adrián Paredes adri...@epidataconsulting.com wrote: Hi all: I have a very basic doubt about Drools Fusion. I have two simple Java classes: EventA { String id; Date timestamp; Long duration; } EventB { String id; Date timestamp; Long duration; } I have a DRL file, where I declare this two classes as Events: declare EventA @role(event) @timestamp(timestamp) @duration(duration) end declare EventB @role(event) @timestamp(timestamp) @duration(duration) end I have a simple rule: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end Finally, I have a test that starts a StatefulKnowledgeSession in STREAM mode, register an eventLister in the session in order to fire the rules when an event arrives: ksession.addEventListener(new DefaultAgendaEventListener() { @Override public void activationCreated(ActivationCreatedEvent event) { ((StatefulKnowledgeSession) event.getKnowledgeRuntime()).fireAllRules(); } }); And then the test insert in the time stream entry-point an instance of EventA with duration of 10 miliseconds, as follows: EventA eventA = new EventA(); eventA.setId(123); eventA.setTimestamp(new Date()); eventA.setDuration(10L); ksession.getWorkingMemoryEntryPoint(time stream).insert(event); At the end of the test, I have an sleep of 2 seconds just in case. I don't understand why the Basic Rule never fires. But if I add another condition to the same rule, something like this: rule Basic Rule dialect 'mvel' when $eventA: EventA($aId: id) from entry-point time stream not EventB($aId == id, this after [0s,5s] $eventA) from entry-point time stream then System.out.println(Event A + $aId + at + $eventA.timestamp); end The rules fires and I see this message in console: Event A 123 at Fri Dec 07 09:48:59 ART 2012 I don't understand why the first rule, that is more open, don't fire, and the second rule, that is more restrictive, fires without problems. Thank you very much! Greetings, Adrian. -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713 Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060 Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495 8450 --- www.epidataconsulting.com Linkedin http://bit.ly/epidatalinkedin | Facebookhttp://www.facebook.com/epidata.consulting | Twitter http://twitter.com/epidata * ___ 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 -- *Epidata Consulting | Deploying Ideas Ing. Adrián M. Paredes | Arquitecto Desarrollador adri...@epidataconsulting.com | Cel: (54911) 3297 1713
Re: [rules-users] Drools + Semantic Web : EulerGUI
Hi Jean-Marc Unfortunately I cannot attend - but I would love to. I'm very interested to hear what you have to say, and to see your presentation. If it is possible, please record the event. Also, if you are ever in Denmark, let me know - I would appreciate learning more. Kind regards Anton -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Drools-Semantic-Web-EulerGUI-tp4021137p4021146.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] IntelliFest - Learning the Reason for Failure to Match
It will be published soon. Big thanks to wolfgang for his excellent work. Mark On 7 Dec 2012, at 12:52, ben.cot...@ms.com ben.cot...@morganstanley.com wrote: Did this white paper ever get published at jboss.org? On 11/5/2012 1:10 PM, Wolfgang Laun wrote: A White Paper containing a similar sceenario (and other material) will be out soon on some RedHat/JBoss site. From:Wolfgang Laun wolfgang.l...@gmail.com To:Rules Users List rules-users@lists.jboss.org, Date:11/05/2012 05:19 AM Subject:Re: [rules-users] DROOLs callback API for L-value predicate matching events Sent by:rules-users-boun...@lists.jboss.org Learning the reason for failure to match is the title of a section in my boot camp you missed at this year's IntelliFest a couple of weeks ago. You are getting close to the solution, but here's the outline of the rule programming design pattern: Write one rule (high salience) to create an auxiliary fact (Aux), containing a reference to the fact under investigation (Crf) and a Set. Write one rule each, combining Aux and Crf, restricting the latter with one of the required property values/range. On the RHS, add an identification to the set component of Aux. DO NOT MODIFY/UPDATE. Write another rule (low salience) combining Aux and Crf and see what Aux contains in the Set. Retract Aux. -W On 05/11/2012, Cotton, Ben ben.cot...@morganstanley.com wrote: Could a solution be as simple as this? Is this approach to consuming LCHUS_IRS_CURRENCY_RULE L-value matching events sound/complete (and not-vulnerable to any race condition?). Is there any DROOLS EventListener callback API that would be more appropriate to solve the problem? E.g. I want to be able to log when each of these 5 L-value predicates either MATCHES or FAILS TO MATCH (at the time of the event) rule LCHUS_IRS_CURRENCY_RULE //XLS Item=195 when IRDCurrencyRuleFact( productType == IRS, currency==GBP, upfrontFeePaymentDate IRDCurrencyRuleFact.terminationDate, maturity = 18275, //unit = days, i.e. 50 Years notional = 99,999,999,999.99 //max Notional ) then System.out.println(LCHUS); end Again the objective is to be able to join a high-resolution logging capability wrt to which of the specific 5 L-value predicates matched. Instinctively, to this DROOLs newbie, this approach seems workable but not ideal rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_1 when IRDCurrencyRuleFact(productType == IRS) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 1 match); //log event L-value predicate 1 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_2 when IRDCurrencyRuleFact(currency==GBP) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 2 match); //log event L-value predicate 2 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_3 when IRDCurrencyRuleFact(upfrontFeePaymentDate IRDCurrencyRuleFact.terminationDate) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 3 match); //log event L-value predicate 3 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_4 when IRDCurrencyRuleFact(maturity = 18275) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 4 match); //log event L-value predicate 4 matched end rule LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_5 when IRDCurrencyRuleFact(notional = 99,999,999,999.99) then System.out.println(LCHUS_IRS_CURRENCY_RULE_L-value event 5 match); //log event L-value predicate 5 matched end Ben D Cotton III Morgan Stanley Co. OTC Derivatives Clearing Technology 1221 AOTA Rockefeller Ctr - Flr 27 New York, NY 10020 (212)762.9094 ben.cot...@ms.commailto:ben.cot...@ms.com From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Cotton, Ben (ISGT) Sent: Saturday, November 03, 2012 8:24 AM To: rules-users@lists.jboss.org Cc: O'Brien, Patrick (ISGT) Subject: [rules-users] DROOLs callback API for L-value predicate matching events Hi, Can someone please point me to compelling examples/sample code of how to use a DROOLs callback API for very high-resolution logging of L-value predicate matching events? E.g. I want to be able to log when each of these 5 L-value predicates either MATCHES or FAILS TO MATCH (at the time of the event) rule LCHUS_IRS_CURRENCY_RULE //XLS Item=195 when IRDCurrencyRuleFact( productType == IRS,
[rules-users] Is Drools suitable for preprocessing my Resource Allocation Problem
Hello, Here is a copy of a question I just sent on Stackoverflow : http://stackoverflow.com/questions/13753983/is-drools-suitable-for-preprocessing-a-resource-allocation-problem I have a quite big resource allocation problem to compute. I have just discovered Drools and I would like to know if it is a good candidate to work as a preprocessor and generate a list of forbidden allocations, based on some user rules. The ProblemI have an optimisation engine that can allocate some activities to some resources, while optimizing some KPIs (Key Performance Indicator). The optimizer takes as input (among others) a list of forbiden allocations that should be generated based on some user-provided rules. Each forbid rule is an AND composition of two rules: One for the activity One for the resource Each sub rule is itself a list of AND tests on some attributes. Here is the structure of one rule, in Pseudo-Code Rule1: * ActivityRule * activity.prop1 == foo AND * activity.prop2 == bar AND * ... * ResourceRule * resource.prop3 == foobar AND * resource.prop4 == NULL AND * ... Rule2: ... As soon as a pair of [Activity,Resource] matches one rule, it should be sent as output, and not tested again against other rules. Also, this is important to note that some rules will match very often, while overs will match very rarely (very specific cases). Performance constraints Here are some rough hints about the volumetry of the problem : * 1000 activities * 200 resources * 50 rules I need the forbidden allocations to be generated in under a minute. The challengeAs far, as I understand, Drools can surely generate those forbidden allocations. the question is : How smart is he ? If I had to write an engine myself for this particular problem, I would make some improvements : For example, I would not generate all possible allocations (200.000) and then try to apply each rule on it (50 rules x 200.000). Instead, I would try to match the resources and the activities separately on each rule (each side of the rule), and then assemble the couples that match at least one common rule. Also, I would add some counter on each rule that would auto increment upon each match, in order to apply first the rules that match often. QuestionsIs the engine of Drools smart enought for that ? Or is he even smarter ? Do you have an example of Drools being used in a similar problem with success ? Do you have some hints on how to modelise this problem in Drools ? Thanks in advance for your advice. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is Drools suitable for preprocessing my Resource Allocation Problem
I don't see any reason why Drools should not be capable of handling this kind of problem. Some consideration should be given to the way the rules are written, depending on the number of constraints matching the properties: the ones reducing the number of possible matches most should come first in the rule. Possibly it is the Resource that should precede the Activity, but of course this depends on the constraints. -W On 07/12/2012, Raphael Jolivet raphael.joli...@gmail.com wrote: Hello, Here is a copy of a question I just sent on Stackoverflow : http://stackoverflow.com/questions/13753983/is-drools-suitable-for-preprocessing-a-resource-allocation-problem I have a quite big resource allocation problem to compute. I have just discovered Drools and I would like to know if it is a good candidate to work as a preprocessor and generate a list of forbidden allocations, based on some user rules. The ProblemI have an optimisation engine that can allocate some activities to some resources, while optimizing some KPIs (Key Performance Indicator). The optimizer takes as input (among others) a list of forbiden allocations that should be generated based on some user-provided rules. Each forbid rule is an AND composition of two rules: One for the activity One for the resource Each sub rule is itself a list of AND tests on some attributes. Here is the structure of one rule, in Pseudo-Code Rule1: * ActivityRule * activity.prop1 == foo AND * activity.prop2 == bar AND * ... * ResourceRule * resource.prop3 == foobar AND * resource.prop4 == NULL AND * ... Rule2: ... As soon as a pair of [Activity,Resource] matches one rule, it should be sent as output, and not tested again against other rules. Also, this is important to note that some rules will match very often, while overs will match very rarely (very specific cases). Performance constraints Here are some rough hints about the volumetry of the problem : * 1000 activities * 200 resources * 50 rules I need the forbidden allocations to be generated in under a minute. The challengeAs far, as I understand, Drools can surely generate those forbidden allocations. the question is : How smart is he ? If I had to write an engine myself for this particular problem, I would make some improvements : For example, I would not generate all possible allocations (200.000) and then try to apply each rule on it (50 rules x 200.000). Instead, I would try to match the resources and the activities separately on each rule (each side of the rule), and then assemble the couples that match at least one common rule. Also, I would add some counter on each rule that would auto increment upon each match, in order to apply first the rules that match often. QuestionsIs the engine of Drools smart enought for that ? Or is he even smarter ? Do you have an example of Drools being used in a similar problem with success ? Do you have some hints on how to modelise this problem in Drools ? Thanks in advance for your advice. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users