Re: [rules-users] Optaplanner rules error
On 19-09-13 09:56, SNELS Nick wrote: Hi, I have the following Drools rule in Optaplanner: rule "oneShiftPerDay" when $leftAssignment : ShiftAssignment($leftId : id, $employee : employee, $shiftDate : shiftDate, employee != null) $rightAssignment : ShiftAssignment(employee == $employee, shiftDate == $shiftDate, id $leftId) then scoreHolder.addHardConstraintMatch(kcontext, -1); end But when I run the solver I get the following error: 09:02:46.128 [main] ERROR o.d.c.k.b.impl.AbstractKieModule - Unable to build KieBaseModel:defaultKieBase Error importing : 'be.comp.permanenties.domain.solver.EmployeeAssignmentTotal' Error importing : 'be.comp.permanenties.domain.solver.EmployeeWorkSequence' Rule Compilation error : [Rule name='oneShiftPerDay'] be/comp/permanenties/solver/Rule_oneShiftPerDay544009415.java (2:220) : Only a type can be imported. be.comp.permanenties.domain.solver.EmployeeWorkSequence resolves to a package be/comp/permanenties/solver/Rule_oneShiftPerDay544009415.java (2:978) : Take a look at line 2 of your drl file. Only a type can be imported. be.comp.permanenties.domain.solver.EmployeeAssignmentTotal resolves to a package Apparently it says something like "import be.comp.permanenties.domain.solver.EmployeeAssignmentTotal" and then take a look at your java packages and classes if that exists as a class (and is case sensitive correct). How can I solve this error? Thanks. Kind regards, Nick Out of curiosity, what kind of employee scheduling do you do at the OCMW? That would make an interesting, understandable, tangible use case to blog about it :) Dit bericht is onderworpen aan de bepalingen van onze disclaimer ___ 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] Declared Types and Globals in different files with incremental KnowledgeAgent
Dear Drools Users, I am building a network server for drools since the existing drools-server did not meet my requirements. Since I recently found a bug and find the people here very helpful I'll try to explain another issue I encountered in the hope that it improves drools 5.6 and 6.0. I noticed that declared types and globals don't seem to be found when you access them from a rule that was written in a different file. For the declared types I hacked around this issue by preprocessing the files and placing every declared type at the top of each file that needs it. For globals this is of course not possible. An example is shown below. File1 is loaded from the moment the agent starts up, then file2 is loaded. There is a difference when the knowledgeAgent detects the two files at once or one by one. In this case the KnowledgeAgent detects one file and then a few minutes later the other file and compiles them completely separately. The idea is to keep how many rules are matched of a certain type in a global. * FILE1: global_rules_matches.drl -- package ellipsoidfacts // declare global Integer RULES_MATCHED; // initialize global rule initRULESMATCHED salience 999 when then RULES_MATCHED = 0; end* * FILE2: testrule.drl -- package ellipsoidfacts rule Gesture_lefthook when // ... any precedent rules ... then System.out.println(matched gesture: lefthook+ RULES_MATCHED); end* In this particular case, my rule is not matched. I load these rules using a changeset xml, my knowledgeagent is set to incremental (but either doesnt work). The same happens when I declare types in FILE1 and use them in FILE2. When I write the type declaration in both files it works perfectly. Being the same package I assumed that these two scenarios should work. Am I doing something wrong or is the agent not supposed to work like this and should a package be in one file? Kind Regards, De Rooms Brecht ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Optaplanner rules error
I'm unable to figure it out. At the top of the drl file I have: package be.comp.permanenties.solver; //permanentiesScoreRules.drl dialect java import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScoreHolder; import be.comp.permanenties.domain.DayOfWeek; import be.comp.permanenties.domain.Employee; import be.comp.permanenties.domain.ShiftAssignment; import be.comp.permanenties.domain.Roster; import be.comp.permanenties.domain.RosterInfo; import be.comp.permanenties.domain.Shift; import be.comp.permanenties.domain.ShiftDate; import be.comp.permanenties.domain.ShiftType; import be.comp.permanenties.domain.ShiftTypeSkillRequirement; import be.comp.permanenties.domain.Skill; import be.comp.permanenties.domain.request.DayOffRequest; import be.comp.permanenties.domain.request.DayOnRequest; import be.comp.permanenties.domain.request.ShiftOffRequest; import be.comp.permanenties.domain.request.ShiftOnRequest; import be.comp.permanenties.domain.solver.EmployeeAssignmentTotal; import be.comp.permanenties.domain.solver.EmployeeWorkSequence; The EmployeeAssignmentTotal sits in the right package and the top of the file is: package be.comp.permanenties.solver; import java.io.Serializable; import org.apache.commons.lang.builder.CompareToBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import be.comp.permanenties.domain.Employee; public class EmployeeAssignmentTotal implements ComparableEmployeeAssignmentTotal, Serializable { For now the project is just a copy of the nurse rostering problem with some omissions of things I don't think I will need. I am now trying to get something fairly simple up and running. The program will replace a manual employee planning tool in Excel. But the planning tool they use now doesn't look at holidays or days off. The aim of the program is to do everything automatically and integrate it with the hour registration program. But as you can see I am only beginning. Deadline is the end of this year. Kind regards, Nick -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Optaplanner-rules-error-tp4026047p4026061.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] Optaplanner rules error
On 20-09-13 16:19, ns wrote: I'm unable to figure it out. At the top of the drl file I have: package be.comp.permanenties.solver; //permanentiesScoreRules.drl dialect java import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScoreHolder; import be.comp.permanenties.domain.DayOfWeek; import be.comp.permanenties.domain.Employee; import be.comp.permanenties.domain.ShiftAssignment; import be.comp.permanenties.domain.Roster; import be.comp.permanenties.domain.RosterInfo; import be.comp.permanenties.domain.Shift; import be.comp.permanenties.domain.ShiftDate; import be.comp.permanenties.domain.ShiftType; import be.comp.permanenties.domain.ShiftTypeSkillRequirement; import be.comp.permanenties.domain.Skill; import be.comp.permanenties.domain.request.DayOffRequest; import be.comp.permanenties.domain.request.DayOnRequest; import be.comp.permanenties.domain.request.ShiftOffRequest; import be.comp.permanenties.domain.request.ShiftOnRequest; import be.comp.permanenties.domain.solver.EmployeeAssignmentTotal; (1) import be.comp.permanenties.domain.solver.EmployeeWorkSequence; The EmployeeAssignmentTotal sits in the right package and the top of the file is: package be.comp.permanenties.solver; Shouldn't that be instead: package be.comp.permanenties.domain.solver; because of (1)? import java.io.Serializable; import org.apache.commons.lang.builder.CompareToBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import be.comp.permanenties.domain.Employee; public class EmployeeAssignmentTotal implements ComparableEmployeeAssignmentTotal, Serializable { For now the project is just a copy of the nurse rostering problem with some omissions of things I don't think I will need. I am now trying to get something fairly simple up and running. The program will replace a manual employee planning tool in Excel. But the planning tool they use now doesn't look at holidays or days off. The aim of the program is to do everything automatically and integrate it with the hour registration program. But as you can see I am only beginning. Deadline is the end of this year. Kind regards, Nick -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Optaplanner-rules-error-tp4026047p4026061.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] Insert, fire, then retract from consequence
I am wondering if I can insert a fact, fire all activated rules, then retract the fact all in a rules consequence. I have similar behavior using the API that I'd like to be able to do inside a rule, as well. The idea is that once all the rules that cause activations get fired, it gets retracted immediately. This is so that we don't have to have cleanup rules all over the place, and have to ensure that the salience is set correctly. Any ideas? Thanks in advance! Sent from my iPhone ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Insert, fire, then retract from consequence
On 20/09/2013, Jonathan Knehr jonathan.kn...@gmail.com wrote: I am wondering if I can insert a fact, fire all activated rules, then retract the fact all in a rules consequence. Certainly. But the fireAllRules() would have to address a session different from the one that's executing the consequence. I have similar behavior using the API that I'd like to be able to do inside a rule, as well. A consequence is just Java, so go ahead. The idea is that once all the rules that cause activations get fired, it gets retracted immediately. This is so that we don't have to have cleanup rules all over the place, and have to ensure that the salience is set correctly. Is it a fact? You can retract it from the place where it was inserted, for instance. Well-designed rule sets don't have cleanup rules all over the place. And salience is a last resort, not a first-class way of designing rule sets. Any ideas? Thanks in advance! Sent from my iPhone Looks like it. -W ___ 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] No errors thrown from KnowledgeAgent
Let the team correct me if I'm mistaken or imprecise. There is no commercial version, the only thing you can get is a productized version which has been through Q/A for a longer period, usually 6 months. The strategy is to get features out in the community version, get feedback from there and make them part of the product when they're more mature. If you pay for the product, **I think** that you'll actually get support and bug fixes based on a SLA. Otherwise, you'll just have to report them and wait until somebody will have the time to fix them, possibly in a future version. Or provide a fix yourself :) Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-No-errors-thrown-from-KnowledgeAgent-tp4025209p4026066.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] No errors thrown from KnowledgeAgent
Here's a blog entry Mark made on this very subject: blog.athico.com/2011/04/drools-jbpm-community-versus-product.html?m=1 Sent on the move On 20 Sep 2013 21:02, Davide Sottara dso...@gmail.com wrote: Let the team correct me if I'm mistaken or imprecise. There is no commercial version, the only thing you can get is a productized version which has been through Q/A for a longer period, usually 6 months. The strategy is to get features out in the community version, get feedback from there and make them part of the product when they're more mature. If you pay for the product, **I think** that you'll actually get support and bug fixes based on a SLA. Otherwise, you'll just have to report them and wait until somebody will have the time to fix them, possibly in a future version. Or provide a fix yourself :) Best Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-No-errors-thrown-from-KnowledgeAgent-tp4025209p4026066.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] Declared Types and Globals in different files with incremental KnowledgeAgent
Brecht, thanks for reporting this, but I don't think these are bugs. 1) In order to set the value of a global from a rule's RHS, you have to do somehting like this drools.getKnowledgeRuntime().setGlobal( RULES_MATCHED, newValue ); The reason is that the rule's RHS sees a reference to the original global... a local variable with the same name initialized appropriately. Something like RULES_MATCHED = 0 will only change the local reference, not modify the global. 2) The KnowledgeAgent supports declared types incrementally.. (Esteban and I spent a lot of time to make that work), but you have to set a flag in the KA's configuration: KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); aconf.setProperty( drools.agent.useKBaseClassLoaderForCompiling, true ); The incremental mode (newInstance=false) only ensures that the existing KnowlegeBase is updated, tue useKBaseClassLoaderForCompiling will ALSO make sure that, as the new resources are compiled by a KnowledgeBuilder, this is initialized with the KB's classloader, which has the classes for the declared types. 3) I have proposed a fix for the issue you reported the other day... actually two in one. - 3a ) Runtime exceptions will be catched, - 3b ) you **WILL NOT** be able to use primitive types with globals anymore.. (which would result in a RTE anyway) Hope this help Best Davide On 09/20/2013 02:18 AM, De Rooms Brecht wrote: Dear Drools Users, I am building a network server for drools since the existing drools-server did not meet my requirements. Since I recently found a bug and find the people here very helpful I'll try to explain another issue I encountered in the hope that it improves drools 5.6 and 6.0. I noticed that declared types and globals don't seem to be found when you access them from a rule that was written in a different file. For the declared types I hacked around this issue by preprocessing the files and placing every declared type at the top of each file that needs it. For globals this is of course not possible. An example is shown below. File1 is loaded from the moment the agent starts up, then file2 is loaded. There is a difference when the knowledgeAgent detects the two files at once or one by one. In this case the KnowledgeAgent detects one file and then a few minutes later the other file and compiles them completely separately. The idea is to keep how many rules are matched of a certain type in a global. * FILE1: global_rules_matches.drl -- package ellipsoidfacts // declare global Integer RULES_MATCHED; // initialize global rule initRULESMATCHED salience 999 when then RULES_MATCHED = 0; end* * FILE2: testrule.drl -- package ellipsoidfacts rule Gesture_lefthook when // ... any precedent rules ... then System.out.println(matched gesture: lefthook+ RULES_MATCHED); end* In this particular case, my rule is not matched. I load these rules using a changeset xml, my knowledgeagent is set to incremental (but either doesnt work). The same happens when I declare types in FILE1 and use them in FILE2. When I write the type declaration in both files it works perfectly. Being the same package I assumed that these two scenarios should work. Am I doing something wrong or is the agent not supposed to work like this and should a package be in one file? Kind Regards, De Rooms Brecht ___ 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 and jBPM Public Training London 2013
We're making a workshop that introduces Business Process Management and prepares you to be immediately effective in using both Drools and jBPM to improve your applications. You will learn how to utilize the different stages of BPM where development is involved, for both versions 5 and 6 of the Drools and jBPM platform. We'll discuss several best practices that allow for effective BPM, and how the jBPM components are more suitable placed into those best practices. We'll also cover how is the best way to perceive the software writing work related to running effective Business Processes and rules, and see how this allows a best fit from an End User perspective. Where? London, England, Number 1 Poultry, EC2R 8JR When? October 21-25 , filled with QA sessions and workshops, from 10:00 AM to 18:00 PM, with the last two hours for specialized questions and workshopping everyday. By Who? By jBPM commiter and Plugtree's CTO Mariano De Maio (a.k.a. Marian Buenosayres), jBPM commiter and Plugtree's CTO. Mariano has provided several contributions to the Drools and jBPM community, including the initial version of jBPM Form Builder, Drools and jBPM persistence using infinispan, and jBPM rollback API. What will it cover? Full theoretical and technical overview of Drools and jBPM. You can download the full agenda from http://www.plugtree.com/wp-content/uploads/2013/08/agenda.pdf We offer different options depending on your interest: - Introduction: October 21. Full theoretical introduction to Drools and jBPM components. USD 500.00 - Drools: October 21-23. Introduction + full technical coverage of Drools. USD 1350.00 - jBPM: October 21, 24 and 25. Introduction + full technical coverage of jBPM. USD 1350.00 - Full: October 21 + 25. USD 1728.00, and 1929.00 after 9/21/13. Register and get the early bird pricing! Or send us an email at traini...@plugtree.com for other payment methods. See you at London! -- View this message in context: http://drools.46999.n3.nabble.com/Drools-and-jBPM-Public-Training-London-2013-tp4026071.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