Re: [rules-users] Check all elements of a list (Drools Expert)
Check out the forall conditional element: http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e4632 Good luck! Steve rules-users-boun...@lists.jboss.org wrote on 02/24/2011 09:45:16 AM: > From: > > "Petr Chelčický" > > To: > > > > Date: > > 02/24/2011 09:49 AM > > Subject: > > [rules-users] Check all elements of a list (Drools Expert) > > Sent by: > > rules-users-boun...@lists.jboss.org > > > Hi! I'm trying to write rules in Drools Expert. In the when part of > the rule, I check some properties of an Application object. This > object contains a List and I would like to check if a bunch of rules > apply to all objects of SomeOtherType in this list. The rule should > fire only when the constraints are valid for ALL objects in that > list. How could this be done? > ___ > 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] Migrating from one environment to another
Hi Chris, You may be able to accomplish migrating a single package via the WebDAV interface and a script in your favorite language. Here are some relevant results from a quick google search: http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-guvnor/html/ch01.html#d0e1301 http://blog.athico.com/2008/05/accessing-guvnor-as-filesystem-webdav.html http://thoughts.inphina.com/2011/02/14/adding-rules-to-drools-guvnor-programmatically-with-webdav/ Hope this is helpful, Steve rules-users-boun...@lists.jboss.org wrote on 02/16/2011 05:12:45 PM: > From: > > Chris Selwyn > > To: > > rules-users@lists.jboss.org > > Date: > > 02/16/2011 05:14 PM > > Subject: > > Re: [rules-users] Migrating from one environment to another > > Sent by: > > rules-users-boun...@lists.jboss.org > > Thanks for the confirmation Michael. > > I must say that I am surprised. It seems such an obviously useful thing. > Is there a reason why it does not exit? Is there a problem in > building such a thing? > > Chris > > On 16/02/2011 22:33, Michael Anstis wrote: > @Chris, > > I don't believe there is such a mechanism. > > @Sathya, > > Hijacking a previous post is unlikely to get you a reply. > > Thanks, > > Mike > On 16 February 2011 22:04, Chris Selwyn wrote: > I am aware of the Guvnor export/import mechanism to move an entire > repository and the method of importing a DRL to create a package. > > But what I have been looking for is a mechanism to move the entire > contents of a Guvnor package (DSL, model, DSLR file, DRL files etc) from > one Guvnor instance to another, so far without luck. > > Is there such a mechanism? > > Chris Selwyn > ___ > 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 > > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1204 / Virus Database: 1435/3447 - Release Date: 02/16/11 > ___ > 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] Complete Solutions Tabu Question
Hello Drools Users. Do Solution objects need to implement equals() and hashCode() methods in order to take advantage of the completeSolutionsTabuSize configuration? I did a little digging through the code and it appears that Solution objects are being compared with their clones (implicitly that is, they are being used as map keys). AbstractTabuAcceptor:87 The documentation mentions that moves need to implement equals and hashCode, but doesn't talk about Solution needing it. Thanks in advance, Steve___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Finding Multiple Solutions using Drools Planner
Hello Drools Users,I've been investigating Drools Planner for a few weeks and can't figure out how to accomplish a crucial requirement.In my application I need to have Planner return multiple solutions for one planning problem. More specifically I need is to find all of the ideal solutions to my planning problem. My problem is similar to the n-queens problem in that there exist ideal solutions. It is however somewhat simpler because the number of ideal solutions is fairly small (maybe a max of 10 or so).I've looked through the mailing list archives for similar requests and the best I could find was: http://drools-java-rules-engine.46999.n3.nabble.com/the-n-best-solutions-on-a-very-simple-test-case-td60618.htmlI took the advice of the poster in that thread and extended BestSolutionRecaller. I'm running into some problems getting Planner to continue after an optimal solution is found.My question is this. Is extending the BestSolutionRecaller the best way to achieve my goal? Or do you think it would be simpler to do this another way? Perhaps running Planner multiple times with already discovered solutions provided as input.Any advice would be appreciated.Thanks,Steve___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] collection question
Hi J, In your example I don't think that the collect is necessary. I believe the following will work: rule "AddBonusCd" when $so : ShippingOrder() Product(name == "cd1") from $so.products not (Product(name == "bonus_cd") from $so.products) then System.out.println("Adding Bonus Cd"); Set productSet = new HashSet($so.getProducts()); Product bonusCd = new Product(); bonusCd.setName("bonus_cd"); productSet.add(bonusCd); modify($so) { setProducts(productSet); } end You don't need the collects because you are just checking for existence/non-existence of facts within the products collection. Good luck! Steve rules-users-boun...@lists.jboss.org wrote on 07/21/2010 01:59:40 AM: > From: > > Wolfgang Laun > > To: > > Rules Users List > > Date: > > 07/21/2010 02:02 AM > > Subject: > > Re: [rules-users] collection question > > Sent by: > > rules-users-boun...@lists.jboss.org > > Things would be smpler if you could avoid re-creating Product objects > because adding an identical Object does not change the Set. (This > could be implemented with the help of a global Map,) > > Second, overriding equals (and hashCode) in Product would also avoid adding > an "evil twin" in your rule code - as it is! > > Even simpler is a solution where the relevant Product objects are inserted > as facts, so that >$cd1 : Product( name == "cd1" ) >$bonus_cd : Product( name == "bonus_cd" ) >$order : ShippingOrder( products contains $cd1, products not > contains $bonus_cd ) > is true (again, with equals and hashCode being overridden). > > Given your solution with collect, an additional eval testing for > "bonus_cd" not being the > name of the single Product in List $productList might be more > efficient than iterating > all products a second time. > > -W > > On 21 July 2010 00:41, javaj wrote: > > > > I'm trying to write a rule to add an object to a collection if thecollection > > already contained a certain object with a specific attribute. > > > > I developed a small example so maybe that will make more sense: > > > > Use Case: In a product shipping applicaiton, anytime a product with the name > > "cd1" is in the shipping order, a bonus product named "bonus_cd" needs to be > > added to the shipping order. The bonus cd should not be added if it's > > already in the shipping order. > > > > Shipping Order: > > > > public class ShippingOrder { > > > >private Set products; > > > >public ShippingOrder() {} > > > >public Set getProducts() { > >return products; > >} > > > >public void setProducts(Set products) { > >this.products = products; > >} > > > > } > > > > Product: > > > > public class Product { > > > >private String name; > > > >public Product(){} > > > >public String getName() { > >return name; > >} > > > >public void setName(String name) { > >this.name = name; > >} > > > > } > > > > > > Rule: > > > > rule "AddBonusCd" > > > >when > >$so : ShippingOrder() > >$productList : ArrayList(size == 1) from collect( > Product(name matches > > "cd1|bonus_cd") from $so.products) > >then > >System.out.println("Adding Bonus Cd"); > > > >Set productSet = new HashSet > ($so.getProducts()); > > > >Product bonusCd = new Product(); > >bonusCd.setName("bonus_cd"); > >productSet.add(bonusCd); > > > >modify($so) { > >setProducts(productSet); > >} > > end > > > > The Shipping Order object is inserted as the fact. > > > > The rule is valid if only cd1 or cd_bonus is in the shipping order. I only > > want the rule to run when cd1 is in the product set but cd_bonus is not. > > Makes sense? > > > > Thanks, > > J > > -- > > View this message in context: http://drools-java-rules-engine. > 46999.n3.nabble.com/collection-question-tp982769p982769.html > > Sent from the Drools - User 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.1.0.M2
Good catch Alan, I looked around but I'm not quite sure who to contact about correcting the URL on that page. Maybe one of the Drools team members could answer that question (and confirm that the old repo will in fact no longer be receiving updates). Thanks, Steve rules-users-boun...@lists.jboss.org wrote on 06/09/2010 07:19:50 AM: > From: > > alan.gai...@tessella.com > > To: > > Rules Users List > > Date: > > 06/09/2010 07:24 AM > > Subject: > > Re: [rules-users] Drools 5.1.0.M2 > > Sent by: > > rules-users-boun...@lists.jboss.org > > > Steve, > > Many thanks for the information! > > Just to let you know, the link on the Drools Downloads page (http:// > www.jboss.org/drools/downloads.html) still points to the old repository. > > Regards, > > Alan > > > > Steve Ronderos > Sent by: rules-users-boun...@lists.jboss.org > 08/06/2010 17:14 > > Please respond to > Rules Users List > > To > > Rules Users List > > cc > > Subject > > Re: [rules-users] Drools 5.1.0.M2 > > > > > JBoss recently updated their maven repository. Unfortunately I > don't think that the old repository (the one you listed) is going to > continue getting new updates. > > The new repo url is https://repository.jboss.org/nexus/content/groups/public/ > > You can see the 5.1.0.M2 artifact is available at that URL: https:// > repository.jboss.org/nexus/content/groups/public/org/drools/drools/5.1.0.M2/ > > You can read more about the new repo on their wiki: http:// > community.jboss.org/wiki/MavenGettingStarted-Users > > Thanks, > Steve > > rules-users-boun...@lists.jboss.org wrote on 06/08/2010 08:52:39 AM: > > > From: > > > > alan.gai...@tessella.com > > > > To: > > > > Rules Users List > > > > Date: > > > > 06/08/2010 08:57 AM > > > > Subject: > > > > [rules-users] Drools 5.1.0.M2 > > > > Sent by: > > > > rules-users-boun...@lists.jboss.org > > > > Drools 5.1.0.M2 still isn't available from the JBoss Maven repository (at > > http://repository.jboss.com/maven2/org/drools/). Any idea when it > > will be made available? > > Thanks, > > Alan___ > > 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 mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.1.0.M2
JBoss recently updated their maven repository. Unfortunately I don't think that the old repository (the one you listed) is going to continue getting new updates. The new repo url is https://repository.jboss.org/nexus/content/groups/public/ You can see the 5.1.0.M2 artifact is available at that URL: https://repository.jboss.org/nexus/content/groups/public/org/drools/drools/5.1.0.M2/ You can read more about the new repo on their wiki: http://community.jboss.org/wiki/MavenGettingStarted-Users Thanks, Steve rules-users-boun...@lists.jboss.org wrote on 06/08/2010 08:52:39 AM: > From: > > alan.gai...@tessella.com > > To: > > Rules Users List > > Date: > > 06/08/2010 08:57 AM > > Subject: > > [rules-users] Drools 5.1.0.M2 > > Sent by: > > rules-users-boun...@lists.jboss.org > > Drools 5.1.0.M2 still isn't available from the JBoss Maven repository (at > http://repository.jboss.com/maven2/org/drools/). Any idea when it > will be made available? > Thanks, > Alan___ > 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] help in date time format
Hi Sudhir, I haven't used dates in Drools the way that you are; however, I have used dates elsewhere in drools DRL files. It is my understanding that the default date format is "dd-MMM-". You can change that format to include times by setting a system property called "drools.dateformat". An example is below: System.setProperty("drools.dateformat", "dd-MMM- HH:mm"); -Steve rules-users-boun...@lists.jboss.org wrote on 05/13/2010 07:14:41 AM: > From: > > Esteban Aliverti > > To: > > Rules Users List > > Date: > > 05/13/2010 07:20 AM > > Subject: > > Re: [rules-users] help in date time format > > Sent by: > > rules-users-boun...@lists.jboss.org > > Maybe using a function to convert Strings to Date? > On Thu, May 13, 2010 at 9:06 AM, Sudhir M wrote: > Hi, > > My requirement is to compare two dates one a date object and the other > a date literal. In comparison it should also consider time. There is > format given for date literal (dd-mmm-yyy) but how can we add time to > it? I tried adding time it doesn't complain but seems to ignore the > time part in the date literal. > > below is the example > > Exam(name=="Math", examDate<="13-may-2010") this is my pattern. > > tried > > Exam(name=="Math", examDate<="15-may-2010 17:00:00") but time ignored > while executing. > > Is there any format for DateTime? > > Thanks, > sudhir. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > > > -- > > > Esteban Aliverti___ > 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] Parallelization
Hi Daniel, I was reading the other day that a JVM implementation does not necessarily have to run Java threads in different Processes (taking advantage of multiple cores). If you saw a significant speedup then I would assume your JVM does this. It is worth investigating for your production deployment. I would think that recent JVMs on modern operating systems would support this, but I also wouldn't leave it up to chance. This post seems to imply that the only JVM/OS combinations that don't support native threads are Java 1.2 or Solaris: http://forums.sun.com/thread.jspa?threadID=5330507 About StatefulKnowledgeSessions: You should be able to run these in parallel no problem. -Steve rules-users-boun...@lists.jboss.org wrote on 05/11/2010 07:55:18 AM: > From: > > djb > > To: > > rules-users@lists.jboss.org > > Date: > > 05/11/2010 08:01 AM > > Subject: > > Re: [rules-users] Parallelization > > Sent by: > > rules-users-boun...@lists.jboss.org > > > Hi Wolfgang, > > Ok, well I implemented my "option #2", which has cut it down to 23ms, which > is a good start. My timing is done by taking the time before, and after, > and dividing by the number of claims processed. (and averaging over a few > runs) > > I use one thread per StatefulKnowledgeSession... My machine has 2 cores, but > it will eventually be running on an 8 core beast, so i reckon this was a > good improvement. I was just worried that I wouldn't be able to > simultaneously process multiple K-Sessions, but apparently, Drools doesn't > mind. I'm pretty sure any machine with multiple cores supports parallel > java threads, no? > > > > - > Regarding my Utilities method, eg. isWithinTimePeriod("20100308", > "20090405", 1, "Y") > > I can get about 5ms off by commenting out the eval, so it's not going to be > a big jump even if I fix it, but, well, I am using MMdd Strings, which > in the method, I sub-stringed, converted to ints, instantiated DateMidnight > objects, and compared using Joda-time daysBetween/monthsBetween/yearsBetween > methods. > > My thought was that pre-converting to ints would help, so that each > ClaimLine has year/month/day int variables, and pass them in instead. (i.e., > Saves 3 String.substring()'s, and 3 Integer.parseInt()). but that actually > slowed it down a few milliseconds. (Maybe passing 6 params instead of 2?!) > > I'm comparing two dates by an arbitrary period, like "2 days" or "1 month", > and need the framework of the Gregorian Calendar. So, I don't think I can > do anything about this. 2 months is never guaranteed to be a set number of > milliseconds. It all depends on the claim date, which is fact data, and > therefore variable. > > Regards, > Daniel > > -- > View this message in context: http://drools-java-rules-engine. > 46999.n3.nabble.com/Parallelization-tp809341p809753.html > Sent from the Drools - User 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] how "exists" works exactly?
Antonio, I think that the problem may not be the exists. I'm not an expert at solver, but I believe that there may be an issue with the consequence of your first rule. insertLogical(new IntConstraintOccurrence("diff", 10)); The way that insertLogical works the new object will only be inserted if it does not .equals() with another fact in the working memory (or maybe in the truth maintenance system). Without seeing the rest of the solver (moves and such) I can't say for certain, but I think that each move is being evaluated to the same weight because the 1st rule will never result in a constraint occurrence > 10. Multiple matches of that rule will only result in one IntConstraintOccurrence being inserted. Maybe Wolfgang or someone else a little more experienced can verify my assumptions about how insertLogical works. Thanks, Steve rules-users-boun...@lists.jboss.org wrote on 05/05/2010 04:07:37 AM: > [image removed] > > Re: [rules-users] how "exists" works exactly? > > Wolfgang Laun > > to: > > Rules Users List > > 05/05/2010 04:15 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > One thing I've noticed is that >not (exists (EPackage( ) ) ) > is a roundabout (and possibly inefficient) way of saying >not (EPackage( ... ) ) > > It's difficult (for me) to deduce what should happen in the rules as > the description of the > fact data isn't clear enough (for me). > > -W > > 2010/5/5 Antonio Neto : > > Any idea? Please... > > > > 2010/5/4 Antonio Neto > >> > >> Hi all, > >> > >> I don't know exactly why I have a problem in my "exists" function. I've > >> tried many different ways, but it does not work. Anybody could help me, > >> please? > >> > >> I have the following rules: > >> > >> rule "diff" > >> when > >> $var1: EReference(name == "employee") > >> $var2: EClass(name == "Company", EAllReferences contains $var1) > >> not (exists( EPackage(EClassifiers contains $var2 ) )) > >> then > >> insertLogical(new IntConstraintOccurrence("diff", 10)); > >> end > >> > >> rule "ClassesNotReferenced" > >> when > >> $q1 : EClass(); > >> $q2 : EPackage(EClassifiers contains $q1); > >> not( exists ( EReference(EType == $q1) )); > >> then > >> insertLogical(new IntConstraintOccurrence("ClassesNotReferenced", > >> 1, $q1)); > >> end > >> > >> > >> and in my facts (and my EPackage) I have 4 instances of EClass "Company" > >> with a EReference "employee", and another EClass "Person". I still have a > >> "move" that removes EClasses in my Drools Solver. > >> > >> I need to have only one classe "Company" after processing. But it removes > >> only the EClass "Person", when it was supposed to remove one > EClass "Person" > >> and 3 ECLasses "Company". Leaving one EClass "Company" in the end. > >> > >> The problem is: when Drools tries to remove a EClass "Person" it thinks > >> that the EClass "Company" does not exists. But in fact there are3 others. > >> > >> Any clue about it, please ? > >> > >> Thanks > >> > >> Bests regards > >> > >> Antonio > >> > >> > > > > > > ___ > > 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly
Pritham, I've experienced this issue before as well. It has to do with the way that the KnowledgeAgent subscribes to resources. I believe behind the scenes the resources are loaded in an arbitrary order. There is a JIRA bug report already filed: https://jira.jboss.org/jira/browse/JBRULES-2377 Hope this helps, Steve rules-users-boun...@lists.jboss.org wrote on 01/26/2010 01:07:29 PM: > [image removed] > > [rules-users] KnowledgeAgent doesn't load dsl files and dslr file > from a change-set correctly > > Pritham > > to: > > rules-users > > 01/26/2010 01:10 PM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > > I have a folder in classpath: > > dsl/global.dsl > rules/section-A.dslr > rules/section-A/page-1.dslr > > I create a knowledge base like this: > > public KnowledgeBase createKnowledgeBase() throws DroolsParserException, > IOException { > > KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory > .newKnowledgeBuilder(); > > knowledgeBuilder.add(ResourceFactory > .newClassPathResource("dsl/global.dsl"), > ResourceType.DSL); > knowledgeBuilder.add(ResourceFactory > .newClassPathResource("rules/section-A.dslr"), > ResourceType.DSLR); > knowledgeBuilder.add(ResourceFactory > .newClassPathResource("rules/section-A/page-1.dslr"), > ResourceType.DSLR); > > if (knowledgeBuilder.hasErrors()) { > throw new RuntimeException(knowledgeBuilder.getErrors().toString()); > } > > KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(); > > knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages()); > > return knowledgeBase; > } > > // code > knowledgeBase = createKnowledgeBase(); > session = knowledgeBase.newStatefulKnowledgeSession(); > // insert facts > session.fireAllRules(); > session.dispose(); > > The above code works and I can get a unit test to work that processes rules > accordingly. I can see my dslr converting to a drl using the "drl viewer" > correctly (provided I temporarily place the dsl file in the same location > since expander doesn't accept a relative path). > > The problem, however is when I use a change-set.xml and a KnowledgeAgent, > things don't work > > code for loading via knowledgeAgent > > public static KnowledgeBase loadKnowledgeBase() throws > DroolsParserException, IOException { > agent = KnowledgeAgentFactory.newKnowledgeAgent("msll agent"); > > agent.applyChangeSet(ResourceFactory.newClassPathResource("change-set.xml")); > > return agent.getKnowledgeBase(); > } > > > xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' > xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' > > > > > > > > > > > I get the following generic drools errors: > ERR 103] Line 4:0 rule 'rule_key' failed predicate: > {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule[7,0]: [ERR 101] > Line 7:0 no viable alternative at input 'import' in rule Con in rule > attribute > ... > ... > > The rules are same, folder location is the same. I believe that drools has a > problem resolving path (expander global.dsl) from the dslr file when using a > KnowlegeAgent since in the earlier strategy, one could build a dsl into the > knowledgeBuilder directly from the classpath. > > Pl suggest. > -- > View this message in context: http://n3.nabble.com/KnowledgeAgent- > doesn-t-load-dsl-files-and-dslr-file-from-a-change-set-correctly- > tp139702p139702.html > Sent from the Drools - User 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] how to provide a relative path using file: in change-set and FileResource
If the files are not in your classpath and you do not want to use http: access then I believe that leaves you with file: using an absolute path. I'm not 100% sure of this, but that is my understanding of the options that the Drools ChangeSet provides. Steve rules-users-boun...@lists.jboss.org wrote on 01/18/2010 12:23:03 PM: > [image removed] > > Re: [rules-users] how to provide a relative path using file: in > change-set and FileResource > > Pritam > > to: > > rules-users > > 01/18/2010 12:30 PM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > > I'm aware of the http access but in my case I'd like to use local access > under WebRoot/ > > > Esteban wrote: > > > > HTTP access is an option? > > > > On Mon, Jan 18, 2010 at 1:21 PM, Pritam wrote: > > > >> > >> classpath works only if the files are under WEB-INF/classes. In my case, > >> the > >> files are directly under the WebRoot. > >> > >> Any suggestions? > >> > >> > >> SteveR685 wrote: > >> > > >> > Pritam, > >> > > >> > Try using "classpath:" instead of "file:". I've only used this when > >> > specifying the entire relative path to the file, I'm not sure about > >> > referencing a directory. > >> > > >> > >> > xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' > >> > xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' > >> > > >> > > >> > > >> > > >> > > >> > Steve Ronderos > >> > > >> > rules-users-boun...@lists.jboss.org wrote on 01/15/2010 09:27:05 AM: > >> > > >> >> [image removed] > >> >> > >> >> [rules-users] how to provide a relative path using file: in change- > >> >> set and FileResource > >> >> > >> >> Pritam > >> >> > >> >> to: > >> >> > >> >> rules-users > >> >> > >> >> 01/15/2010 09:35 AM > >> >> > >> >> Sent by: > >> >> > >> >> rules-users-boun...@lists.jboss.org > >> >> > >> >> Please respond to Rules Users List > >> >> > >> >> > >> >> Consider a change-set.xml, > >> >> > >> >> >> >> xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' > >> >> xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' > >> >> > > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> I have a rules folder under WebRoot in my web application but the > >> above > >> >> source url doesn't work as I get a > >> >> java.net.UnknownHostException: rules > >> >> > >> >> The same is true while providing a file path resource using > >> >> ResourceFactory.newFileResource("path"); > >> >> > >> >> In Spring, one can provide ant-path style regular expressions and it > >> > looks > >> >> on a relative path. Is there something similar for drools? > >> >> -- > >> >> View this message in context: http://n3.nabble.com/how-to-provide-a- > >> >> > >> > > >> relative-path-using-file-in-change-set-and-FileResource- > tp122036p122036.html > >> >> Sent from the Drools - User 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://n3.nabble.com/how-to-provide-a-relative-path-using-file- > in-change-set-and-FileResource-tp122036p126125.html > >> Sent from the Drools - User mailing list archive at Nabble.com. > >> ___ > >> rules-users mailing list > >> rules-users@lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/rules-users > >> > > > > > > > > -- > > > > > > Esteban Aliverti > > > > ___ > > rules-users mailing list > > rules-users@lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > > -- > View this message in context: http://n3.nabble.com/how-to-provide-a- > relative-path-using-file-in-change-set-and-FileResource-tp122036p126284.html > Sent from the Drools - User 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] how to provide a relative path using file: in change-set and FileResource
Pritam, Try using "classpath:" instead of "file:". I've only used this when specifying the entire relative path to the file, I'm not sure about referencing a directory. Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 01/15/2010 09:27:05 AM: > [image removed] > > [rules-users] how to provide a relative path using file: in change- > set and FileResource > > Pritam > > to: > > rules-users > > 01/15/2010 09:35 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > > Consider a change-set.xml, > > xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' > xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' > > > > > > > > I have a rules folder under WebRoot in my web application but the above > source url doesn't work as I get a > java.net.UnknownHostException: rules > > The same is true while providing a file path resource using > ResourceFactory.newFileResource("path"); > > In Spring, one can provide ant-path style regular expressions and it looks > on a relative path. Is there something similar for drools? > -- > View this message in context: http://n3.nabble.com/how-to-provide-a- > relative-path-using-file-in-change-set-and-FileResource-tp122036p122036.html > Sent from the Drools - User 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] Rookie question: best place to locate KnowledgeBase in web application?
Hi Laird, In our web application we create one KnowledgeAgent and each session calls getKnowledgeBase to get the KnowledgeBase and then getStatelessSession to get a session. We have not had any threading issues. I'm pretty sure that each of those operations are thread-safe. Hope this helps, Steve rules-users-boun...@lists.jboss.org wrote on 11/02/2009 09:13:01 AM: > [image removed] > > Re: [rules-users] Rookie question: best place to locate > KnowledgeBase in web application? > > ljnelson > > to: > > rules-users > > 11/02/2009 09:16 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > > > ljnelson wrote: > > > > My question is: where is the best place to put the various parts, and what > > sort of synchronization do I need to worry about? I did not see any > > reference to these issues in the (massive, otherwise excellent) Drools > > documentation. > > > > Well, OK, that generated a lot of traffic. :-) > > Talking to myself here, let's expand this out a bit and say: OK, how would > we do this inside a stateless session bean? I am loathe to write a resource > adapter for Drools. > > Given that, and that I'm working with stateless sessions exclusively, I'm > also willing to live with several instances of Drools--i.e. if I create the > engine as an instance variable (or static variable) inside my SLSB, I'm > willing to live with the fact that the container might (probably will) > create several instances of my SLSB, and hence several instances of my rules > engine--they'll all be reading the same rules information so should vend the > same results. > > My main question, for the two of you still reading, is around > synchronization: I understand that a StatelessKnowledgeSession is thread > safe, but what about acquiring it? Where else, if anywhere, will I run into > threading issues? > > Thanks, > Laird > -- > View this message in context: http://old.nabble.com/Rookie-question% > 3A-best-place-to-locate-KnowledgeBase-in-web-application-- > tp26152111p26157126.html > Sent from the drools - user 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] State management in Guvnor
Try AssetItem(stateDescription == "Production") stateDescription instead of statusDescription Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 10/08/2009 02:59:39 PM: > [image removed] > > Re: [rules-users] State management in Guvnor > > Mahashabde, Rohan > > to: > > Rules Users List > > 10/08/2009 03:02 PM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > I am implementing the selector functionality to build out package > mentioned in the Guvnor documentation but facing issues while > getting it to work. I am using a drl file for the selector criteria > and this is the error I am getting: > > org.drools.CheckedDroolsException: There were errors in the rule > source: Unable to create Field Extractor for 'statusDescription' of > '[ClassObjectType class=org.drools.repository.AssetItem]' in rule > 'rule1' : [Rule name='rule1'] > > This is my drl file: > ProductionAssets.drl > > package org.drools.guvnor.server.selector > > dialect "mvel" > > import org.drools.repository.AssetItem > import org.drools.guvnor.server.selector.Allow > > rule "rule1" > when > AssetItem(statusDescription =="Production") > then > insert(new Allow()) > end > > > Please can anyone help me with this? > > Thanks. > > Thanks and Regards > Rohan V Mahashabde > Consultant - Infosys Technologies Ltd > CRE Loan Solution Dev > Ext: 980.683.5539 > > > From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > boun...@lists.jboss.org] On Behalf Of Steve Ronderos > Sent: Thursday, October 08, 2009 9:26 AM > To: Rules Users List > Subject: Re: [rules-users] State management in Guvnor > > > Check out "selectors" in section 1.2.5.3 of the Guvnor Documentation > http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools- > guvnor/html_single/index.html#d0e233 > > Steve Ronderos > > rules-users-boun...@lists.jboss.org wrote on 10/08/2009 06:35:39 AM: > > > [image removed] > > > > [rules-users] State management in Guvnor > > > > Ambika Goel > > > > to: > > > > rules-users@lists.jboss.org > > > > 10/08/2009 06:41 AM > > > > Sent by: > > > > rules-users-boun...@lists.jboss.org > > > > Please respond to Rules Users List > > > > Hi All, > > > > What is the significance of Status in Guvnor. I have added multiple > > statuses like Production, Testing etc. > > How can I use it to differentiate between rules. I want to run only > > the rules under production status. How to do it > > > > > > ___ > > 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] State management in Guvnor
Check out "selectors" in section 1.2.5.3 of the Guvnor Documentation http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html_single/index.html#d0e233 Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 10/08/2009 06:35:39 AM: > [image removed] > > [rules-users] State management in Guvnor > > Ambika Goel > > to: > > rules-users@lists.jboss.org > > 10/08/2009 06:41 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Hi All, > > What is the significance of Status in Guvnor. I have added multiple > statuses like Production, Testing etc. > How can I use it to differentiate between rules. I want to run only > the rules under production status. How to do it > > > ___ > 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 subject)
Thanks Macon, That is the information I was looking for. I was looking at the code and it looked like there were some comments hinting at making the SystemEventListener configurable. Is this a future feature? or am I reading too much into the comments? Thanks, Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 10/01/2009 10:30:58 AM: > [image removed] > > Re: [rules-users] (no subject) > > Pegram, Macon > > to: > > Rules Users List > > 10/01/2009 10:34 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > What you need to do is implement your own SystemEventListener > implementation to override the default one. Before you do anything > meaningful with Drools, you’ll want to override the default by calling: >SystemEventListenerFactory.setSystemEventListener( SystemEventListenerImpl>); > > Here’s a basic no-op listener: > new SystemEventListener () { > > public void debug(String arg0) { } > public void debug(String arg0, Object arg1) {} > public void exception(Throwable arg0) {} > public void exception(String arg0, Throwable arg1) {} > public void info(String arg0) {} > public void info(String arg0, Object arg1) {} > public void warning(String arg0) {} > public void warning(String arg0, Object arg1) {} > > }; > > In reality what you probably want to do is hook in your > application’s logger here so it will respect the same log levels the > rest of your application runs under. > > Macon > > > > From: rules-users-boun...@lists.jboss.org [mailto:rules-users- > boun...@lists.jboss.org] On Behalf Of Steve Ronderos > Sent: Wednesday, September 30, 2009 12:53 PM > To: rules-users@lists.jboss.org > Subject: [rules-users] (no subject) > > > Hello Drools Users, > > I've been looking into why Drools 5 is logging debug and info > messages to System.out in my app and trying to figure out how to > make it stop. It looks like the SystemEventListener that the > SystemEventListenerFactory returns is a > DelegatingSystemEventListener that delegates to a > PrintStreamSystemEventListener. This, by default, uses System.out > as the print stream target. I looked into the Factory and it looks > like I can provide a different SystemEventListener or > SystemEventListenerProvider, but it also mentions that it did not > find anything in the properties, so it fails over to the default > SystemEventListenerProvider. Is there a way to configure a custom > SystemEventListener or SystemEventListenerProvider so that you don't > have to call > SystemEventListenerFactory.setSystemEventListenerProvider() at startup? > > Thanks, > > Steve Ronderos___ > 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] (no subject)
Hello Drools Users, I've been looking into why Drools 5 is logging debug and info messages to System.out in my app and trying to figure out how to make it stop. It looks like the SystemEventListener that the SystemEventListenerFactory returns is a DelegatingSystemEventListener that delegates to a PrintStreamSystemEventListener. This, by default, uses System.out as the print stream target. I looked into the Factory and it looks like I can provide a different SystemEventListener or SystemEventListenerProvider, but it also mentions that it did not find anything in the properties, so it fails over to the default SystemEventListenerProvider. Is there a way to configure a custom SystemEventListener or SystemEventListenerProvider so that you don't have to call SystemEventListenerFactory.setSystemEventListenerProvider() at startup? Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Syntax
You sure can do it in Drools rule "Rule1" when User( privilegeList contains "User Privilege", privilegeList contains "Admin Privilege") then //Do stuff end rule "Rule2" when User( privilegeList contains "Admin Privilege") then //Do stuff end rule "Rule3" when User( privilegeList contains "User Privilege") then //Do stuff end Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 09/03/2009 01:32:19 PM: > [image removed] > > [rules-users] Drools Syntax > > Lindy hagan > > to: > > Rules Users List > > 09/03/2009 01:35 PM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Hi, > > Could anyone tell me what will be the syntax to check for a list in > the drl file. > > For ex: > > If the user object contains userid (userId) and list of privileges > (privilegeList) values can be User Privilege or Admin Privilege. > > I want to create 3 rules : > > privilegeList.contains("User Privilege ") && privilegeList.contains > ("Admin Privilege") first rule > privilegeList.contains("User Privilege ") second rule, > privilegeList.contains("Admin Privilege") third rule, > > can this be done in Drools? > > Thanks, > Lindy > > > ___ > 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] Calculating minimal value for a group of facts
You can use a collect statement to get all of the Job objects. $list : ArrayList() from collect ( Job() ) alternatively if all that your service method call is doing is comparing the values of a field in a list of Job objects, there are ways to do that without the eval when $shortest : Job ( $min : min) not Job(min < $min) then go go go! Hope this helps! Steve Ronderos From: kothvandir kothvandir To: rules-users@lists.jboss.org Date: 08/31/2009 01:35 PM Subject: [rules-users] Calculating minimal value for a group of facts Sent by: rules-users-boun...@lists.jboss.org Hi, I need to calculate the min time for a set of "jobs" inserted in working mermory to know wich job is going to be finished first. Is there any way to obtain within a rule the current facts of some type to pass then to a function/method? somethin like this: Another idea to acomplish this? gobal MyService myservice rule "cmdCheckTime" ruleflow-group "comprobarExistencias" when Job(time = eval(myService.getMinTime( )) then go, go, go... end Thank you___ 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] Using "in" in Guvnor's Guided Rule Editor
Hello Rules Users, I think I've seen a message about this before, but I can not find it. We make heavy use of the "in" keyword in our current DRL rules files. We are trying to start using Guvnor and its Guided Rule Editor. Is there a way to use "in" in the Guided Rule Editor, other than by adding free form DRL? If there is not a way, can anyone propose another way to accomplish the same goal? Also if you can't use "in" in the Guided Rule Editor, is there an open feature request? Thanks, Steve Ronderos ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How can I configure who is an Admin in Guvnor?
Hello Drools Users, In the Guvnor Documentation ( http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html/ch01.html#d0e185 ) it states that ". It is also possible (thanks to JAAS) to define what users have the "admin" role for Guvnor (note that an Admin user of Guvnor doesn't have to really be a system administrator). " I wasn't sure if this meant that there was a way to define Admins from within the Guvnor UI or if it was possible to configure the admin role to read from an LDAP group or some other JAAS method. We are going to be deploying Guvnor to a production environment in the near future, we want to take advantage of Role Based Authorization, we want to start with an empty DB and we don't want to have to deploy with Authorization off, set up roles and then turn it back on. Is this possible? Or did I misinterpret the documentation? Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Guvnor Remoting API
Michael, That is really good news! Due to the timeline my project is on, I think I'm going to have to implement some kind of workaround for now (I'm thinking a JSP that exposes the behavior I need in a REST-like way). I would however be very interested in helping with development as well as testing. Let me know how I can help! Thanks, Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 08/04/2009 10:55:07 AM: > [image removed] > > Re: [rules-users] Drools Guvnor Remoting API > > Michael Rhoden > > to: > > Rules Users List > > 08/04/2009 10:57 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Michael Neale would know better on the progress, but we discussed > this exact feature back at Javaone a few months ago. My view is the > selectors are still experimental, but are very close to being able > to use. There have been talks about how to harden it up and do just > what you are asking for. I believe there is a REST api for guvnor as > well as webdav, but I dont think they talk to the selectors yet, > though I could be wrong. > > Given this is a feature we want, and I know Michael Neale has agreed > its a good idea and needed, what is your interest in Co-developing/ > Testing something like this with us? > > Michael Rhoden > VP - IT Development > Franklin American Mortgage Company > Direct: 615-778-1117 > Fax: 615-778-2766 > Email: mrho...@franklinamerican.com > > - Original Message - > From: "Steve Ronderos" > To: rules-users@lists.jboss.org > Sent: Tuesday, August 4, 2009 10:42:33 AM GMT -06:00 US/Canada Central > Subject: [rules-users] Drools Guvnor Remoting API > > > Hello Again, > > I asked a question similar to this awhile back, David Sinclair > answered some of my questions, but I'm still looking for a few features. > > Here is my use case. > > We are deploying Guvnor to an enterprise environment. > We plan on having one Guvnor for our rule authors to create/edit rules in. > We plan on using selectors to control which rules are included into > packages that are built for different environments (development, > test, production). > We can't have our application that use rules pointing directly at > the Guvnor instance. > We want an automated "deployment" process. > > Here is what I was thinking. > > I would like to be able to invoke a build, using a specified > selector, then create a snapshot that follows a specific naming > convention (ie with the selector's name in the snapshot name), in > sequence. In order to do this, I would like to, from a remote > application, tell Guvnor to do a build, then to do a snapshot. So > essentially what I'm asking for is a remoting API for Guvnor's > features. I've looked through some of the Guvnor code and I believe > I see that there is a remote API for the drools-repository that > Guvnor sits on, but what I need is specifically Guvnor's features to > be made available in a remoting API. > > Does anyone know if such a thing exists? If not is it planned? If > not, am I even asking for a desirable feature? > > Thanks, > > Steve Ronderos > ___ 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools Guvnor Remoting API
Hello Again, I asked a question similar to this awhile back, David Sinclair answered some of my questions, but I'm still looking for a few features. Here is my use case. We are deploying Guvnor to an enterprise environment. We plan on having one Guvnor for our rule authors to create/edit rules in. We plan on using selectors to control which rules are included into packages that are built for different environments (development, test, production). We can't have our application that use rules pointing directly at the Guvnor instance. We want an automated "deployment" process. Here is what I was thinking. I would like to be able to invoke a build, using a specified selector, then create a snapshot that follows a specific naming convention (ie with the selector's name in the snapshot name), in sequence. In order to do this, I would like to, from a remote application, tell Guvnor to do a build, then to do a snapshot. So essentially what I'm asking for is a remoting API for Guvnor's features. I've looked through some of the Guvnor code and I believe I see that there is a remote API for the drools-repository that Guvnor sits on, but what I need is specifically Guvnor's features to be made available in a remoting API. Does anyone know if such a thing exists? If not is it planned? If not, am I even asking for a desirable feature? Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Import Existing DRL in Guvnor never finishes
The same import worked on a fresh stand-alone version of Guvnor v. 5.0.1.GA which is using Jackrabbit's built in Derby DB. Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 07/29/2009 10:53:41 AM: > [image removed] > > Re: [rules-users] Import Existing DRL in Guvnor never finishes > > Jaroslaw Kijanowski > > to: > > Rules Users List > > 07/29/2009 10:57 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Do you see the same issue when using the Jackrabbit's built-in Derby DB? > > Steve Ronderos wrote: > > > > Sorry, I probably should have included that information. > > > > We are using 5.0.1.GA, Jackrabbit is configured to store the data in an > > Oracle database. Is there any other information I can provide? > > > > Thanks, > > > > Steve Ronderos > > > > rules-users-boun...@lists.jboss.org wrote on 07/29/2009 01:33:31 AM: > > > > > [image removed] > > > > > > Re: [rules-users] Import Existing DRL in Guvnor never finishes > > > > > > Jaroslaw Kijanowski > > > > > > to: > > > > > > Rules Users List > > > > > > 07/29/2009 01:39 AM > > > > > > Sent by: > > > > > > rules-users-boun...@lists.jboss.org > > > > > > Please respond to Rules Users List > > > > > > Hi, > > > what version? 5.0.1.GA? > > > Have you changed Jackrabbit's backend or are you using the default > > settings? > > > > > > Cheers, > > > Jarek > > > > > > Steve Ronderos wrote: > > > > > > > > Hello All, > > > > > > > > I'm experiencing an issue importing an existing DRL into Guvnor, we > > > > made a sample DRL file containing 1000 very simple rules that look > > > > something like this: > > > > > > > > rule "testa4" > > > > dialect "mvel" > > > > when > > > > IOption( selected == "false" && id == "9934" ) > > > > messageSection : INode( id == "Drivers" ) > > > > then > > > > messageSection.setValidationMessage( "null" ); > > > > messageSection.setValidationMessageDuration( null ); > > > > end > > > > > > > > Each rule has a unique name. The problem is that the import hasn't > > > > finished (after over 2 hours) and when we look at the resources that > > > > have been imported they have 24 revisions each. It looks like > > Guvnor is > > > > importing the file over and over again. > > > > > > > > Has anyone experienced anything like this? > > > > > > > > Thanks, > > > > > > > > Steve Ronderos > > > > > > > > > > > > > > > > > > > > > > ___ > > > > 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 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Import Existing DRL in Guvnor never finishes
Sorry, I probably should have included that information. We are using 5.0.1.GA, Jackrabbit is configured to store the data in an Oracle database. Is there any other information I can provide? Thanks, Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 07/29/2009 01:33:31 AM: > [image removed] > > Re: [rules-users] Import Existing DRL in Guvnor never finishes > > Jaroslaw Kijanowski > > to: > > Rules Users List > > 07/29/2009 01:39 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Hi, > what version? 5.0.1.GA? > Have you changed Jackrabbit's backend or are you using the default settings? > > Cheers, > Jarek > > Steve Ronderos wrote: > > > > Hello All, > > > > I'm experiencing an issue importing an existing DRL into Guvnor, we > > made a sample DRL file containing 1000 very simple rules that look > > something like this: > > > > rule "testa4" > > dialect "mvel" > > when > > IOption( selected == "false" && id == "9934" ) > > messageSection : INode( id == "Drivers" ) > > then > > messageSection.setValidationMessage( "null" ); > > messageSection.setValidationMessageDuration( null ); > > end > > > > Each rule has a unique name. The problem is that the import hasn't > > finished (after over 2 hours) and when we look at the resources that > > have been imported they have 24 revisions each. It looks like Guvnor is > > importing the file over and over again. > > > > Has anyone experienced anything like this? > > > > Thanks, > > > > Steve Ronderos > > > > > > > > > > ___ > > 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Import Existing DRL in Guvnor never finishes
Hello All, I'm experiencing an issue importing an existing DRL into Guvnor, we made a sample DRL file containing 1000 very simple rules that look something like this: rule "testa4" dialect "mvel" when IOption( selected == "false" && id == "9934" ) messageSection : INode( id == "Drivers" ) then messageSection.setValidationMessage( "null" ); messageSection.setValidationMessageDuration( null ); end Each rule has a unique name. The problem is that the import hasn't finished (after over 2 hours) and when we look at the resources that have been imported they have 24 revisions each. It looks like Guvnor is importing the file over and over again. Has anyone experienced anything like this? Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools Guvnor Remote API
Does anyone know if there is a Remoting API in Guvnor? I see mention of it in some wiki pages, and in the web.xml in the Guvnor source. I'm trying to see if I can remotely trigger a build for a specific package, with a selector for the build, then create a snapshot for the same package. If anyone has any information about the API please let me know. Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Using variables as map keys in MVEL in LHS
Thanks Edson, worked like a charm! Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 07/16/2009 09:09:31 AM: > [image removed] > > Re: [rules-users] Using variables as map keys in MVEL in LHS > > Edson Tirelli > > to: > > Rules Users List > > 07/16/2009 09:11 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > >This was a bug in one of the MVEL versions that is fixed. Can you > update your MVEL jar to one of the latest releases? I think it is 2.0.12. > >[]s >Edson > 2009/7/16 Steve Ronderos > > Hello, > > Again, I'm working on converting my project that used Drools 4.0.7 to 5.0.1. > > I've run across a problem with a rule that accesses a map in the LHS > using a variable as the key. When MVEL tries to resolve this, it > appears that it is not evaluating the variable before accessing the > map. I've modified the Shopping example from the Drools 5.0.1 > Examples to recreate the issue in a simpler setting. > > This is the rule (I removed all the other rules for this example) > rule "Cart notification" > salience 10 > > when > $p : Product( $productName : name) > $c : Customer( cart[$productName] == $p) > then > System.out.println( "Customer " + $c.name + " has " + $p.name > + " in cart"); > end > > I added the following to the Customer class: > > private Map cart = new HashMap(); > public Map getCart() { > return cart; > } > > and I modified the main method to be: > > public static final void main(String[] args) throws Exception { > final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory. > newKnowledgeBuilder(); > kbuilder.add( ResourceFactory.newClassPathResource( > "Shopping.drl", ShoppingExample.class ), > ResourceType.DRL ); > > final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); > kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); > > final StatefulKnowledgeSession ksession = > kbase.newStatefulKnowledgeSession(); > > Customer mark = new Customer( "mark", > 0 ); > ksession.insert( mark ); > > Product shoes = new Product( "shoes", > 60 ); > ksession.insert( shoes ); > > mark.getCart().put("shoes", shoes); > > ksession.fireAllRules(); > } > > So basically, I added a map to Customer, inserted one item and made > a rule that will use a variable as a key for that map. > What I would expect to happen is: > the Product pattern would match the shoes Product that is inserted > into the ksession, the $productName variable would contain the value "shoes" > the Customer fact, mark, would be matched with the second pattern > in the rule because cart["shoes"] should resolve to the shoes fact > which is $p in the rule > The message should print > > What actually happens is an error message: > > Exception in thread "main" org.drools.RuntimeDroolsException: > Exception executing predicate cart[$productName] == $p > at org.drools.rule.PredicateConstraint.isAllowedCachedLeft( > PredicateConstraint.java:302) > at org.drools.common.SingleBetaConstraints.isAllowedCachedLeft( > SingleBetaConstraints.java:138) > at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:114) > at > org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple( > SingleLeftTupleSinkAdapter.java:117) > at > org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple > (SingleLeftTupleSinkAdapter.java:78) > at org.drools.reteoo.LeftInputAdapterNode.assertObject( > LeftInputAdapterNode.java:142) > at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject( > SingleObjectSinkAdapter.java:42) > at org.drools.reteoo.ObjectTypeNode.assertObject( > ObjectTypeNode.java:185) > at org.drools.reteoo.EntryPointNode.assertObject( > EntryPointNode.java:146) > at org.drools.common.AbstractWorkingMemory.insert( > AbstractWorkingMemory.java:1046) > at org.drools.common.AbstractWorkingMemory.insert( > AbstractWorkingMemory.java:1001) > at org.drools.common.AbstractWorkingMemory.insert( > AbstractWorkingMemory.java:788) > at org.drools.impl.StatefulKnowledgeSessionImpl.insert( > StatefulKnowledgeSessionImpl.java:216) > a
[rules-users] Using variables as map keys in MVEL in LHS
Hello, Again, I'm working on converting my project that used Drools 4.0.7 to 5.0.1. I've run across a problem with a rule that accesses a map in the LHS using a variable as the key. When MVEL tries to resolve this, it appears that it is not evaluating the variable before accessing the map. I've modified the Shopping example from the Drools 5.0.1 Examples to recreate the issue in a simpler setting. This is the rule (I removed all the other rules for this example) rule "Cart notification" salience 10 when $p : Product( $productName : name) $c : Customer( cart[$productName] == $p) then System.out.println( "Customer " + $c.name + " has " + $p.name + " in cart"); end I added the following to the Customer class: private Map cart = new HashMap(); public Map getCart() { return cart; } and I modified the main method to be: public static final void main(String[] args) throws Exception { final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory. newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource( "Shopping.drl", ShoppingExample.class ), ResourceType.DRL ); final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); Customer mark = new Customer( "mark", 0 ); ksession.insert( mark ); Product shoes = new Product( "shoes", 60 ); ksession.insert( shoes ); mark.getCart().put("shoes", shoes); ksession.fireAllRules(); } So basically, I added a map to Customer, inserted one item and made a rule that will use a variable as a key for that map. What I would expect to happen is: the Product pattern would match the shoes Product that is inserted into the ksession, the $productName variable would contain the value "shoes" the Customer fact, mark, would be matched with the second pattern in the rule because cart["shoes"] should resolve to the shoes fact which is $p in the rule The message should print What actually happens is an error message: Exception in thread "main" org.drools.RuntimeDroolsException: Exception executing predicate cart[$productName] == $p at org.drools.rule.PredicateConstraint.isAllowedCachedLeft( PredicateConstraint.java:302) at org.drools.common.SingleBetaConstraints.isAllowedCachedLeft( SingleBetaConstraints.java:138) at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:114) at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple( SingleLeftTupleSinkAdapter.java:117) at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple( SingleLeftTupleSinkAdapter.java:78) at org.drools.reteoo.LeftInputAdapterNode.assertObject( LeftInputAdapterNode.java:142) at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject( SingleObjectSinkAdapter.java:42) at org.drools.reteoo.ObjectTypeNode.assertObject( ObjectTypeNode.java:185) at org.drools.reteoo.EntryPointNode.assertObject( EntryPointNode.java:146) at org.drools.common.AbstractWorkingMemory.insert( AbstractWorkingMemory.java:1046) at org.drools.common.AbstractWorkingMemory.insert( AbstractWorkingMemory.java:1001) at org.drools.common.AbstractWorkingMemory.insert( AbstractWorkingMemory.java:788) at org.drools.impl.StatefulKnowledgeSessionImpl.insert( StatefulKnowledgeSessionImpl.java:216) at org.drools.examples.ShoppingExample.main( ShoppingExample.java:32) Caused by: [Error: unable to resolve method: java.util.HashMap.$productName() [arglength=0]] [Near : {... Unknown }] ^ [Line: 1, Column: 0] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod( ReflectiveAccessorOptimizer.java:906) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty( ReflectiveAccessorOptimizer.java:585) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain( ReflectiveAccessorOptimizer.java:313) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor( ReflectiveAccessorOptimizer.java:138) at org.mvel2.ast.ASTNode.getReducedValueAccelerated( ASTNode.java:133) at org.mvel2.compiler.ExecutableAccessor.getValue( ExecutableAccessor.java:37) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionProperty( ReflectiveAccessorOptimizer.java:633) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain( ReflectiveAccessorOptimizer.java:319) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor( ReflectiveAccessorOptimizer.java:138) at org.mvel2.ast.ASTNode.getReducedValueAccelerated( ASTNode.java:133)
[rules-users] Accumulate and Serializable
Hello, I've been working on upgrading an application that uses Drools 4.0.7 to 5.0.1. For the most part things have been going well. After I got the rules running with 5.0.1 I started getting a ClassCastException on one of my model classes within the class MVELAccumulatorFunctionExecutor. Here is the full stacktrace org.drools.runtime.rule.ConsequenceException: org.drools.RuntimeDroolsException: java.lang.ClassCastException: com.example.Slot at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:945) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1091) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:684) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:650) at com.example.StatefulDroolsRuleManager.execute(StatefulDroolsRuleManager.java:59) at com.example.common.TestMaxQuantity.multipleMaximum4Slot(TestMaxQuantity.java:115) 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:585) 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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 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:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997) Caused by: org.drools.RuntimeDroolsException: java.lang.ClassCastException: com.example.Slot at org.drools.rule.Accumulate.accumulate(Accumulate.java:172) at org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:432) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:284) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:337) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146) at org.drools.common.AbstractWorkingMemory.modifyInsert(AbstractWorkingMemory.java:1365) at org.drools.base.DefaultKnowledgeHelper.modifyInsert(DefaultKnowledgeHelper.java:201) at org.drools.base.DefaultKnowledgeHelper.modifyInsert(DefaultKnowledgeHelper.java:19
Re: [rules-users] Class Cast Exception in Drools 4 Generated Accumulate Method
Edson, Thanks for the quick response! I'm using Drools 4.0.7 and mvel 1.3.1 Thanks for the tip about packages and rulebases. I'll make sure to change that in our code. As far as changing the accumulate to collect, I can easily work around that selector returning a list of PotentialMatches instead of Integers. I made that change and have been unable to create the ClassCastException since. I'm still not certain that the problem is resolved due to its random nature, but I'm hoping that it is patched enough for now until we can make the rulebase change you mentioned. Thanks for the info about Drools 5. I'm currently in the process of converting to Drools 5. You're right the eval does look odd, but it is working for the time being. This rule is in one of the first features I implemented using Drools, so it is probably not done in the best way possible. I'll keep an eye on it if I do not get this issue resolved some other way. Thanks again! Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 06/23/2009 11:09:48 AM: > [image removed] > > Re: [rules-users] Class Cast Exception in Drools 4 Generated > Accumulate Method > > Edson Tirelli > > to: > > Rules Users List > > 06/23/2009 11:29 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > >Steve, > >What versions of MVEL and Drools are you using? >Comments: > > * You can not share packages between rulebases. You can share > rulebases among sessions. So, I strongly advise you to change your > application to build the rulebase once, and have the web sessions > only create the rule session every time... not the whole rulebase. > Since packages have their own classloaders and everytime you create > a rulebase you merge such classloaders, the problem might happen > (CCE) exactly at the time you are creating the rulebase > concurrently. Drools 5 allows you to share packages, although I > still prefer to not do it and share only the rulebase. > > * You can not use collect in this case, because you are creating a > list of $slot, not a list of PotentialMatch. Although, it is > extremely easy to create an accumulate function for that. Drools 5 > includes 2 accumulate functions: collectSet and collectList for > that. If you want, just get the class from Drools 5, fix the imports > to use the classes from Drools 4 and use it. Except for the > "imports" you should not have any problem. Your rule would look like: > > > rule "My Rule" > salience 50 > dialect "java" > no-loop true > when > $module : Module( selected == false, required > 1, $size : required ) > $list : List( ) > from accumulate( PotentialMatch( module == $module, > $slot : slot ), > collectList( $slot ) ) > eval( countThem($list, $size) != $module.setMatchCount() ) > then > modify( $module ) { setMatchCount(countThem($list, $size)) }; > end > > * Finally, your eval looks odd to me, but anyway, don't have enough > details to advise you on that. > > > []s > Edson > > 2009/6/23 Steve Ronderos > > Hi Rules Users, > > I'm experiencing an issue with a Drools 4.0.7 rule. > > Here is a clip of the exception that is thrown: > > Caused by: org.mvel.CompileException: cannot invoke method > at org.mvel.optimizers.impl.refl.MethodAccessor.getValue > (MethodAccessor.java:54) > at org.mvel.optimizers.impl.refl.VariableAccessor.getValue > (VariableAccessor.java:39) > at > org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated > (VariableDeepPropertyNode.java:22) > at org.mvel.ast.PropertyASTNode.getReducedValueAccelerated > (PropertyASTNode.java:21) > at org.mvel.MVELRuntime.execute(MVELRuntime.java:90) > at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111) > at org.mvel.MVEL.executeExpression(MVEL.java:235) > at org.drools.base.mvel.MVELConsequence.evaluate > (MVELConsequence.java:48) > at org.drools.common.DefaultAgenda.fireActivation > (DefaultAgenda.java:554) > ... 80 more > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.GeneratedMethodAccessor412.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at org.mvel.optimizers.impl.refl.MethodAccessor.getValue > (MethodAccessor.java:46) > ... 88 more
[rules-users] Class Cast Exception in Drools 4 Generated Accumulate Method
Hi Rules Users, I'm experiencing an issue with a Drools 4.0.7 rule. Here is a clip of the exception that is thrown: Caused by: org.mvel.CompileException: cannot invoke method at org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:54) at org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39) at org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22) at org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21) at org.mvel.MVELRuntime.execute(MVELRuntime.java:90) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111) at org.mvel.MVEL.executeExpression(MVEL.java:235) at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554) ... 80 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor412.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:46) ... 88 more Caused by: org.drools.RuntimeDroolsException: java.lang.ClassCastException: com.demo.Rule_My_Rule_0$Accumulate0 at org.drools.rule.Accumulate.accumulate(Accumulate.java:131) at org.drools.reteoo.AccumulateNode.modifyTuple(AccumulateNode.java:352) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:248) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162) at org.drools.reteoo.Rete.assertObject(Rete.java:175) at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192) at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883) at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:67) at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:61) ... 92 more Caused by: java.lang.ClassCastException: com.demo.Rule_My_Rule_0$Accumulate0 at com.demo.Rule_My_Rule_0Accumulate0Invoker.accumulate(Rule_My_Rule_0Accumulate0Invoker.java:43) at org.drools.rule.Accumulate.accumulate(Accumulate.java:123) ... 103 more The actually rule name and package are a lot longer, I changed them here for brevity and because I don't believe the names themselves are relevant. This exception is being thrown intermittently when this rule, which contains an accumulate function is called. I say intermittently because it does not happen every time the rule is run. As far as I can tell the ClassCastExceptions only happens when the computer that the rules are running on is under load. A few more details before I post the rule itself. The rule base that I am building consists of 2 drl files. Both of the files have the same package declaration at the top. The 2 packages are built separately using PackageBuilder then combined using RuleBase.addPackage() on both packages. Also, I'm not sure if this is relevant, but this scenario takes place in a web application where the two package objects are only built once (for performance) but each user session creates a new RuleBase and adds the packages. The individual sessions then create stateful sessions from the rule base. This is the rule that I believe is causing the issue. rule "My Rule" salience 50 dialect "java" no-loop true when $module : Module( selected == false, required > 1, $size : required ) $list : ArrayList( ) from accumulate( PotentialMatch( module == $module, $slot : slot ), init( List result = new ArrayList(); ), action( result.add($slot); ), reverse( result.remove((Integer)$slot ); ), result( result ) ) eval( countThem($list, $size) != $module.setMatchCount() ) then modify( $module ) { setMatchCount(countThem($list, $size)) }; end As I'm typing this I realize that there is another way to write this rule using collect. I'm not sure why it was written this way, but since I have already come this far, has anyone had any experience with the Drools 4 generated code throwing ClassCastExceptions? Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Deploying Guvnor in an Enterprise environment
Hello Drools Users, I'm working on deploying Guvnor in an enterprise environment. There is some mention in the JBoss Wikis http://www.jboss.org/community/wiki/GuvnorRoadmapFor0809 and http://www.jboss.org/community/wiki/Guvnor about lifecycle management of assets in Guvnor. The descriptions in those two articles is somewhat brief and does not quite cover all of my requirements. We have a need to be able to deploy assets to various dev, staging and production servers and define which assets should be deployed in a given deploy. I realize that snapshots and selectors can be leveraged to get this kind of functionality, but it does not feel like a robust solution. Additionally, we have scenarios where two users might need to edit the same asset for two different releases, and test them on different environments simultaneously. Has anyone implemented Guvnor in a Dev, Staging, Production environment that could give some pointers on how to manage these concurrent release issues? Thanks, Steve Ronderos___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RE: questions on guvnor and drools 5.0
Hi Shawn, I'm also currently evaluating Guvnor. I certainly don't have all the answers but maybe I can share what I have learned so far. I've put my comments below. Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 06/04/2009 08:14:30 AM: > [image removed] > > [rules-users] RE: questions on guvnor and drools 5.0 > > Garner, Shawn > > to: > > rules-users@lists.jboss.org > > 06/04/2009 08:19 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Sorry it's been a few days and I haven't gotten any response on any > questions/statements below. > > I've used drools in the past but am pretty new to some features of > drools still and new to Guvnor. I wrote a proof of concept drools/ > Guvnor app and these are the things I don't like or have questions around. > > I was wondering if other people have the same problems or am I going > about things wrong? Are there work arounds or is there plans to > expand/change functionality? Maybe I should ask the dev list? > > SG > > -Original Message- > From: G, S > Sent: Monday, June 01, 2009 3:28 PM > To: 'rules-users@lists.jboss.org' > Subject: questions on guvnor and drools 5.0 > > I was wondering if somebody can help me with some questions: > > 1) Is there any more detail on how to setup Guvnor with a database? Guvnor uses Apache Jackrabbit for persistence. You can find a pretty good walk through on the Drools blog http://blog.athico.com/2008/08/tuning-guvnor.html. Additional information about configuring the repository can be found on the Apache Jackrabbit site. http://jackrabbit.apache.org/jackrabbit-configuration.html > 2) How do you use the test scenarios with complex object structures? >-eg Create a fact in working memory that has another Object in it > which in turn has a list of Objects in it. >-Seems like any Fact in working memory is assumed to only have > only primitive values like Strings or numbers. >-We would like a more depth of objects where objects have a deep > relationship to other objects at least 2-4 levels deep. I'm not sure, haven't used that feature of Guvnor much yet. > 3) Why add ruleflow-group to the rule definition instead of adding > the rule to a ruleflow-group? If the ruleflow-group is part of the > rule then you can't use the same rule in multiple ruleflow-groups > and leads to copy and maintaining the rule in two different spots. Should probably ask the dev group this one. > 4) DSL seems to be very inconvenient to edit in a text box > especially when it wraps. Why not a table where you can add rows > and each row is a translation. Also there are no examples how to do > translation into Drools syntax that is multiple lines long and not > just a single line. I haven't used DSLs much either yet. Maybe ask the dev group this one also. > 5) Is Java 5 Type Enumerations supported? I was assuming I'd get a > list of values if a field was an Enumeration. Not sure > 6) There seems to be a vast functionality difference between the > Guvnor decision tables and examples that use spreadsheets. I believe that Guvnor decision tables are not as full featured as the spreadsheet based version, but you can still upload spreadsheets to Guvnor as decision tables. > 7) Guvnor lost the ability to select variables for use in other > statements. Functionality was in BRMS of drools 4.0.7 I don't understand the question. Are you talking about assigning a pattern or an attribute in a pattern to a variable for use in another statement in the LHS or RHS? If so clicking on the fact type or field restriction that gives you that option. > 8) I was not able to insert a fact using a constructor that needed > parameter values. Seems like it assumes everything is a bean but I > couldn't find this requirement stated in the documentation anywhere. > Examples in documentation show inserting facts with constructor parameters. Are you talking about in the Guided Rules Editor? I haven't tried this, but it sounds like a bug. Maybe ask the dev team. > 9) It would be nice when you upload a domain model jar that you > could explore the objects and fields somehow. I agree, being able to traverse the model that you include would be nice. Maybe ask the dev team if there are plans for such a feature or create a request in the Guvnor JIRA. https://jira.jboss.org/jira/browse/JBRULES > 10) When you write a rule using one particular editor it would be > nice if you could switch to another editor. Switch between Guided, > DSL, Technical, etc. Agreed. Some other posters on the email group have discussed this before. As it stands th
Re: [rules-users] Clarification regarding the use of Guvnor
Andrew, Looks like you are looking for drools-server to expose the rule engine via JSON. I'm not an expert on the subject by any means, but try reading the documentation (embedded in the Guvnor documents http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html_single/index.html#d0e1095 ) and see if anyone else on the mail group knows more about it. Good luck, Steve Ronderos From: Andrew Nguyen To: rules-users@lists.jboss.org Date: 06/01/2009 10:27 AM Subject: [rules-users] Clarification regarding the use of Guvnor Sent by: rules-users-boun...@lists.jboss.org Hello all, I am a very new Drools user and am trying to expose it as a web- service. Due to my experience with Spring, I went ahead and implemented a basic rule engine and exposed it as a web service via Spring. I am now looking at integrating it with Guvnor to allow non- computer people, who are domain experts, to modify the rules. From what I have read in the v5 documentation, it sounds like Guvnor is intended as a complete solution to what I am trying to accomplish - i.e. it will handle the rule management as well as exposing the rule engine via JSON (or other interface). But, when I have searched around the internet, Guvnor sounds like just a rule management component. So, I pretty much have 3 questions: * Is my current setup of Drools + Spring the best way to expose my rule engine to other applications? (Specifically, a .NET/C# app...) * Is Guvnor suitable for integrating into my system as only a rule management system? Thanks! --Andrew -- Andrew Nguyen Nguyen & Associates Custom Software Development & IT Services http://www.na-consulting.net and...@na-consulting.net 858-225-7575 ___ 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 import DRL into Business Rule Assets section?
rules-users-boun...@lists.jboss.org wrote on 05/19/2009 06:40:34 PM: > [image removed] > > Re: [rules-users] How to import DRL into Business Rule Assets section? > > Late Norther > > to: > > Rules Users List > > 05/19/2009 06:53 PM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > 2009/5/19 Michal Bali : > > Hi Jon, > > > > You could use webdav to connect to Guvnor - > > http://blog.athico.com/2008/05/accessing-guvnor-as-filesystem-webdav.html. > > You should then see how Guvnor stores the 'business rules', I think it is an > > XML file. Then instead of generating DRL file you could generate this XML. > > You can then upload these files via webdav into Guvnor. > > Hope this helps. > > > > Regards, > > Michal > > > > Michal, > > I can't thank you enough. This worked well. > > For others, here is a review of what I did. > > 1. Created a 'dummy' rule using the guided editor in my target package. > 2. Used the blog URL above to mount the package webdav share > 3. Downloaded the 'dummy' rule from the webdav share to act as a template > 4. Updated my Perl import/export script to create .brl files instead > of .drl files, using the template. > 5. Copied the new .brl files created by my utility script to the webdav share. > 6. Go back to Guvnor GWT and saw/confirmed my rules. > > The only snafu I found was that I am unable to populate a category as > part of the import, but I can have my analysts do that by hand if > needed. That apparently is not stored in the .brl, but rather > somewhere else. I did confirm that I can update the category in the > UI after the load. > > Again, Thank you. > > Jon > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users Jon, We are currently trying to convert our drl files to brls as well. Would it be possible to share your perl conversion utility? We were just about to start creating a similar script, but it would help us out greatly if we could have a look at yours. Thanks, Steve ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5 Final location
Mark, My team is currently evaluating Drools 5 and are very excited about it's upcoming release. Do you have a target date for a 5.x.x.GA release? It would really be helpful when we are putting together our project's timeline. Thanks! Steve Ronderos From: Mark Proctor To: Rules Users List Date: 05/06/2009 09:24 AM Subject: Re: [rules-users] Drools 5 Final location Sent by: rules-users-boun...@lists.jboss.org J. Michael Dean wrote: Where can I locate the 5.00 FINAL artifacts? On Hudson the revisions are way beyond this version; I found everything on SVN but not eager to try to build it myself. Sorry for probable idiotic question. We aren't doing a full release of 5.0.0, that was branched for the Drools Product. We'll publish 5.0.1 as the community release. Mark ___ 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users