Re: [rules-users] java.lang.ArrayIndexOutOfBoundsException at Frame
Does your problem remain? The DRL and Java code appear fine. If you are still having problems, please explain your entire process to replicate the problem: from authoring in Guvnor, to creating a KnowledgeBase, Session and calling fireAllRules. Can you please also advise if the problem remains if you don't include the @Data and @EqualsAndHashCode annotations on your bean (not knowing what they do, or how they might affect drools-expert, it is worth removing them to try and isolate the cause of your problem). With kind regards, Mike 2012/1/19 mujoko mujoko mujoko.muj...@gmail.com Hi Here is my CDR class package com.rbtsb.tm.meter.model; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.log4j.Logger; /** * This Class is the same as CDRRepository with additional 2 attribute, and * created for Rule Purpose. * * @author akhfa */ @Data @EqualsAndHashCode(callSuper = false) public class CDR implements CSVData { /** * log Injected. */ private static final Logger LOG = Logger.getLogger(CDR.class); /** * nxxSrvUsageCode. */ private String nxxSrvUsageCode; /** * aNumber. */ private String aNumber; /** * bNumber. */ private String bNumber; /** * cNumber. */ private String cNumber; /** * stdTollUsageDate. */ private String stdTollUsageDate; /** this is helper for stdTollUsage date with format 'mmdd'. */ private Date usageDate; /** getter for usageDate, for ruleEngine purpose. */ public Date getUsageDate() { // txt format 'mmdd' String strDate = this.stdTollUsageDate; DateFormat formatter = new SimpleDateFormat(MMdd); try { this.usageDate = formatter.parse(strDate); } catch (ParseException pe) { LOG.error(pe.getMessage()); } return this.usageDate; } /** * stdTollStartTime. */ private String stdTollStartTime; /** * tollRatedFullAmount. */ private String tollRatedFullAmount; /** * tollRatedChargedAmount. */ private String tollRatedChargedAmount; /** * tollSurchargeAmount. */ private String tollSurchargeAmount; /** * stdTollDurationTime. */ private String stdTollDurationTime; /** * geogLocName. */ private String geogLocName; /** * callClassCode. */ private String callClassCode; /** * callTypeCode. */ private String callTypeCode; /** * billingChargeCode. */ private String billingChargeCode; /** * billingClassCode. */ private String billingClassCode; /** * tlDiscountCode. */ private String tlDiscountCode; /** * remarksA. */ private String remarksA; /** * remarksB. */ private String remarksB; /** * rateBandCode. */ private String rateBandCode; /** * emergenSpareOlnosIndicator. */ private String emergenSpareOlnosIndicator; /** * ttmc. */ private String ttmc; /** * mobileAlphaCode. */ private String mobileAlphaCode; /** * customerProfile */ private CustomerProfile customerProfile; private String tag = 0; /** * TosDatCode List */ // private ListTosDatCode tosDatCodeList = null; /** Boolean field for rule purpose. */ private Boolean isDrop = false; /** Boolean field for rule purpose. */ // private Boolean isTag = false; /** For rule purpose, describe reason why CDR is dropped. */ private String dropReason; /** For rule purpose, ProductTagging. */ private String productName; /** For rule purpose, ProductTagging. */ private String specialIndicator; /** For rule purpose, ProductTagging. */ private String productRuleName; public boolean isDrop() { return isDrop; } } On Wed, Jan 18, 2012 at 7:57 PM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Please show field and getter declarations in class CDR -W On 18/01/2012, mujoko mujoko mujoko.muj...@gmail.com wrote: For your info, for the same rules. It's not always happen, the error some times coming. For me the rule is fine (I used guvnor) Here is the rule import com.rbtsb.tm.meter.model.CDR; import org.apache.log4j.Logger; global Logger log; rule ProductTag-FixedSMS when $cdr : CDR(callClassCode == F1 || callClassCode == F2 ) then $cdr.setProductName(fixedsms); end 2012/1/18 Michael Anstis michael.ans...@gmail.com You're going to give a little more information, such as the DRL you're unable to compile. 2012/1/18 mujoko mujoko mujoko.muj...@gmail.com Hi Drools Users, I'm new member, Mujoko. I got issue regarding my rules. Several times got exception when trying to create KnowledgeSession. I used drools-core 5.3.0.Final and drools-compiler 5.3.0.Final. java.lang.ArrayIndexOutOfBoundsException: -1 at org.mvel2.asm.Frame.merge(Frame.java:1373) at org.mvel2.asm.Frame.merge(Frame.java:1350) at
[rules-users] Can we set a default value for emlpty cells in Drools templates
Hi, I am trying to write a template and came across a scenario where one of the condition cell $a : Company(condition), When condition is left blank then entire predicate is missed and iam using the ref of the company obj $a to set some values which is failing as the declaration part is missing, So i was thinking, if we can have a default value to the cell as $a : Company(), then the scenario will be handled.Kindly let me know how to implement the default value for a cell in template to overcome the above mentioned scenario Thanks Swaroop -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-set-a-default-value-for-emlpty-cells-in-Drools-templates-tp3674849p3674849.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] FireAllRules for all agenda
Thanks for your reply. Yes, in this it can be done. But WHat I meant here, is there any Drools API available to support it? -- View this message in context: http://drools.46999.n3.nabble.com/FireAllRules-for-all-agenda-tp3674638p3674909.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] Can we set a default value for emlpty cells in Drools templates
There isn't a nice way to do this unfortunately. One hack around it is to have two columns with the object merged across them The first column would have the condition $a : Company(this != $param), every cell in the column is then given the value 'null'. This would then always ensure that $a will always exist. The second column can then be written as normal with your optional condition. Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of swaroop Sent: 20 January 2012 08:34 To: rules-users@lists.jboss.org Subject: [rules-users] Can we set a default value for emlpty cells in Drools templates Hi, I am trying to write a template and came across a scenario where one of the condition cell $a : Company(condition), When condition is left blank then entire predicate is missed and iam using the ref of the company obj $a to set some values which is failing as the declaration part is missing, So i was thinking, if we can have a default value to the cell as $a : Company(), then the scenario will be handled.Kindly let me know how to implement the default value for a cell in template to overcome the above mentioned scenario Thanks Swaroop -- View this message in context: http://drools.46999.n3.nabble.com/Can-we- set-a-default-value-for-emlpty-cells-in-Drools-templates- tp3674849p3674849.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 ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Guvnor deployment problem on websphere 6.1
On 2012/1/19 19:29, arup wrote: I have modified the pom.xml as mentioned in https://community.jboss.org/wiki/DeployingGuvnor5OnWebSphere; . also created the custom propertied in WAS. but after installing the guvnor 5.1 war when i'm trying to get the login page hitting the url i'm just getting a blank page. I'm new to drools and not getting where the problem is...can you please tell me step by step process to follow to install guvnor in WAS. Hi, I dont have experience with WAS, hopefully someone else in the community can help you out. At the same time, you may want to look into WAS server log to check what errors you've got. The whole point of modifying pom is to add jars that are required by Guvnor but not provided by WAS container. This requires rebuilding Guvnor from source. You do not have to take this approach. Just take a look at the server log, if you see any ClassNotFound exception, try to add the corresponding jars to Guvnor war. That may help you moving forward. Cheers, Jervis Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-deployment-problem-on-websphere-6-1-tp3672065p3672065.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] Rules Evaluation based on agenda
Hi, We have many agenda-group based rules defined in application and while firing rules, we set specifc agend group based on different use cases to the session. In evaluation phase of rules, it not only evaluate rules related with agenda set to the session but also other rules which are not belong to the same agenda which is set to the session. Now problem here is: since some time we get error, if a inserted fact is used in other agenda group and their nested objects are not initialized which are used in condition, it throws errors and exit. if Drools could provide filtering capablitiy at evaluation time like wise AgendaFilter is provided to filter activated rules, it will be great. If there is any workaround it will be a great help. Thanks in advance -V -- View this message in context: http://drools.46999.n3.nabble.com/Rules-Evaluation-based-on-agenda-tp3674950p3674950.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] Rules Evaluation based on agenda
The best solution is to only insert the rulse you actually want into the knowledge base. Another option may be not to use agenda groups (or just agenda groups) but have a control fact as the first condition of all your rules eg when UseCase(name ==abc) ... Then Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Vis Sent: 20 January 2012 09:34 To: rules-users@lists.jboss.org Subject: [rules-users] Rules Evaluation based on agenda Hi, We have many agenda-group based rules defined in application and while firing rules, we set specifc agend group based on different use cases to the session. In evaluation phase of rules, it not only evaluate rules related with agenda set to the session but also other rules which are not belong to the same agenda which is set to the session. Now problem here is: since some time we get error, if a inserted fact is used in other agenda group and their nested objects are not initialized which are used in condition, it throws errors and exit. if Drools could provide filtering capablitiy at evaluation time like wise AgendaFilter is provided to filter activated rules, it will be great. If there is any workaround it will be a great help. Thanks in advance -V -- View this message in context: http://drools.46999.n3.nabble.com/Rules- Evaluation-based-on-agenda-tp3674950p3674950.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 ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rules Evaluation based on agenda
Maybe this can be of interest? http://blog.athico.com/2011/08/declarative-agenda-and-control-rules.html -- View this message in context: http://drools.46999.n3.nabble.com/Rules-Evaluation-based-on-agenda-tp3674950p3674977.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] Declarative fact model or Java?
Hi folks,I quite like the clean separation provided by maintaining a declarative fact model rather than a Java model. In particular to me, it seems to make it easier to manage rules in Guvnor separate from my runtime environment. However I can also see how maintaining a Java model simplifies some activities, avoiding having to map between and external Java model and an internal representation, and making it easy to modify facts from within a knowledge session.Is there anybody out there who has experience doing a number of projects both ways, and has developed an opinion on whether one is preferable the other? Or is there perhaps more of a decision tree pertaining to which is better in particular situations?And on a side-note, is there anything out there that helps with mapping between Java beans and declarative facts? I was wondering about hacking up some AOP aspects to enable me to annotate a Java model in a slightly JPA/ORM style to help with mapping/marshalling between the two.Thanks for any thoughts.Stevestephen.mast...@me.com___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.ArrayIndexOutOfBoundsException at Frame
I'll inform if the error still remains. Need to test with big data. @Data and @EqualsAndHashCode annotation is lombok library to create setter and getter while compile. 2012/1/20 Michael Anstis michael.ans...@gmail.com Does your problem remain? The DRL and Java code appear fine. If you are still having problems, please explain your entire process to replicate the problem: from authoring in Guvnor, to creating a KnowledgeBase, Session and calling fireAllRules. Can you please also advise if the problem remains if you don't include the @Data and @EqualsAndHashCode annotations on your bean (not knowing what they do, or how they might affect drools-expert, it is worth removing them to try and isolate the cause of your problem). With kind regards, Mike 2012/1/19 mujoko mujoko mujoko.muj...@gmail.com Hi Here is my CDR class package com.rbtsb.tm.meter.model; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.log4j.Logger; /** * This Class is the same as CDRRepository with additional 2 attribute, and * created for Rule Purpose. * * @author akhfa */ @Data @EqualsAndHashCode(callSuper = false) public class CDR implements CSVData { /** * log Injected. */ private static final Logger LOG = Logger.getLogger(CDR.class); /** * nxxSrvUsageCode. */ private String nxxSrvUsageCode; /** * aNumber. */ private String aNumber; /** * bNumber. */ private String bNumber; /** * cNumber. */ private String cNumber; /** * stdTollUsageDate. */ private String stdTollUsageDate; /** this is helper for stdTollUsage date with format 'mmdd'. */ private Date usageDate; /** getter for usageDate, for ruleEngine purpose. */ public Date getUsageDate() { // txt format 'mmdd' String strDate = this.stdTollUsageDate; DateFormat formatter = new SimpleDateFormat(MMdd); try { this.usageDate = formatter.parse(strDate); } catch (ParseException pe) { LOG.error(pe.getMessage()); } return this.usageDate; } /** * stdTollStartTime. */ private String stdTollStartTime; /** * tollRatedFullAmount. */ private String tollRatedFullAmount; /** * tollRatedChargedAmount. */ private String tollRatedChargedAmount; /** * tollSurchargeAmount. */ private String tollSurchargeAmount; /** * stdTollDurationTime. */ private String stdTollDurationTime; /** * geogLocName. */ private String geogLocName; /** * callClassCode. */ private String callClassCode; /** * callTypeCode. */ private String callTypeCode; /** * billingChargeCode. */ private String billingChargeCode; /** * billingClassCode. */ private String billingClassCode; /** * tlDiscountCode. */ private String tlDiscountCode; /** * remarksA. */ private String remarksA; /** * remarksB. */ private String remarksB; /** * rateBandCode. */ private String rateBandCode; /** * emergenSpareOlnosIndicator. */ private String emergenSpareOlnosIndicator; /** * ttmc. */ private String ttmc; /** * mobileAlphaCode. */ private String mobileAlphaCode; /** * customerProfile */ private CustomerProfile customerProfile; private String tag = 0; /** * TosDatCode List */ // private ListTosDatCode tosDatCodeList = null; /** Boolean field for rule purpose. */ private Boolean isDrop = false; /** Boolean field for rule purpose. */ // private Boolean isTag = false; /** For rule purpose, describe reason why CDR is dropped. */ private String dropReason; /** For rule purpose, ProductTagging. */ private String productName; /** For rule purpose, ProductTagging. */ private String specialIndicator; /** For rule purpose, ProductTagging. */ private String productRuleName; public boolean isDrop() { return isDrop; } } On Wed, Jan 18, 2012 at 7:57 PM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Please show field and getter declarations in class CDR -W On 18/01/2012, mujoko mujoko mujoko.muj...@gmail.com wrote: For your info, for the same rules. It's not always happen, the error some times coming. For me the rule is fine (I used guvnor) Here is the rule import com.rbtsb.tm.meter.model.CDR; import org.apache.log4j.Logger; global Logger log; rule ProductTag-FixedSMS when $cdr : CDR(callClassCode == F1 || callClassCode == F2 ) then $cdr.setProductName(fixedsms); end 2012/1/18 Michael Anstis michael.ans...@gmail.com You're going to give a little more information, such as the DRL you're unable to compile. 2012/1/18 mujoko mujoko mujoko.muj...@gmail.com Hi Drools Users, I'm new member, Mujoko. I got issue regarding my rules. Several times got exception when trying to create KnowledgeSession. I used drools-core 5.3.0.Final and drools-compiler
Re: [rules-users] Can we set a default value for emlpty cells in Drools templates
We have also added the ability to use BRL Fragments as columns in the guided Decision tables (for 5.4.0.beta2). http://blog.athico.com/2012/01/guided-decision-table-supports-brl.html You could then define a column as:- $c : Company() Company (this == $c, something = {templateKey} ) In rows where you don't specify a value for templateKey remaining patterns (i.e. $c : Company()) are still appended to the resulting DRL. Furthermore the bound Company, $c, can be referenced either in other BRL fragments or regular decision table columns. On 20 January 2012 09:25, Swindells, Thomas tswinde...@nds.com wrote: There isn't a nice way to do this unfortunately. One hack around it is to have two columns with the object merged across them The first column would have the condition $a : Company(this != $param), every cell in the column is then given the value 'null'. This would then always ensure that $a will always exist. The second column can then be written as normal with your optional condition. Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of swaroop Sent: 20 January 2012 08:34 To: rules-users@lists.jboss.org Subject: [rules-users] Can we set a default value for emlpty cells in Drools templates Hi, I am trying to write a template and came across a scenario where one of the condition cell $a : Company(condition), When condition is left blank then entire predicate is missed and iam using the ref of the company obj $a to set some values which is failing as the declaration part is missing, So i was thinking, if we can have a default value to the cell as $a : Company(), then the scenario will be handled.Kindly let me know how to implement the default value for a cell in template to overcome the above mentioned scenario Thanks Swaroop -- View this message in context: http://drools.46999.n3.nabble.com/Can-we- set-a-default-value-for-emlpty-cells-in-Drools-templates- tp3674849p3674849.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 ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] FireAllRules for all agenda
Not by a single method call, if that's what you mean. (All the operations I indicated are part of the API.) -W On 20/01/2012, Vis vnd...@gmail.com wrote: Thanks for your reply. Yes, in this it can be done. But WHat I meant here, is there any Drools API available to support it? -- View this message in context: http://drools.46999.n3.nabble.com/FireAllRules-for-all-agenda-tp3674638p3674909.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] Declarative fact model or Java?
Hi Steve, let me share my thoughts on this. You will probably want to use a Java model when it's already available :) Or when you're using the rule engine to implement the business logic layer of your application, processing data coming from an external source. A DRL model, instead, is definitely recommended for temporary facts, or data structures which are used by the rules to do their computations. The main problem with DRL fact classes is that they're quite cumbersome to use outside the rule engine. On the other hand, you will be sure that the declared types will correspond to an implementation fully compatible and optimized for the rule engine. Very roughly : if the rule engine is a component in a larger architecture, use java classes. If you're building a rule-based application - i.e. DRL is your programming language and Drools is your execution environment, go for DRL. As for mapping, we have added this very experimental feature lately: http://blog.athico.com/2011/12/new-feature-spotlight-traits-part-1.html http://blog.athico.com/2011/12/dynamic-typing-in-rules-traits-part-2.html I have plans to use annotations to improve the mapping, avoiding the 1-1 correspondence between fields, so if you want to contribute, if only to the specifications, let us know :) Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Declarative-fact-model-or-Java-tp3675001p3675181.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] Declarative fact model or Java?
Hi Davide,Thanks for your thoughts.The application is just a service which takes an XML request, converts that into a fact and inserts that into the working memory. Based on rule evaluations, it responds to the client with more XML indicating whether the requested action is permitted.On of the key aims of the project is to enable management of some rules by 'the business' through Guvnor. The current 1-1 mapping you mention is partly what put me off using Java models, as it leads to 'technical' attributes being present in the Guvnor fact model, which are not relevant to the business. The more I can keep the fact model within Guvnor minimal, the better.So following your logic, given that:There is no legacy model to deal with.~80% of what is going on will be within Drools, with the Java code just to insert/update facts and marshal XML.I would really like to avoid a 1-1 mapping of Java classes to DRL facts I think I'll stick with DRL facts.Given that I'm not too sure exactly what I want out of it yet, I'm not sure how much I could contribute to a spec, but I'd be happy to help out with things. If only by testing out early code and providing feedback. If there's anything you think I might be able to help out with, feel free to ping me an email.Many thanks,Stevestephen.mast...@me.comOn Jan 20, 2012, at 11:44 AM, Davide Sottara dso...@gmail.com wrote:Hi Steve, let me share my thoughts on this. You will probably want to use a Java model when it's already available :) Or when you're using the rule engine to implement the business logic layer of your application, processing data coming from an external source. A DRL model, instead, is definitely recommended for "temporary" facts, or data structures which are used by the rules to do their computations. The main problem with DRL fact classes is that they're quite cumbersome to use outside the rule engine. On the other hand, you will be sure that the declared types will correspond to an implementation fully compatible and optimized for the rule engine. Very roughly : if the rule engine is a component in a larger architecture, use java classes. If you're building a rule-based application - i.e. DRL is your programming language and Drools is your execution environment, go for DRL. As for mapping, we have added this very experimental feature lately: http://blog.athico.com/2011/12/new-feature-spotlight-traits-part-1.html http://blog.athico.com/2011/12/dynamic-typing-in-rules-traits-part-2.html I have plans to use annotations to improve the mapping, avoiding the 1-1 correspondence between fields, so if you want to contribute, if only to the specifications, let us know :) Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Declarative-fact-model-or-Java-tp3675001p3675181.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] Declarative fact model or Java?
Let me mention that I've used Java classes derived from XML Schema as facts. If there are technical properties you'd like to hide from the rule programmer, define a business type and extend it with the technical properties. The rule programmer must make do with the business type, which is possible even if the object (fact) type is the technical subclass. -W On 20/01/2012, Stephen Masters stephen.mast...@me.com wrote: Hi Davide, Thanks for your thoughts. The application is just a service which takes an XML request, converts that into a fact and inserts that into the working memory. Based on rule evaluations, it responds to the client with more XML indicating whether the requested action is permitted. On of the key aims of the project is to enable management of some rules by 'the business' through Guvnor. The current 1-1 mapping you mention is partly what put me off using Java models, as it leads to 'technical' attributes being present in the Guvnor fact model, which are not relevant to the business. The more I can keep the fact model within Guvnor minimal, the better. So following your logic, given that: There is no legacy model to deal with. ~80% of what is going on will be within Drools, with the Java code just to insert/update facts and marshal XML. I would really like to avoid a 1-1 mapping of Java classes to DRL facts. ... I think I'll stick with DRL facts. Given that I'm not too sure exactly what I want out of it yet, I'm not sure how much I could contribute to a spec, but I'd be happy to help out with things. If only by testing out early code and providing feedback. If there's anything you think I might be able to help out with, feel free to ping me an email. Many thanks, Steve stephen.mast...@me.com On Jan 20, 2012, at 11:44 AM, Davide Sottara dso...@gmail.com wrote: Hi Steve, let me share my thoughts on this. You will probably want to use a Java model when it's already available :) Or when you're using the rule engine to implement the business logic layer of your application, processing data coming from an external source. A DRL model, instead, is definitely recommended for temporary facts, or data structures which are used by the rules to do their computations. The main problem with DRL fact classes is that they're quite cumbersome to use outside the rule engine. On the other hand, you will be sure that the declared types will correspond to an implementation fully compatible and optimized for the rule engine. Very roughly : if the rule engine is a component in a larger architecture, use java classes. If you're building a rule-based application - i.e. DRL is your programming language and Drools is your execution environment, go for DRL. As for mapping, we have added this very experimental feature lately: http://blog.athico.com/2011/12/new-feature-spotlight-traits-part-1.html http://blog.athico.com/2011/12/dynamic-typing-in-rules-traits-part-2.html I have plans to use annotations to improve the mapping, avoiding the 1-1 correspondence between fields, so if you want to contribute, if only to the specifications, let us know :) Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Declarative-fact-model-or-Java-tp3675001p3675181.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] Infinit loop in simple example
import spikes.Applicant rule Is of valid age when $a : Applicant( age 18 ) then modify( $a ) { valid = false }; end By using modify() you are telling the engine that $a was modified in some way. This causes the re-evaluation of your rule, and since $a.age is still 18, then the rule is activated and fired infinite times. Read the documentation manual about some attributes you can use in your rules to avoid this behavior: no-loop, lock-on-active. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Fri, Jan 20, 2012 at 3:12 PM, roland.kofler roland.kof...@gmail.comwrote: Simple example loops ad infinitum if executed: package spikes; import org.springframework.roo.addon.javabean.RooJavaBean; @RooJavaBean public class Applicant { private final String string; private final int age; public boolean valid=true; public Applicant(String string, int i) { this.string = string; this.age = i; } } DroolsSpikeTest package spikes; import static org.junit.Assert.*; import org.drools.KnowledgeBase; import org.drools.runtime.StatelessKnowledgeSession; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={classpath:**/applicationContext-drools.xml}) public class DroolsSpikeTest { @Autowired private KnowledgeBase kbase; @Test public void testspikeDroolRule() { StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); Applicant a = new Applicant(Mr John Smith, 16); assertTrue(a.isValid()); ksession.execute(a); assertFalse(a.isValid()); } } applicationContext-drools.xml ?xml version=1.0 encoding=UTF-8 standalone=no? beans xmlns=http://www.springframework.org/schema/beans; xmlns:aop=http://www.springframework.org/schema/aop; xmlns:context=http://www.springframework.org/schema/context; xmlns:jee=http://www.springframework.org/schema/jee; xmlns:tx=http://www.springframework.org/schema/tx; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:drools=http://drools.org/schema/drools-spring; xsi:schemaLocation=http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd drools:kbase id=kbase1 drools:resources drools:resource id=licenseRule type=DRL source=classpath:spikes/licenseApplication.drl/ /drools:resources drools:configuration drools:mbeans enabled=true / /drools:configuration /drools:kbase drools:ksession kbase=kbase1 type=stateless id=ksessionStateless name=stateless1 /drools:ksession /beans licenseApplication.drl import spikes.Applicant rule Is of valid age when $a : Applicant( age 18 ) then modify( $a ) { valid = false }; end -- View this message in context: http://drools.46999.n3.nabble.com/Infinit-loop-in-simple-example-tp3675536p3675536.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] Infinit loop in simple example
Simple example loops ad infinitum if executed: package spikes; import org.springframework.roo.addon.javabean.RooJavaBean; @RooJavaBean public class Applicant { private final String string; private final int age; public boolean valid=true; public Applicant(String string, int i) { this.string = string; this.age = i; } } DroolsSpikeTest package spikes; import static org.junit.Assert.*; import org.drools.KnowledgeBase; import org.drools.runtime.StatelessKnowledgeSession; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={classpath:**/applicationContext-drools.xml}) public class DroolsSpikeTest { @Autowired private KnowledgeBase kbase; @Test public void testspikeDroolRule() { StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); Applicant a = new Applicant(Mr John Smith, 16); assertTrue(a.isValid()); ksession.execute(a); assertFalse(a.isValid()); } } applicationContext-drools.xml ?xml version=1.0 encoding=UTF-8 standalone=no? beans xmlns=http://www.springframework.org/schema/beans; xmlns:aop=http://www.springframework.org/schema/aop; xmlns:context=http://www.springframework.org/schema/context; xmlns:jee=http://www.springframework.org/schema/jee; xmlns:tx=http://www.springframework.org/schema/tx; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:drools=http://drools.org/schema/drools-spring; xsi:schemaLocation=http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd; drools:kbase id=kbase1 drools:resources drools:resource id=licenseRule type=DRL source=classpath:spikes/licenseApplication.drl/ /drools:resources drools:configuration drools:mbeans enabled=true / /drools:configuration /drools:kbase drools:ksession kbase=kbase1 type=stateless id=ksessionStateless name=stateless1 /drools:ksession /beans licenseApplication.drl import spikes.Applicant rule Is of valid age when $a : Applicant( age 18 ) then modify( $a ) { valid = false }; end -- View this message in context: http://drools.46999.n3.nabble.com/Infinit-loop-in-simple-example-tp3675536p3675536.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] Fusion historical data analysis
Hi, unfortunately I haven't found any way to set the pseudo clock according to timestamp (the session.insert()) in org.jboss.soa.esb.actions.BusinessRulesProcessor which I am using to fire the rules from ESB. I'll try to write my own class to fire the rules, where I can also use session.insert() to synchronize the clock. the only thing I do not understand is, why it is possible to set the property name=ruleClockType value=PSEUDO / in ESB, but I have no property to control the session clock... Thank you for your help. r. -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-historical-data-analysis-tp3673562p3675583.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] Infinit loop in simple example
The simplist solution is just to change your condition to be $a : Applicant(age 18, valid != false) Thomas From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Esteban Aliverti Sent: 20 January 2012 14:20 To: Rules Users List Subject: Re: [rules-users] Infinit loop in simple example import spikes.Applicant rule Is of valid age when $a : Applicant( age 18 ) then modify( $a ) { valid = false }; end By using modify() you are telling the engine that $a was modified in some way. This causes the re-evaluation of your rule, and since $a.age is still 18, then the rule is activated and fired infinite times. Read the documentation manual about some attributes you can use in your rules to avoid this behavior: no-loop, lock-on-active. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Fri, Jan 20, 2012 at 3:12 PM, roland.kofler roland.kof...@gmail.commailto:roland.kof...@gmail.com wrote: Simple example loops ad infinitum if executed: package spikes; import org.springframework.roo.addon.javabean.RooJavaBean; @RooJavaBean public class Applicant { private final String string; private final int age; public boolean valid=true; public Applicant(String string, int i) { this.string = string; this.age = i; } } DroolsSpikeTest package spikes; import static org.junit.Assert.*; import org.drools.KnowledgeBase; import org.drools.runtime.StatelessKnowledgeSession; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={classpath:**/applicationContext-drools.xml}) public class DroolsSpikeTest { @Autowired private KnowledgeBase kbase; @Test public void testspikeDroolRule() { StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); Applicant a = new Applicant(Mr John Smith, 16); assertTrue(a.isValid()); ksession.execute(a); assertFalse(a.isValid()); } } applicationContext-drools.xml ?xml version=1.0 encoding=UTF-8 standalone=no? beans xmlns=http://www.springframework.org/schema/beans; xmlns:aop=http://www.springframework.org/schema/aop; xmlns:context=http://www.springframework.org/schema/context; xmlns:jee=http://www.springframework.org/schema/jee; xmlns:tx=http://www.springframework.org/schema/tx; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:drools=http://drools.org/schema/drools-spring; xsi:schemaLocation=http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://drools.org/schema/drools-spring http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd; drools:kbase id=kbase1 drools:resources drools:resource id=licenseRule type=DRL source=classpath:spikes/licenseApplication.drl/ /drools:resources drools:configuration drools:mbeans enabled=true / /drools:configuration /drools:kbase drools:ksession kbase=kbase1 type=stateless id=ksessionStateless name=stateless1 /drools:ksession /beans licenseApplication.drl import spikes.Applicant rule Is of valid age when $a : Applicant( age 18 ) then modify( $a ) { valid = false }; end -- View this message in context: http://drools.46999.n3.nabble.com/Infinit-loop-in-simple-example-tp3675536p3675536.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom.
Re: [rules-users] FireAllRules for all agenda
This is interesting... Is there A) Any reason why it is not possible to put rules into multiple agenda groups? After all, it should be a filter, not a package. B) Any plans on making this feasible in future releases? ftr, The same questions can be asked about ruleflow-groups. Until now, I actually always assumed that it was possible to put rules into multiple groups. Apparently, this was something that I never really tried. It is a bit sad to start the weekend being disappointed. Thanks in advance. Frank -- View this message in context: http://drools.46999.n3.nabble.com/FireAllRules-for-all-agenda-tp3674638p3675641.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] FireAllRules for all agenda
Not so long ago there was talk about some highly innovative development that would permit you to write rules to control the agenda logic, something to supersede the bestiary of features that came into being over the years. I'm not quite sure about the status of this feature -probably still is experimental and unstable. -W On 20/01/2012, FrankVhh frank.vanhoensho...@agserv.eu wrote: This is interesting... Is there A) Any reason why it is not possible to put rules into multiple agenda groups? After all, it should be a filter, not a package. B) Any plans on making this feasible in future releases? ftr, The same questions can be asked about ruleflow-groups. Until now, I actually always assumed that it was possible to put rules into multiple groups. Apparently, this was something that I never really tried. It is a bit sad to start the weekend being disappointed. Thanks in advance. Frank -- View this message in context: http://drools.46999.n3.nabble.com/FireAllRules-for-all-agenda-tp3674638p3675641.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] Fusion historical data analysis
Some code snippets that I've used: import org.drools.time.SessionPseudoClock; SessionPseudoClock clock; void advance( Date eventDate ){ long currentTime = clock.getCurrentTime(); long eventTime = eventDate.getTime(); clock.advanceTime( eventTime - currentTime, TimeUnit.MILLISECONDS ); } KnowledgeSessionConfiguration kSessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); kSessionConfig.setOption( ClockTypeOption.get(pseudo) ); kSession = kBase.newStatefulKnowledgeSession( kSessionConfig, null ); clock = kSession.getSessionClock(); SomeEvent event = ...; advance( event.getTimestamp() ); eventStream.insert( event ); kSession.fireAllRules(); On 20/01/2012, MartinSimo simo.f...@gmail.com wrote: Hi, unfortunately I haven't found any way to set the pseudo clock according to timestamp (the session.insert()) in org.jboss.soa.esb.actions.BusinessRulesProcessor which I am using to fire the rules from ESB. I'll try to write my own class to fire the rules, where I can also use session.insert() to synchronize the clock. the only thing I do not understand is, why it is possible to set the property name=ruleClockType value=PSEUDO / in ESB, but I have no property to control the session clock... Thank you for your help. r. -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-historical-data-analysis-tp3673562p3675583.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] Global variable error message
First of all thanks for your reply, I agree with you, the concern here is syntactically drl file is ok and it compiles and build the knowledgebase. In run time consequence part get executed in that time it noticed global is null, this behavior is just like a java NPE. The point here is the message displayed is not like java stacktrace insted drools exception message simply saying /org.drools.runtime.rule.ConsequenceException: rule: order approve rule /, So debugging is harder for new developers (i am ). It would be helpful to provide some relavent stack trace. I am using 5.2 final...may be i try 5.3 final. - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/Global-variable-error-message-tp3673889p3675877.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] Global variable error message
Strange - I see a full stack trace. Must look into this, can't have suppressed important info. There's an improved consequence exception handler available with 5.3.0. -W On 20/01/2012, domingo sprabak...@gmail.com wrote: First of all thanks for your reply, I agree with you, the concern here is syntactically drl file is ok and it compiles and build the knowledgebase. In run time consequence part get executed in that time it noticed global is null, this behavior is just like a java NPE. The point here is the message displayed is not like java stacktrace insted drools exception message simply saying /org.drools.runtime.rule.ConsequenceException: rule: order approve rule /, So debugging is harder for new developers (i am ). It would be helpful to provide some relavent stack trace. I am using 5.2 final...may be i try 5.3 final. - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/Global-variable-error-message-tp3673889p3675877.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] Global variable error message
Hmm, I tried 5.2.0, and it doesn't even compile when I call a global's method. -W On 20/01/2012, Wolfgang Laun wolfgang.l...@gmail.com wrote: Strange - I see a full stack trace. Must look into this, can't have suppressed important info. There's an improved consequence exception handler available with 5.3.0. -W On 20/01/2012, domingo sprabak...@gmail.com wrote: First of all thanks for your reply, I agree with you, the concern here is syntactically drl file is ok and it compiles and build the knowledgebase. In run time consequence part get executed in that time it noticed global is null, this behavior is just like a java NPE. The point here is the message displayed is not like java stacktrace insted drools exception message simply saying /org.drools.runtime.rule.ConsequenceException: rule: order approve rule /, So debugging is harder for new developers (i am ). It would be helpful to provide some relavent stack trace. I am using 5.2 final...may be i try 5.3 final. - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/Global-variable-error-message-tp3673889p3675877.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] Declarative fact model or Java?
In alternative, if you want total decoupling, you can define /interfaces/ that your classes extend, and write the rules against the interfaces, rather than the classes. This might help when you have different formats and improves the portability of your rule base. The classes would have to implement interfaces statically, so it can be done conveniently if you need to create your fact classes anyway. The drawback is that you can't to that so easily if you don't have access to the source code. We provided traits to add interfaces (a) to individual instances rather than whole classes, or (b) to attach an interface to a class which does not implement it. One bit which is missing, now that I realize, is the possibility to have declared classes implement DECLARED*** interfaces statically (anyone willing to open a JIRA request? I'm feeling lazy right now :) ) D. [Beware: arguable and debatable content below:] Remark : In a perfect world, the rules should just process logical facts, i.e. data stored within pure beans. Behavior (methods) other assertions/retractions/updates should be provided in a controlled way, either using different, dedicated facts or globals. If this level of purity can be attained, among other things, debugging and rule analysis becomes much more feasible. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Declarative-fact-model-or-Java-tp3675001p3676227.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] Declarative fact model or Java?
With Guvnor, you can also use working set (see here ) to restrict the availiable fields to expose to a business user, by selecting class and/or fields of an existing class, and even more (businnes contraints on values, with rules). The only problem I see with working sets, is that you must explicitely set the working set to use when you create your rule (not very natural for a business user). So, if one create a new rule from Guvnor, he can access the whole object model. The fact model filtering is not enabled until a working set is associated. May be one day, for a package or a category (or a user as said in the doc for future devs), we will be able to set a default working set, so that all rule of this package will automatically associated with filterered model. But it could be a good solution for you, avoiding complex proxies, factories and so on ... - Mail original - De: gpa...@tsys.com À: Rules Users List rules-users@lists.jboss.org Cc: rules-users-boun...@lists.jboss.org Envoyé: Vendredi 20 Janvier 2012 18:59:02 Objet: Re: [rules-users] Declarative fact model or Java? If you are starting from scratch, this is possible. However, I find myself having to expose operations from the *preexisting* technical domain into the business (i.e expose methods from existing technical domain code that has all kinds of annotations and code references to 3rd party software). The only way out, in that case, is to have your own separate business domain classes that wrap around (proxy) the existing technical domain From: Wolfgang Laun wolfgang.l...@gmail.com To: Rules Users List rules-users@lists.jboss.org Date: 01/20/2012 06:36 AM Subject: Re: [rules-users] Declarative fact model or Java? Sent by: rules-users-boun...@lists.jboss.org Let me mention that I've used Java classes derived from XML Schema as facts. If there are technical properties you'd like to hide from the rule programmer, define a business type and extend it with the technical properties. The rule programmer must make do with the business type, which is possible even if the object (fact) type is the technical subclass. -W On 20/01/2012, Stephen Masters stephen.mast...@me.com wrote: Hi Davide, Thanks for your thoughts. The application is just a service which takes an XML request, converts that into a fact and inserts that into the working memory. Based on rule evaluations, it responds to the client with more XML indicating whether the requested action is permitted. On of the key aims of the project is to enable management of some rules by 'the business' through Guvnor. The current 1-1 mapping you mention is partly what put me off using Java models, as it leads to 'technical' attributes being present in the Guvnor fact model, which are not relevant to the business. The more I can keep the fact model within Guvnor minimal, the better. So following your logic, given that: There is no legacy model to deal with. ~80% of what is going on will be within Drools, with the Java code just to insert/update facts and marshal XML. I would really like to avoid a 1-1 mapping of Java classes to DRL facts. ... I think I'll stick with DRL facts. Given that I'm not too sure exactly what I want out of it yet, I'm not sure how much I could contribute to a spec, but I'd be happy to help out with things. If only by testing out early code and providing feedback. If there's anything you think I might be able to help out with, feel free to ping me an email. Many thanks, Steve stephen.mast...@me.com On Jan 20, 2012, at 11:44 AM, Davide Sottara dso...@gmail.com wrote: Hi Steve, let me share my thoughts on this. You will probably want to use a Java model when it's already available :) Or when you're using the rule engine to implement the business logic layer of your application, processing data coming from an external source. A DRL model, instead, is definitely recommended for temporary facts, or data structures which are used by the rules to do their computations. The main problem with DRL fact classes is that they're quite cumbersome to use outside the rule engine. On the other hand, you will be sure that the declared types will correspond to an implementation fully compatible and optimized for the rule engine. Very roughly : if the rule engine is a component in a larger architecture, use java classes. If you're building a rule-based application - i.e. DRL is your programming language and Drools is your execution environment, go for DRL. As for mapping, we have added this very experimental feature lately: http://blog.athico.com/2011/12/new-feature-spotlight-traits-part-1.html http://blog.athico.com/2011/12/dynamic-typing-in-rules-traits-part-2.html I have plans to use annotations to improve the mapping, avoiding the 1-1 correspondence between fields, so if you want to contribute, if only to the specifications, let us know :) Best Davide -- View this message in context:
Re: [rules-users] Declarative fact model or Java?
Apart from these considerations, you may also need to take into account performance and memory differences between the two approaches. In my Drools.5.0.1 project, I was tempted by declarative facts at first, until I found out that at runtime you need approximately 3 times the memory and you incur a significant performance penalty. I have to clarify though, that even with declarative facts performance was/is in the order of ms (milliseconds), so this issue may not carry much weight. -Stathis Vincent LEGENDRE wrote: With Guvnor, you can also use working set (see here ) to restrict the availiable fields to expose to a business user, by selecting class and/or fields of an existing class, and even more (businnes contraints on values, with rules). The only problem I see with working sets, is that you must explicitely set the working set to use when you create your rule (not very natural for a business user). So, if one create a new rule from Guvnor, he can access the whole object model. The fact model filtering is not enabled until a working set is associated. May be one day, for a package or a category (or a user as said in the doc for future devs), we will be able to set a default working set, so that all rule of this package will automatically associated with filterered model. But it could be a good solution for you, avoiding complex proxies, factories and so on ... - Mail original - De: gpa...@tsys.com Γ: Rules Users List rules-users@lists.jboss.org Cc: rules-users-boun...@lists.jboss.org EnvoyΓ©: Vendredi 20 Janvier 2012 18:59:02 Objet: Re: [rules-users] Declarative fact model or Java? If you are starting from scratch, this is possible. However, I find myself having to expose operations from the *preexisting* technical domain into the business (i.e expose methods from existing technical domain code that has all kinds of annotations and code references to 3rd party software). The only way out, in that case, is to have your own separate business domain classes that wrap around (proxy) the existing technical domain From: Wolfgang Laun wolfgang.l...@gmail.com To: Rules Users List rules-users@lists.jboss.org Date: 01/20/2012 06:36 AM Subject: Re: [rules-users] Declarative fact model or Java? Sent by: rules-users-boun...@lists.jboss.org Let me mention that I've used Java classes derived from XML Schema as facts. If there are technical properties you'd like to hide from the rule programmer, define a business type and extend it with the technical properties. The rule programmer must make do with the business type, which is possible even if the object (fact) type is the technical subclass. -W On 20/01/2012, Stephen Masters stephen.mast...@me.com wrote: Hi Davide, Thanks for your thoughts. The application is just a service which takes an XML request, converts that into a fact and inserts that into the working memory. Based on rule evaluations, it responds to the client with more XML indicating whether the requested action is permitted. On of the key aims of the project is to enable management of some rules by 'the business' through Guvnor. The current 1-1 mapping you mention is partly what put me off using Java models, as it leads to 'technical' attributes being present in the Guvnor fact model, which are not relevant to the business. The more I can keep the fact model within Guvnor minimal, the better. So following your logic, given that: There is no legacy model to deal with. ~80% of what is going on will be within Drools, with the Java code just to insert/update facts and marshal XML. I would really like to avoid a 1-1 mapping of Java classes to DRL facts. ... I think I'll stick with DRL facts. Given that I'm not too sure exactly what I want out of it yet, I'm not sure how much I could contribute to a spec, but I'd be happy to help out with things. If only by testing out early code and providing feedback. If there's anything you think I might be able to help out with, feel free to ping me an email. Many thanks, Steve stephen.mast...@me.com On Jan 20, 2012, at 11:44 AM, Davide Sottara dso...@gmail.com wrote: Hi Steve, let me share my thoughts on this. You will probably want to use a Java model when it's already available :) Or when you're using the rule engine to implement the business logic layer of your application, processing data coming from an external source. A DRL model, instead, is definitely recommended for temporary facts, or data structures which are used by the rules to do their computations. The main problem with DRL fact classes is that they're quite cumbersome to use outside the rule engine. On the other hand, you will be sure that the declared types will correspond to an implementation fully compatible and optimized for the rule engine. Very roughly : if the rule engine is a component in a larger architecture, use java classes. If you're building a rule-based
[rules-users] changeset.xml schema error
I have some issues using changeset... Experiment - 1 change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd' add resource source='classpath:dir1/dir2/filename.drl' type='DRL' / /add /change-set when i use the above changeset (thanks to user forum)...the program works fine no issues but i got the following warning messages... (null: 1, 201): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. (null: 1, 201): cvc-elt.1: Cannot find the declaration of element 'change-set'. (null: 1, 207): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. (null: 1, 285): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. (null: 1, 374): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. (null: 1, 446): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. (null: 1, 534): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. Question: how to get rid of this? I completely google the web including user forum no answer.If it is available in the forum, my apologies for missing that info...some one could forward me to that info location. Experiment - 2 change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' add resource source='classpath:dir1/dir2/filename.drl' type='DRL' / /add /change-set when i use the above changeset (grepcode drools-compiler 5.2.1 Final)...after 1 minute it gives the following error message and the thread is open for ever...nothing happen. INFO: KnowledgeDefinitionBuilder: changeset == change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' add resource source='classpath:dir1/dir2/filename.drl' type='DRL' / /add /change-set (null: 1, 285): schema_reference.4: Failed to read schema document 'http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema. (null: 1, 285): cvc-elt.1: Cannot find the declaration of element 'change-set'. Question: I copied the schemaLocation from the src, why it is not working? please advise me? - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/changeset-xml-schema-error-tp3676510p3676510.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 dialect issue in local file stream Vs Guvnor
I have one simple rule, just check the boolean attribute of the object and print the value of the boolean, that simple rule. I am using java as my rule dialect. I found something interesting while debugging. 1. When i read the drl file from the local file stream I found the following... getDialect ::: java getConsequence ::: my.test.package.name.TestOne.Rule_boolean_test_rule_0DefaultConsequenceInvoker@b3a21684 2. when i read the same drl from the guvnor I found the following... getDialect ::: mvel getConsequence ::: org.drools.base.mvel.MVELConsequence@67bc67bc Here is is my doubt...since i use the same rule file and 'java' as dialect why the consequence and dialect are diffrence from ocal file stream. If anyone clear this doubt will be greatly appreciated. - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/rule-dialect-issue-in-local-file-stream-Vs-Guvnor-tp3676750p3676750.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] Global variable error message
Thanks, I tried 5.3 final, as you said, It gives very detailed error message . I changed to 5.2 Final to 5.3 Final. Thanks for the info :) - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/Global-variable-error-message-tp3673889p3676793.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 dialect issue in local file stream Vs Guvnor
Can you view the package source in Guvnor and report if it shows an explicit dialect? IIRC you are not the first person who has experienced this type of behaviour. sent on the move On 20 Jan 2012 21:52, domingo sprabak...@gmail.com wrote: I have one simple rule, just check the boolean attribute of the object and print the value of the boolean, that simple rule. I am using java as my rule dialect. I found something interesting while debugging. 1. When i read the drl file from the local file stream I found the following... getDialect ::: java getConsequence ::: my.test.package.name.TestOne.Rule_boolean_test_rule_0DefaultConsequenceInvoker@b3a21684 2. when i read the same drl from the guvnor I found the following... getDialect ::: mvel getConsequence ::: org.drools.base.mvel.MVELConsequence@67bc67bc Here is is my doubt...since i use the same rule file and 'java' as dialect why the consequence and dialect are diffrence from ocal file stream. If anyone clear this doubt will be greatly appreciated. - with kind regards, -- View this message in context: http://drools.46999.n3.nabble.com/rule-dialect-issue-in-local-file-stream-Vs-Guvnor-tp3676750p3676750.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