Re: [rules-users] Simple rule and Query
Hi everyone, I'am still stuck with this simple example, anyone can tell me where to look or what I'm missing ? Thanks Yannick De : DECOUX Yannick [mailto:yannick.dec...@ucm.be] Envoyé : mardi 5 avril 2011 07:52 À : rules-users@lists.jboss.org Objet : [rules-users] Simple rule and Query Hi, I'am trying to use Query and i'am facing a little problem : Given this simple rule : package be.test.person import be.test.person.* query get adult adult : Adult( ) end query get person person : Person( ) end declare Adult name : String end rule A person over 18 is an adult when Person( age = 18) then System.out.println(Adult detected); insert(new Adult()); end Lets suppose one Person over 18 is inserted inside the working memory, the result of the query « get adult » is 0 (Please note the declaration of Adult type inside the rule) If I create a Java class Adult (commenting the one in the .drl file) and then run the query again, this time the result is 1 Also, the signature of org.drools.runtime.rule.WorkingMemory.getQueryResults(String) says IllegalArgumentException when query is not found in the KnowledgeBase. This doesn't seems to be the case when I use a fake query name. I'am using drools 5.1.1 Any idea on this ? Thanks ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] execute particular rules programmatically and dynamically
In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 salience 1 dialect mvel when *ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) )* ad : ApplicationData( age == || ( == null )) then ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? The customer will ask if they have 1 rules in the rulebase. And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. Therefore, Rule3 can be shared for these 3 editbox validation, right? However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the dropdown and edit box 1 into your model, plus you enter a context fact stating that these values relate to that part of the UI (say screen1.panel1.editbox1). You then insert these facts into WM and call fireAllRules. The rules check the context and only execute if the values are for the (rule) applicable context. (2) Editbox 2 works in a similar way, but has a different context ((say screen1.panel1.editbox2). Have a look at Plugtree - I believe they're quite well customed to writing UIs backed with rules; salaboy or esteban (or IRC #drools) might be able to offer more practical advice. With kind regards, Mike On 13 April 2011 17:48, Benson Fung benson.red...@gmail.com wrote: Hi Michael, Can you elaborate more for the uses of the ApplicationContext? I can't follow its uses. Thanks Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Here's a quick (and probably sub-optimal way) ;) When you copy values from the UI to Facts for validation you also include the context of the validation. I've also removed the inline evals you were using. rule Rule1 salience 1 dialect mvel when ApplicationContext( context == * ) ad : ApplicationData( age == || ( == null )) then ad.setReturnMsg( \n age should not be null or empty ); end rule Rule2 dialect mvel when ApplicationContext( context == screen1.panel1.ed ) ad : ApplicationData( $age : age != null , age != , age 0 || 100, minIssrdAge == Years ) then ad.setReturnMsg( \nage is out of the range(i.e. 0 and 100) ); end rule Rule3 dialect mvel when ad : ApplicationData( $age : age != null , age != , age 0 || 600, minIssrdAge == Years ) then ad.setReturnMsg( \nage is out of the range(i.e. 0 and 600) ); end On 13 April 2011 17:19, Benson Fung benson.red...@gmail.com wrote: Hi, Here is the scenario : If there are 2 edit boxes and 2 dropdown list at the frontend like. dropdown(minIssrdAge1) editbox(age1) dropdown(minIssrdAge2) editbox(age2) everytime when I lost focus the editbox(age1 or age2), the editbox(age1 or age2) value will be validated against the following rules. i.e. minIssrdAge1 and age1 will be validated together if lost focus the editbox age1. minIssrdAge2 and age2 will be validated together if lost focus the editbox age2 Rule1 is mandatory because both editbox are required field. However, editbox(age1) is only valid within the 0 and 100. and editbox(age2) is only valid within 0 and 600. In other words, editbox(age1) have to be validated against Rule1 + Rule2. However, editbox(age2) have to validated against Rule1 + Rule3. My question, how to design the rule attribute or at the java program side so that different editbox can be validated against different rule. Please help. I
Re: [rules-users] How to use KnowledgeBase
Hi, In theory, you can do it both ways. Depending on your situation, you will have to assess which approach will be the best solution. Regarding the fact that creation of a kbase takes some time, you will probably want to avoid doing it multiple times per transaction or, at least, cache them. Also, when your rules are part of a continupus flow, you probably want only 1 kbase. In your situation, mortgages, I assume your rules are following eachother with no or very little interaction from the user. In that case, I think one would normally use 1 knowledgebase. Theoretically, multiple knowledgebases should be used when dealing with completely different rulesets, with one ruleset not influencing the other (or execution of ruleset one happening in a totally different timeframe as to justify the use of another kbase). I hope this makes it clear. Regards, Frank ismaximum wrote: Hi I am new to Drools and just want to start developing our app with Drools. I have some questions regarding KnowledgeBase instantiation. Can we create a single instance of KB across the application and use it to create any stateful or stateless session? In this case, do we need to add all the rules available in our application or we need to create one instance for each set of rules? In other words, consider we have many rules including mortgage calculation/ validation, auditing process, interest rate calculation and many others, do we need to create one instance of KB for each rule or just one KB and add all the rules to it? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-use-KnowledgeBase-tp2819308p2819374.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] execute particular rules programmatically and dynamically
Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :)Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 salience 1 dialect mvel when ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ad : ApplicationData( age == || ( == null )) then ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? The customer will ask if they have 1 rules in the rulebase. And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. Therefore, Rule3 can be shared for these 3 editbox validation, right? However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the dropdown and edit box 1 into your model, plus you enter a context fact stating that these values relate to that part of the UI (say screen1.panel1.editbox1). You then insert these facts into WM and call fireAllRules. The rules check the context and only execute if the values are for the (rule) applicable context. (2) Editbox 2 works in a similar way, but has a different context ((say screen1.panel1.editbox2). Have a look at Plugtree - I believe they're quite well customed to writing UIs backed with rules; salaboy or esteban (or IRC #drools) might be able to offer more practical advice. With kind regards, Mike On 13 April 2011 17:48, Benson Fung benson.red...@gmail.com wrote: Hi Michael, Can you elaborate more for the uses of the ApplicationContext? I can't follow its uses. Thanks Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Here's a quick (and probably sub-optimal way) ;) When you copy values from the UI to Facts for validation you also include the context of the validation. I've also removed the inline evals you were using. rule Rule1 salience 1 dialect mvel when ApplicationContext( context == * ) ad : ApplicationData( age == || ( == null )) then ad.setReturnMsg( \n age should not be null or empty ); end rule Rule2 dialect mvel when ApplicationContext( context == screen1.panel1.ed ) ad : ApplicationData( $age : age != null , age != , age 0 || 100, minIssrdAge == Years ) then ad.setReturnMsg( \nage is out of the range(i.e. 0 and 100) ); end rule Rule3 dialect mvel when ad : ApplicationData( $age : age != null , age != , age 0 || 600, minIssrdAge == Years ) then ad.setReturnMsg( \nage is out of the range(i.e. 0 and 600) ); end On 13 April 2011 17:19, Benson Fung benson.red...@gmail.com wrote: Hi, Here is the scenario : If there are 2 edit boxes and 2 dropdown list at the frontend like. dropdown(minIssrdAge1) editbox(age1) dropdown(minIssrdAge2) editbox(age2) everytime when I lost focus the editbox(age1 or age2), the editbox(age1 or age2) value will be validated against the following rules. i.e. minIssrdAge1 and age1 will be validated together if lost focus the editbox age1. minIssrdAge2 and age2 will be validated together if lost focus the
Re: [rules-users] Simple rule and Query
This seems to be fixed for 5.2.x.: declare Num num : Integer end rule sort when Integer( $i: intValue ) then insert( new Num( $i ) ); end query numbers $a: Num( $b: num ) end QueryResults qRes = session.getQueryResults( numbers ); System.out.println( result count: + qRes.size() ); for( QueryResultsRow row: qRes ){ Object obj = row.get( $b ); System.out.println( $b= + obj.toString() ); } This produces the expected results. Calling getQueryResults with a string not denoting an existing query returns an empty result set. I've updated the javadoc - thanks. -W 2011/4/14 DECOUX Yannick yannick.dec...@ucm.be query numbers $a: Num( $b: num ) end Hi everyone, I’am still stuck with this simple example, anyone can tell me where to look or what I’m missing ? Thanks Yannick *De :* DECOUX Yannick [mailto:yannick.dec...@ucm.be] *Envoyé :* mardi 5 avril 2011 07:52 *À :* rules-users@lists.jboss.org *Objet :* [rules-users] Simple rule and Query Hi, I’am trying to use Query and i’am facing a little problem : Given this simple rule : *package* be.test.person *import* be.test.person.* *query* get adult adult : Adult( ) *end* *query* get person person : Person( ) *end* *declare* Adult name : String *end* *rule* A person over 18 is an adult *when* Person( age = 18) *then* System.out.println(Adult detected); *insert*(*new* Adult()); *end* * * Lets suppose one Person over 18 is inserted inside the working memory, the result of the query « get adult » is 0 (Please note the declaration of Adult type inside the rule) If I create a Java class Adult (commenting the one in the .drl file) and then run the query again, this time the result is 1 Also, the signature of org.drools.runtime.rule.WorkingMemory.getQueryResults(String) says IllegalArgumentException when query is not found in the KnowledgeBase. This doesn’t seems to be the case when I use a fake query name. I’am using drools 5.1.1 Any idea on this ? Thanks ___ 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] How to use KnowledgeBase
Hi Max, Also, consider serializing individual Knowledge Packages containing logically related rules. You may combine them to create several knowledge bases and serialize them, or create them during application startup. Once you have a knowledge base, any number of sessions can be started. Make sure to call dispose() to free (stateful) session resources. -W On 14 April 2011 09:13, FrankVhh frank.vanhoensho...@agserv.eu wrote: Hi, In theory, you can do it both ways. Depending on your situation, you will have to assess which approach will be the best solution. Regarding the fact that creation of a kbase takes some time, you will probably want to avoid doing it multiple times per transaction or, at least, cache them. Also, when your rules are part of a continupus flow, you probably want only 1 kbase. In your situation, mortgages, I assume your rules are following eachother with no or very little interaction from the user. In that case, I think one would normally use 1 knowledgebase. Theoretically, multiple knowledgebases should be used when dealing with completely different rulesets, with one ruleset not influencing the other (or execution of ruleset one happening in a totally different timeframe as to justify the use of another kbase). I hope this makes it clear. Regards, Frank ismaximum wrote: Hi I am new to Drools and just want to start developing our app with Drools. I have some questions regarding KnowledgeBase instantiation. Can we create a single instance of KB across the application and use it to create any stateful or stateless session? In this case, do we need to add all the rules available in our application or we need to create one instance for each set of rules? In other words, consider we have many rules including mortgage calculation/ validation, auditing process, interest rate calculation and many others, do we need to create one instance of KB for each rule or just one KB and add all the rules to it? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-use-KnowledgeBase-tp2819308p2819374.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] Expert versus Expert
A few months ago a question was asked about the difference and the use case involving Drools Expert and Drools Guvnor. To be honest, it isn't clear for me too and as there wasn't any answer to this first question, so I'm trying to have an answer with your help :) What's clear : - Guvnor is a repository for the assets - The easiest (?) and certainly the mainly available as a tutorial solution is to create in each application an agent that grabs the assets and execute the whole thing in its own context. What's not clear : - how to centralize the execution in order to know exactly what's executed, by whom, and how (be able to log which facts are sent, to which rules, and be able to read the execution plan - if it exists a real stand alone centralized engine that match this need (Drools Expert ?) If some can explain this a little bit more, I'll be really happy to read ! And if it can be added to the current documentation, it could be a great idea too. Thanks for your help. -- View this message in context: http://drools.46999.n3.nabble.com/Expert-versus-Expert-tp1739141p2819515.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] Call for Papers, edBPM11, 5th International Workshop on Event-Driven Business Process Management, collocated with BPM 2011
- Dear colleagues (with apologies for cross-posting), you are invited to submit papers for the 5th International Workshop on Event-Driven Business Process Management to be held alongside the Busines Process Management Conference on August 29th 2011 in Clermont-Ferrand, France Event-Driven Business Process Management (EDBPM) is an enhancement of Business Process Management (BPM) by new concepts of Service Oriented Architecture (SOA), Event Driven Architecture (EDA), Software as a Service (SaaS), Business Activity Monitoring (BAM) and Complex Event Processing (CEP). In this context, BPM means a software platform which provides companies the ability to model, manage, and optimize these processes for significant gain. As an independent system, CEP is a parallel running platform that analyses and processes events. The BPM- and the CEP-platform correspond via events which are produced by the BPM-workflow engine and by the - if distributed -- IT services which are associated with the business process steps. Also events coming from different event sources in different forms can trigger a business process or influence the execution of the process or a service, which can result in another event. Even more, the correlation of these events in a particular context can be treated as a complex, business level event, relevant for the execution of other business processes or services closing the loop of insight-to-action. A business process - arbitrarily fine or coarse grained - can be seen as a service again and can be choreographed with other business processes or services, even between different enterprises and organisations. Loosely coupled event-driven architecture for BPM provides important benefits: . Responsiveness. Events can occur at any time from any source and processes respond to them immediately, whenever they happen and wherever they happen. . Agility. New processes can be modeled, implemented, deployed, and optimized more quickly in response to changing business requirements. . Flexibility. Processes can span heterogeneous platforms and programming languages. Participating applications can be upgraded or changed without breaking the process model. TOPICS Authors are invited to submit novel contributions in the above mentioned problem domain. Specifically, the relevant topics include, but are not limited to: . Event-driven BPM: Concepts e.g. role of event processing in BPM, business events: types and representation, vent stream processing in business processes, process event processing in CEP, data- and event-driven business processes, event and process interaction patterns . Design-time CEP and BPM e.g. modelling modelling events in human-oriented tasks, semantics/ontologies for event-driven BPM, BPMN and event processing, interaction modelling of process model and event processing network. . Run-time CEP and BPM e.g. event pattern detection, BPEL and event processing, reasoning about unknown/ similar events . Applications/ Use use cases for event-driven BPM e.g. event-driven monitoring/ BAM , event-driven SLA monitoring, context-aware BPM The Workshop is planned as a full-day event, including a keynote, paper presentations, lightning talks, demos, posters, and a moderated, open discussion with the clear goal of agreeing upon a research roadmap for event-driven Business Process Management research, by taking into account new challenges, described earlier. SUBMISSION The following types of submission are solicited: . Long paper submissions, describing substantial contributions of novel ongoing work. Long papers should be at most 12 pages long. . Short paper submissions, describing work in progress. These papers should be at most 6 pages long. . Use case submissions, describing results from an edBPM use case. These papers should be at most 4 pages long. Papers should be submitted in the new LNBIP format (http://www.springer.com/computer/lncs?SGWID=0-164-7-487211-0). Papers have to present original research contributions not concurrently submitted elsewhere. The title page must contain a short abstract, a classification of the topics covered, preferably using the list of topics above, and an indication of the submission category (Long Paper/ Short Paper / Use case). Papers can be uploaded via the workshop page on easychair, the address can be found on the workshop homepage. Papers will be published in the postconference proceeding (Springer Verlag) IMPORTANT DATES Deadline paper submissions: May 6, 2011 Notification of acceptance: June 2, 2011 Camera-ready papers: June 17, 2011 Workshops: August 29, 2011 ORGANISING COMMITTEE: Dr. Nenad Stojanovic FZI - Research Center for Information Technologies at the University of Karlsruhe Germany nenad.stojano...@fzi.de Dr. Opher Etzion Senior Technical Staff
Re: [rules-users] Expert versus Expert
What's not clear : - how to centralize the execution in order to know exactly what's executed, by whom, and how (be able to log which facts are sent, to which rules, and be able to read the execution plan centralised execution could (possibly) be achieved using drools-server. WorkingMemoryEventListeners can provide a log of facts inserted - you'd need to provide the glue for whom AgendaEventListeners can provide a log of rule activations - if it exists a real stand alone centralized engine that match this need (Drools Expert ?) Not Drools Expert. Drools server might be what you're after - but I don't know too much about it. With kind regards, MIke On 14 April 2011 09:11, delirii martinda...@free.fr wrote: A few months ago a question was asked about the difference and the use case involving Drools Expert and Drools Guvnor. To be honest, it isn't clear for me too and as there wasn't any answer to this first question, so I'm trying to have an answer with your help :) What's clear : - Guvnor is a repository for the assets - The easiest (?) and certainly the mainly available as a tutorial solution is to create in each application an agent that grabs the assets and execute the whole thing in its own context. What's not clear : - how to centralize the execution in order to know exactly what's executed, by whom, and how (be able to log which facts are sent, to which rules, and be able to read the execution plan - if it exists a real stand alone centralized engine that match this need (Drools Expert ?) If some can explain this a little bit more, I'll be really happy to read ! And if it can be added to the current documentation, it could be a great idea too. Thanks for your help. -- View this message in context: http://drools.46999.n3.nabble.com/Expert-versus-Expert-tp1739141p2819515.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] execute particular rules programmatically and dynamically
We've come across something similar in our project just recently as well. We have a requirement to have some rules activate based on a tab-off action but also at a higher level (such as validating an entire event entry in the GUI). I also need these rules to activate if initiated from an external webservice (no GUI at all). What we've decided to utilize is a meta identifier in certain rules called FieldsAffected which may contain a delimited list of field identifiers. An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field. Our RHS creates a validation msg which contains the field identifiers so that the calling GUI can display the proper msgs to the field. This allows us to support multiple call scenarios without duplicating the logic in multiple rules just based on context info. Hope this helps, Bob Christenson -- Message: 2 Date: Thu, 14 Apr 2011 15:23:44 +0800 From: Benson Fung benson.red...@gmail.com Subject: Re: [rules-users] execute particular rules programmatically anddynamically To: Rules Users List rules-users@lists.jboss.org Message-ID: BANLkTi=OGO=rwfenybhm144gvst+p_k...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :)Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 ? salience 1 ? dialect mvel ??? when ? ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ? ? ? ad : ApplicationData( age == || ( ?== null )) ? ? then ? ??? ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? ?The customer will ask if they have 1 rules in the rulebase. ?And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. ?editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. ?Therefore, Rule3 can be shared for these 3 editbox validation, right? ?However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. ?So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the dropdown and edit box 1 into your model, plus you enter a context fact stating that these values relate to that part of the UI (say screen1.panel1.editbox1). You then insert these facts into WM and call fireAllRules. The rules check the context and only execute if the values are for the (rule) applicable context. (2) Editbox 2 works in a similar way, but has a different context ((say screen1.panel1.editbox2). Have a look at Plugtree - I believe they're quite well customed to writing UIs backed with rules; salaboy or esteban (or IRC #drools) might be able to offer more practical advice. With kind regards, Mike On 13 April 2011 17:48, Benson Fung benson.red...@gmail.com wrote: Hi Michael, Can you elaborate more for the uses of the ApplicationContext? ?I can't follow its uses. Thanks Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Here's a quick (and probably sub-optimal way) ;) When you copy values from the UI to Facts for validation you also include the context of the validation. I've also removed the inline evals you were
Re: [rules-users] execute particular rules programmatically and dynamically
Hi Bob, Thanks for your input and looks like close to the point. AgendaFilter interface could be the key point of the solution plus the rule attribute(I guess). Can you try to elaborate more with simple example how you can implement it? Thanks On Thu, Apr 14, 2011 at 5:38 PM, Robert Christenson r...@akc.org wrote: We've come across something similar in our project just recently as well. We have a requirement to have some rules activate based on a tab-off action but also at a higher level (such as validating an entire event entry in the GUI). I also need these rules to activate if initiated from an external webservice (no GUI at all). What we've decided to utilize is a meta identifier in certain rules called FieldsAffected which may contain a delimited list of field identifiers. An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field. Our RHS creates a validation msg which contains the field identifiers so that the calling GUI can display the proper msgs to the field. This allows us to support multiple call scenarios without duplicating the logic in multiple rules just based on context info. Hope this helps, Bob Christenson -- Message: 2 Date: Thu, 14 Apr 2011 15:23:44 +0800 From: Benson Fung benson.red...@gmail.com Subject: Re: [rules-users] execute particular rules programmatically and dynamically To: Rules Users List rules-users@lists.jboss.org Message-ID: BANLkTi=OGO=rwfenybhm144gvst+p_k...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :) Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 ? salience 1 ? dialect mvel ??? when ? ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ? ? ? ad : ApplicationData( age == || ( ?== null )) ? ? then ? ??? ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? ?The customer will ask if they have 1 rules in the rulebase. ?And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. ?editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. ?Therefore, Rule3 can be shared for these 3 editbox validation, right? ?However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. ?So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the dropdown and edit box 1 into your model, plus you enter a context fact stating that these values relate to that part of the UI (say screen1.panel1.editbox1). You then insert these facts into WM and call fireAllRules. The rules check the context and only execute if the values are for the (rule) applicable context. (2) Editbox 2 works in a similar way, but has a different context ((say screen1.panel1.editbox2). Have a look at Plugtree - I believe they're quite well customed to writing UIs backed with rules; salaboy or esteban (or IRC #drools) might be able to offer more practical advice. With kind regards, Mike On 13 April 2011 17:48, Benson Fung benson.red...@gmail.com wrote: Hi Michael, Can you elaborate more for the uses of the ApplicationContext? ?I
Re: [rules-users] execute particular rules programmatically and dynamically
Hi Bob, I don't understand about your statement : 'An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field.' Can you show me how you implement AgendaFilter? Benson On Thu, Apr 14, 2011 at 5:38 PM, Robert Christenson r...@akc.org wrote: We've come across something similar in our project just recently as well. We have a requirement to have some rules activate based on a tab-off action but also at a higher level (such as validating an entire event entry in the GUI). I also need these rules to activate if initiated from an external webservice (no GUI at all). What we've decided to utilize is a meta identifier in certain rules called FieldsAffected which may contain a delimited list of field identifiers. An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field. Our RHS creates a validation msg which contains the field identifiers so that the calling GUI can display the proper msgs to the field. This allows us to support multiple call scenarios without duplicating the logic in multiple rules just based on context info. Hope this helps, Bob Christenson -- Message: 2 Date: Thu, 14 Apr 2011 15:23:44 +0800 From: Benson Fung benson.red...@gmail.com Subject: Re: [rules-users] execute particular rules programmatically and dynamically To: Rules Users List rules-users@lists.jboss.org Message-ID: BANLkTi=OGO=rwfenybhm144gvst+p_k...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :) Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 ? salience 1 ? dialect mvel ??? when ? ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ? ? ? ad : ApplicationData( age == || ( ?== null )) ? ? then ? ??? ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? ?The customer will ask if they have 1 rules in the rulebase. ?And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. ?editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. ?Therefore, Rule3 can be shared for these 3 editbox validation, right? ?However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. ?So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the dropdown and edit box 1 into your model, plus you enter a context fact stating that these values relate to that part of the UI (say screen1.panel1.editbox1). You then insert these facts into WM and call fireAllRules. The rules check the context and only execute if the values are for the (rule) applicable context. (2) Editbox 2 works in a similar way, but has a different context ((say screen1.panel1.editbox2). Have a look at Plugtree - I believe they're quite well customed to writing UIs backed with rules; salaboy or esteban (or IRC #drools) might be able to offer more practical advice. With kind regards, Mike On 13 April 2011
Re: [rules-users] execute particular rules programmatically and dynamically
What could be the reason for... On 14 April 2011 11:38, Robert Christenson r...@akc.org wrote: We've come across something similar in our project just recently as well. We have a requirement to have some rules activate based on a tab-off action but also at a higher level (such as validating an entire event entry in the GUI). I also need these rules to activate if initiated from an external webservice (no GUI at all). What we've decided to utilize is a meta identifier in certain rules called FieldsAffected which may contain a delimited list of field identifiers. An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field. ...not using a regular rule condition to ascertain this field match? -W Our RHS creates a validation msg which contains the field identifiers so that the calling GUI can display the proper msgs to the field. This allows us to support multiple call scenarios without duplicating the logic in multiple rules just based on context info. Hope this helps, Bob Christenson -- Message: 2 Date: Thu, 14 Apr 2011 15:23:44 +0800 From: Benson Fung benson.red...@gmail.com Subject: Re: [rules-users] execute particular rules programmatically anddynamically To: Rules Users List rules-users@lists.jboss.org Message-ID: BANLkTi=OGO=rwfenybhm144gvst+p_k...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :)Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 ? salience 1 ? dialect mvel ??? when ? ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ? ? ? ad : ApplicationData( age == || ( ?== null )) ? ? then ? ??? ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? ?The customer will ask if they have 1 rules in the rulebase. ?And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. ?editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. ?Therefore, Rule3 can be shared for these 3 editbox validation, right? ?However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. ?So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the dropdown and edit box 1 into your model, plus you enter a context fact stating that these values relate to that part of the UI (say screen1.panel1.editbox1). You then insert these facts into WM and call fireAllRules. The rules check the context and only execute if the values are for the (rule) applicable context. (2) Editbox 2 works in a similar way, but has a different context ((say screen1.panel1.editbox2). Have a look at Plugtree - I believe they're quite well customed to writing UIs backed with rules; salaboy or esteban (or IRC #drools) might be able to offer more practical advice. With kind regards, Mike On 13 April 2011 17:48, Benson Fung benson.red...@gmail.com wrote: Hi Michael, Can you elaborate more for the uses of the ApplicationContext? ?I can't follow its uses. Thanks
Re: [rules-users] Drools mvel consequence if (logEnabled) discussion/disabled if statement
That would be a good compromise for DROOLS, use at your own risk, but not out of box. How do I turn it on? -- View this message in context: http://drools.46999.n3.nabble.com/Drools-mvel-consequence-if-logEnabled-discussion-disabled-if-statement-tp2816469p2820041.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] Rule Templates
Hi all, In the Expert Guide and on some places on the internet, I read about Rule Templates. I think this is a very interesting feature. However, the expert manual states to use it with caution as it is still an experimental feature. Also, there isn't that much information on the web either. Is it already encouraged to use it in production, or is it still very much in a development phase and should it only be used for educational purposes? Thanks a lot lots of regards, Frank -- View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820139.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] Retrieving rule configuration
Hello, A sample rule that I have created is listed below: rule 'Abnormal time MBP Enrollment' dialect 'mvel' ruleflow-group enrl.ruleflowgroup.detailRuleFlowGroup when ruleData : EnrlRuleData() then - end Is there any way I can retrieve the rule flow group name (enrl.ruleflowgroup.detailRuleFlowGroup) when rules are loaded (Ex: using KnowledgeBaseListener)? Thanks Randhish http://www.mindtree.com/email/disclaimer.html ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Retrieving rule configuration
You may have to use a bit from the unstable API: KnowledgePackage kPackage = ...; KnowledgePackageImp kPackageImp = (KnowledgePackageImp)kPackage; for( org.drools.definition.rule.Rule rule: kPackage.getRules() ){ String rName = rule.getName(); org.drools.rule.Rule realRule = (org.drools.rule.Rule)kPackageImp.getRule( rName ); String rfGroup = realRule.getRuleFlowGroup(); } -W 2011/4/14 Randhish Raghavan randhish_ragha...@mindtree.com Hello, A sample rule that I have created is listed below: rule 'Abnormal time MBP Enrollment' dialect 'mvel' ruleflow-group enrl.ruleflowgroup.detailRuleFlowGroup when ruleData : EnrlRuleData() then - end Is there any way I can retrieve the rule flow group name (“enrl.ruleflowgroup.detailRuleFlowGroup”) when rules are loaded (Ex: using KnowledgeBaseListener)? Thanks Randhish -- http://www.mindtree.com/email/disclaimer.html ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rule Templates
This feature is used internally (spreadsheet), and therefore one has to assume that it's here to stay. The warning is mainly there because the API is in the unstable part. -W On 14 April 2011 14:48, FrankVhh frank.vanhoensho...@agserv.eu wrote: Hi all, In the Expert Guide and on some places on the internet, I read about Rule Templates. I think this is a very interesting feature. However, the expert manual states to use it with caution as it is still an experimental feature. Also, there isn't that much information on the web either. Is it already encouraged to use it in production, or is it still very much in a development phase and should it only be used for educational purposes? Thanks a lot lots of regards, Frank -- View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820139.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] Problem using Guvnor rules in eclipse
Same thing for me. I tried the mortgage example of the 5.1.1 distro with the 5.1.1 of guvnor... Got a 401 error. The examples distro uses an older client version of drools that can't handle the basic auth of the newer version of 5.1.1 guvnor. So, I tried rewriting the mortgage app, got decently far, but it seems like all the rules that should be firing, are not: http://drools.46999.n3.nabble.com/rules-users-Can-t-Get-Rules-To-Modify-Object-State-in-Mortgage-Example-of-Drools-5-1-1-Guvnor-td2817700.html Maybe there's a bug in guvnor or the client? IDK a complete example in the examples distro using the latest version of client server would be useful -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Problem-using-Guvnor-rules-in-eclipse-tp2815449p2820307.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rule Templates
Hi W., Thanks for the fast reply. Meanwhile, I have been trying to play with the templates. Unfortunately, I run into a nullpointerexception in the problems view of Eclipse. At first, I hoped it was the same error as in http://lists.jboss.org/pipermail/rules-users/2010-November/017229.html but that does not seem to be the case. Underneath, you can find my drl file. This is the only artifact that I am having right now. There is no Java code yet, apart from the Price object. This shouldn't be necessary to fix the problem either. I tried to comment out some pieces of code to narrow down on the problem. The nullpointerexception persists even if you comment everything from package to the bottom of the file. This should indicate the problem has to be in the template header, but I do not have a clue. Could anyone help with this? Thanks in advance. == template header minimumValue maximumValue precision startlevel endlevel roundingvalue package rounding import rounding.Price; template Determine evaluated decimals rule Determine evaluated decimals @{row.rowNumber} salience 25 lock-on-active true when $price: Price(integerpart = @{minimumValue} integerpart @{maximumValue} evaluateddecimals == 999) then $price.setRoundedPrecision(@{precision}); $price.calculateNumberOfRoundedDecimals(); $price.calculateEvaluatedDecimals(); $price.calculateBasenumber(); update($price); end end template template Determine rounding value rule Determine rounding value @{row.rowNumber} salience 0 no-loop true when $price: Price(integerpart = @{minimumValue} integerpart @{maximumValue} evaluateddecimals = @{startlevel} evaluateddecimals @{endlevel}) then $price.setRoundedPrice($price.getBasenumber() + @{roundingvalue}); System.out.println($price.getPrice() + = + (double) $price.getRoundedPrice() / Math.pow(10,$price.getNumberofroundeddecimals()) ); end end template -- View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820343.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] deploy jbpm as service
i'm a new jbpm user, and i have to create a workflow web service in a SOA architecture. Basically i think i have to expose methods for: - retrieve the list of possible tasks to start - start a task - get the task of a user - get the parameters for a user task to create the form - update a task after user interaction - some other operations... I can't find documentations on how to do this basic operations, for example: how get the list of the possible process to start? if i set the task owner in a process variable, how can i get the task that person owns? how get the params declared in a usertask as Parameter Mapping or Result Mapping to create the user form? The javadocs are very poor, i can't find any example, i don't know if there's a better approach to do this. tanks in advance -- View this message in context: http://drools.46999.n3.nabble.com/deploy-jbpm-as-service-tp2820346p2820346.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] execute particular rules programmatically and dynamically
Hi Wolfgang, Please see the following scenario. On Thu, Apr 14, 2011 at 12:19 AM, Benson Fung benson.red...@gmail.com wrote: Hi, Here is the scenario : If there are 2 edit boxes and 2 dropdown list at the frontend like. dropdown(minIssrdAge1) editbox(age1) dropdown(minIssrdAge2) editbox(age2) everytime when I lost focus the editbox(age1 or age2), the editbox(age1 or age2) value will be validated against the following rules. i.e. minIssrdAge1 and age1 will be validated together if lost focus the editbox age1. minIssrdAge2 and age2 will be validated together if lost focus the editbox age2 Rule1 is mandatory because both editbox are required field. However, editbox(age1) is only valid within the 0 and 100. and editbox(age2) is only valid within 0 and 600. In other words, editbox(age1) have to be validated against Rule1 + Rule2. However, editbox(age2) have to validated against Rule1 + Rule3. My question, how to design the rule attribute or at the java program side so that different editbox can be validated against different rule. Please help. I can't find any solution by now. rule Rule1 salience 1 dialect mvel when ad : ApplicationData( age == || ( == null )) then ad.setReturnMsg( \n age should not be null or empty ); end rule Rule2 dialect mvel when ad : ApplicationData( $age : age != null , age != , minIssrdAge == Years ) eval(Integer.parseInt($age) 0) or eval(Integer.parseInt($age) 100) then ad.setReturnMsg( \nage is out of the range(i.e. 0 and 100) ); end rule Rule3 dialect mvel when ad : ApplicationData( $age : age != null , age != , minIssrdAge == Years ) eval(Integer.parseInt($age) 0) or eval(Integer.parseInt($age) 600) then ad.setReturnMsg( \nage is out of the range(i.e. 0 and 600) ); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Expert versus Expert
On 14/04/2011 09:11, delirii wrote: A few months ago a question was asked about the difference and the use case involving Drools Expert and Drools Guvnor. To be honest, it isn't clear for me too and as there wasn't any answer to this first question, so I'm trying to have an answer with your help :) What's clear : - Guvnor is a repository for the assets - The easiest (?) and certainly the mainly available as a tutorial solution is to create in each application an agent that grabs the assets and execute the whole thing in its own context. What's not clear : - how to centralize the execution in order to know exactly what's executed, by whom, and how (be able to log which facts are sent, to which rules, and be able to read the execution plan - if it exists a real stand alone centralized engine that match this need (Drools Expert ?) If some can explain this a little bit more, I'll be really happy to read ! And if it can be added to the current documentation, it could be a great idea too. I think that's fair. We don't have centralised management of expert runtime's yet. It's currently de-coupled via a pull mechanism. Mark Thanks for your help. -- View this message in context: http://drools.46999.n3.nabble.com/Expert-versus-Expert-tp1739141p2819515.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] Drools Guvnor with JasperReport
Hi guys. I have a problem using guvnor + jasperreport, i always receive perm gem space. I tried many forums, all of them said to set jvm memory up, like this : -Xms1024m -Xmx1024m I did it and keep getting the perm gem space error. I want to know if anyone of you guys have been through this problem, if you have some ideas how can i solve it. anything that might help. Thank you. :D -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-with-JasperReport-tp2820516p2820516.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] Retrieving rule configuration
Thanks a lot. It worked perfect. Regards, Randhish From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Thursday, April 14, 2011 6:26 PM To: Rules Users List Subject: Re: [rules-users] Retrieving rule configuration You may have to use a bit from the unstable API: KnowledgePackage kPackage = ...; KnowledgePackageImp kPackageImp = (KnowledgePackageImp)kPackage; for( org.drools.definition.rule.Rule rule: kPackage.getRules() ){ String rName = rule.getName(); org.drools.rule.Rule realRule = (org.drools.rule.Rule)kPackageImp.getRule( rName ); String rfGroup = realRule.getRuleFlowGroup(); } -W 2011/4/14 Randhish Raghavan randhish_ragha...@mindtree.commailto:randhish_ragha...@mindtree.com Hello, A sample rule that I have created is listed below: rule 'Abnormal time MBP Enrollment' dialect 'mvel' ruleflow-group enrl.ruleflowgroup.detailRuleFlowGroup when ruleData : EnrlRuleData() then - end Is there any way I can retrieve the rule flow group name (enrl.ruleflowgroup.detailRuleFlowGroup) when rules are loaded (Ex: using KnowledgeBaseListener)? Thanks Randhish http://www.mindtree.com/email/disclaimer.html ___ rules-users mailing list rules-users@lists.jboss.orgmailto: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 Guvnor with JasperReport
-Xmx does not affect the perm gem space, it stays on 64m use instead -XX:MaxPermSize=512m Op 14-04-11 16:17, danielnb schreef: Hi guys. I have a problem using guvnor + jasperreport, i always receive perm gem space. I tried many forums, all of them said to set jvm memory up, like this : -Xms1024m -Xmx1024m I did it and keep getting the perm gem space error. I want to know if anyone of you guys have been through this problem, if you have some ideas how can i solve it. anything that might help. Thank you. :D -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-with-JasperReport-tp2820516p2820516.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 -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] execute particular rules programmatically and dynamically
On 14 April 2011 16:06, Benson Fung benson.red...@gmail.com wrote: Hi Wolfgang, Please see the following scenario. No, it is Robert's use of metadata I'm questioning. -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rule Templates
Not that I can see any problem. Disregard the Eclipse error, expand the template as documented, and then we'll see what we'll see... -W On 14 April 2011 15:36, FrankVhh frank.vanhoensho...@agserv.eu wrote: Hi W., Thanks for the fast reply. Meanwhile, I have been trying to play with the templates. Unfortunately, I run into a nullpointerexception in the problems view of Eclipse. At first, I hoped it was the same error as in http://lists.jboss.org/pipermail/rules-users/2010-November/017229.html but that does not seem to be the case. Underneath, you can find my drl file. This is the only artifact that I am having right now. There is no Java code yet, apart from the Price object. This shouldn't be necessary to fix the problem either. I tried to comment out some pieces of code to narrow down on the problem. The nullpointerexception persists even if you comment everything from package to the bottom of the file. This should indicate the problem has to be in the template header, but I do not have a clue. Could anyone help with this? Thanks in advance. == template header minimumValue maximumValue precision startlevel endlevel roundingvalue package rounding import rounding.Price; template Determine evaluated decimals rule Determine evaluated decimals @{row.rowNumber} salience 25 lock-on-active true when $price: Price(integerpart = @{minimumValue} integerpart @{maximumValue} evaluateddecimals == 999) then $price.setRoundedPrecision(@{precision}); $price.calculateNumberOfRoundedDecimals(); $price.calculateEvaluatedDecimals(); $price.calculateBasenumber(); update($price); end end template template Determine rounding value rule Determine rounding value @{row.rowNumber} salience 0 no-loop true when $price: Price(integerpart = @{minimumValue} integerpart @{maximumValue} evaluateddecimals = @{startlevel} evaluateddecimals @{endlevel}) then $price.setRoundedPrice($price.getBasenumber() + @{roundingvalue}); System.out.println($price.getPrice() + = + (double) $price.getRoundedPrice() / Math.pow(10,$price.getNumberofroundeddecimals()) ); end end template -- View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820343.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rule Templates
Hi, After trying the example from the documentation, eclipse returned the same error. So, I got the same idea and just worked further ignoring eclipse. I saw what I saw and that was that it works fine now, even with the error still displayed in the problems view. Thanks for the help ;-) Regards, Frank Wolfgang Laun-2 wrote: Not that I can see any problem. Disregard the Eclipse error, expand the template as documented, and then we'll see what we'll see... -W On 14 April 2011 15:36, FrankVhh lt;frank.vanhoensho...@agserv.eugt; wrote: Hi W., Thanks for the fast reply. Meanwhile, I have been trying to play with the templates. Unfortunately, I run into a nullpointerexception in the problems view of Eclipse. At first, I hoped it was the same error as in http://lists.jboss.org/pipermail/rules-users/2010-November/017229.html but that does not seem to be the case. Underneath, you can find my drl file. This is the only artifact that I am having right now. There is no Java code yet, apart from the Price object. This shouldn't be necessary to fix the problem either. I tried to comment out some pieces of code to narrow down on the problem. The nullpointerexception persists even if you comment everything from package to the bottom of the file. This should indicate the problem has to be in the template header, but I do not have a clue. Could anyone help with this? Thanks in advance. == template header minimumValue maximumValue precision startlevel endlevel roundingvalue package rounding import rounding.Price; template Determine evaluated decimals rule Determine evaluated decimals @{row.rowNumber} salience 25 lock-on-active true when $price: Price(integerpart = @{minimumValue} integerpart @{maximumValue} evaluateddecimals == 999) then $price.setRoundedPrecision(@{precision}); $price.calculateNumberOfRoundedDecimals(); $price.calculateEvaluatedDecimals(); $price.calculateBasenumber(); update($price); end end template template Determine rounding value rule Determine rounding value @{row.rowNumber} salience 0 no-loop true when $price: Price(integerpart = @{minimumValue} integerpart @{maximumValue} evaluateddecimals = @{startlevel} evaluateddecimals @{endlevel}) then $price.setRoundedPrice($price.getBasenumber() + @{roundingvalue}); System.out.println($price.getPrice() + = + (double) $price.getRoundedPrice() / Math.pow(10,$price.getNumberofroundeddecimals()) ); end end template -- View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820343.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 -- View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820731.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] Problem with rule: Unexpected exception executing action org.drools.reteoo.PropagationQueuingNode$PropagateAction@631b86c7
Hey I'm getting the following Error Unexpected exception executing action org.drools.reteoo.PropagationQueuingNode$PropagateAction@631b86c7 with one off my rules in my project. The problem is linked with the use of two after statements in one rule. If I delete one of them everything works like a charm. The rule looks like this: // Regeln rule Vergessene Herdplatte when // Platte wurde eingeschaltet und es steht kein Topf auf ihr $platte: HerdplatteEingeschaltet( plateOccupied == false ) from entry-point events // und in den nächsten 20 sek wird die gleiche Platte nicht ausgeschaltet not( HerdplatteAusgeschaltet( this.nummer == $platte.nummer, this after[0s,20s] $platte ) from entry-point events ) // oder es wird in den nächsten 20 sek kein Topf auf die Platte gestellt not( TopfAufHerdplatte( this.nummer == $platte.nummer, this after[0s,20s] $platte ) from entry-point events ) then System.out.println(Vergessene Herdplatte erkannt!); end If I comment one of the not-clause out, it works. I created an unit-test http://drools.46999.n3.nabble.com/file/n2821121/TestProject.zip TestProject.zip which reproduces the exception. And here the Failure Trace: org.drools.RuntimeDroolsException: Unexpected exception executing action org.drools.reteoo.PropagationQueuingNode$PropagateAction@631b86c7 at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1473) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:182) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:145) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:96) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:44) at com.sample.FusionTest.testRule(FusionTest.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.NullPointerException at org.drools.time.impl.CompositeMaxDurationTimer.createTrigger(CompositeMaxDurationTimer.java:58) at org.drools.common.Scheduler.scheduleAgendaItem(Scheduler.java:55) at org.drools.common.DefaultAgenda.scheduleItem(DefaultAgenda.java:314) at org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:185) at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:78) at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:101) at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:78) at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:101) at
Re: [rules-users] execute particular rules programmatically and dynamically
Hi Bob, Let me try to implement the AgendaFIlter : import java.util.List; import org.drools.runtime.rule.Activation; import org.drools.runtime.rule.AgendaFilter; public class RuleNameContainsAgendaFilter implements AgendaFilter { private ListString rules; public RuleNameContainsAgendaFilter(ListString rules) { this.rules = rules; } public boolean accept(Activation activation) { // TODO Auto-generated method stub String activationRuleName = activation.getRule().getName(); if(rules.contains(activationRuleName)) { return true; } else { return false; } } } I think the above the AgendaFilter can resolve the particular rule execution value, i.e. Just pass all the specific rule into a List object and create the above AgendaFilter, then those particular rule can be executed. Please comment. Benson On Thu, Apr 14, 2011 at 5:38 PM, Robert Christenson r...@akc.org wrote: We've come across something similar in our project just recently as well. We have a requirement to have some rules activate based on a tab-off action but also at a higher level (such as validating an entire event entry in the GUI). I also need these rules to activate if initiated from an external webservice (no GUI at all). What we've decided to utilize is a meta identifier in certain rules called FieldsAffected which may contain a delimited list of field identifiers. An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field. Our RHS creates a validation msg which contains the field identifiers so that the calling GUI can display the proper msgs to the field. This allows us to support multiple call scenarios without duplicating the logic in multiple rules just based on context info. Hope this helps, Bob Christenson -- Message: 2 Date: Thu, 14 Apr 2011 15:23:44 +0800 From: Benson Fung benson.red...@gmail.com Subject: Re: [rules-users] execute particular rules programmatically and dynamically To: Rules Users List rules-users@lists.jboss.org Message-ID: BANLkTi=OGO=rwfenybhm144gvst+p_k...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :) Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 ? salience 1 ? dialect mvel ??? when ? ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ? ? ? ad : ApplicationData( age == || ( ?== null )) ? ? then ? ??? ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? ?The customer will ask if they have 1 rules in the rulebase. ?And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. ?editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. ?Therefore, Rule3 can be shared for these 3 editbox validation, right? ?However, for the context variable approach, it seems Rule3 cannot be shared for another editbox with same value range validation. ?So these could be a key for the BRMS/Drools. Benson 2011/4/14 Michael Anstis michael.ans...@gmail.com: Sure, whenever you copy values from your UI to your model for validation you also enter a fact representing the context of the values. Using your example you have two edit boxes on one screen and your rule simply checks for the value of a single edit box; in this case the context differentiates the two. Walking your example: (1) When editbox 1 looses focus you copy the value from the
Re: [rules-users] execute particular rules programmatically and dynamically
I believe Wolfgang's (and my) fear is that you are re-inventing the wheel. Writing your own AgendaFilter is in essence achieving the same function as having an additional Fact in your rule that prevents the rule's activation appearing on the agenda in the first place. Using an AgendaFilter will allow you to prevent a rule that has been matched and placed on the agenda from executing. Not that it won't work; it's just that if smells bad. Just trying to be helpful :) Mike On 14 April 2011 18:51, Benson Fung benson.red...@gmail.com wrote: Hi Bob, Let me try to implement the AgendaFIlter : import java.util.List; import org.drools.runtime.rule.Activation; import org.drools.runtime.rule.AgendaFilter; public class RuleNameContainsAgendaFilter implements AgendaFilter { private ListString rules; public RuleNameContainsAgendaFilter(ListString rules) { this.rules = rules; } public boolean accept(Activation activation) { // TODO Auto-generated method stub String activationRuleName = activation.getRule().getName(); if(rules.contains(activationRuleName)) { return true; } else { return false; } } } I think the above the AgendaFilter can resolve the particular rule execution value, i.e. Just pass all the specific rule into a List object and create the above AgendaFilter, then those particular rule can be executed. Please comment. Benson On Thu, Apr 14, 2011 at 5:38 PM, Robert Christenson r...@akc.org wrote: We've come across something similar in our project just recently as well. We have a requirement to have some rules activate based on a tab-off action but also at a higher level (such as validating an entire event entry in the GUI). I also need these rules to activate if initiated from an external webservice (no GUI at all). What we've decided to utilize is a meta identifier in certain rules called FieldsAffected which may contain a delimited list of field identifiers. An AgendaFilter implementation is created for GUI side requests and passed to fireAllRules. The filter implementation compares any/all field identifiers passed within the request and keeps only those activations which contain the field identifier in it's metadata field. Our RHS creates a validation msg which contains the field identifiers so that the calling GUI can display the proper msgs to the field. This allows us to support multiple call scenarios without duplicating the logic in multiple rules just based on context info. Hope this helps, Bob Christenson -- Message: 2 Date: Thu, 14 Apr 2011 15:23:44 +0800 From: Benson Fung benson.red...@gmail.com Subject: Re: [rules-users] execute particular rules programmatically anddynamically To: Rules Users List rules-users@lists.jboss.org Message-ID: BANLkTi=OGO=rwfenybhm144gvst+p_k...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Thanks Michael, let me think about your solution seriously afterwards. Actually, I am using GWT. I would like to say that sometimes customer's requirement is picky and unexpectable. They really want to have close coupling between UI and Rules. haha. :)Do you think it is helpless as a consultant??? :~( If anyone has another idea of this scenario, you are welcome to post your idea out there. Thank you very much 2011/4/14 Michael Anstis michael.ans...@gmail.com: In my example Rule 1 was shared between screen1.panel1.editbox1 and screen1.panel1.editbox2:- rule Rule1 ? salience 1 ? dialect mvel ??? when ? ApplicationContext( context in (screen1.panel1.editbox1, screen1.panel1.editbox2) ) ? ? ? ad : ApplicationData( age == || ( ?== null )) ? ? then ? ??? ad.setReturnMsg( \n age should not be null or empty ); end This is an approach and may not be the best available; I was trying to demonstrate how your problem can be solved without having to worry about explicitly executing individual rules.For example, depending on what UI technology you are using (Swing, JSF) you could subclass the UI components and use these as facts - but such close coupling between UI and Rules may be undesirable. With kind regards, Mike On 14 April 2011 03:52, Benson Fung benson.red...@gmail.com wrote: Good, Michael. 'context' is used to distinguish which part of the UI which will be validated, right? ?The customer will ask if they have 1 rules in the rulebase. ?And some of them are redundant, so they want to make some of the rules share with several part of UI, e.g. ?editbox 6, editbox 7 and editbox 8 these 3 boxes' value range is within 0 and 600. ?Therefore, Rule3 can be shared for these 3 editbox validation, right? ?However, for the context variable
Re: [rules-users] Problem with rule: Unexpected exception executing action org.drools.reteoo.PropagationQueuingNode$PropagateAction@631b86c7
Hey, yes you are right. Should be or instead of the implicit and. I will correct that and maybe I can circumvent the problem. JIRA and test case are already postet under https://issues.jboss.org/browse/JBRULES-2957 https://issues.jboss.org/browse/JBRULES-2957 . Thanks for your help. Regards. Armin -- View this message in context: http://drools.46999.n3.nabble.com/Problem-with-rule-Unexpected-exception-executing-action-org-drools-reteoo-PropagationQueuingNode-Pro7-tp2821121p2821528.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] Drools Guvnor with JasperReport
I didn't know about that. thank you a lot. 2011/4/14 Geoffrey De Smet ge0ffrey.s...@gmail.com -Xmx does not affect the perm gem space, it stays on 64m use instead -XX:MaxPermSize=512m Op 14-04-11 16:17, danielnb schreef: Hi guys. I have a problem using guvnor + jasperreport, i always receive perm gem space. I tried many forums, all of them said to set jvm memory up, like this : -Xms1024m -Xmx1024m I did it and keep getting the perm gem space error. I want to know if anyone of you guys have been through this problem, if you have some ideas how can i solve it. anything that might help. Thank you. :D -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-with-JasperReport-tp2820516p2820516.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 -- With kind regards, Geoffrey De Smet ___ 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