Re: [rules-users] Is there a way to add a JAR to a knowledBuilder
You are right. What I was doing was stupid. On Thu, May 2, 2013 at 9:53 PM, Davide Sottara dso...@gmail.com wrote: What would be the exact use case for this? The FactType reflective API is used to access the classes declared in DRL and compiled on-the-fly at runtime. As long as the jar is on the classpath, you should be fine. Notice that guvnor is different, since you do have to deliver the jar there. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Is-there-a-way-to-add-a-JAR-to-a-knowledBuilder-tp4023631p4023646.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 -- Charles Moulliard Apache Committer / Sr. Enterprise Architect (RedHat) Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KnowledgeAgent to update knowledge base built with Guvnor pkg
Thank you very much for the detailed explanation, things are clearer now. I would have liked to be able to initialize the KA with an empty KB but I need to be able to set the configuration options for it and for now I don't see how that is done. Can the options, like STREAM mode be set when creating the KB from the KA? Otherwise I will continue to re-create the environment before running a session since for now it is the only option that works. Best regards -- View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-KnowledgeAgent-to-update-knowledge-base-built-with-Guvnor-pkg-tp4023608p4023654.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] KnowledgeAgent to update knowledge base built with Guvnor pkg
The options are set at the KB level, way before rules etc.. are added. So yes, you can initialize an empty KB and use changesets to add rules dynamically later. Notice this: KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(conf); /* knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages()); */ return knowledgeBase; You can define a changeset in a file, or you can create it programmatically. On 05/03/2013 12:54 AM, riri wrote: Thank you very much for the detailed explanation, things are clearer now. I would have liked to be able to initialize the KA with an empty KB but I need to be able to set the configuration options for it and for now I don't see how that is done. Can the options, like STREAM mode be set when creating the KB from the KA? Otherwise I will continue to re-create the environment before running a session since for now it is the only option that works. Best regards -- View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-KnowledgeAgent-to-update-knowledge-base-built-with-Guvnor-pkg-tp4023608p4023654.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] [Planner]
Mats Norén wrote Hi, I've got a really simple problem that I can't seem to fix. :-) I'm trying to use a simplified model for a room planning problem. The planning entity is a Topic and the planning variables are Room and TimeSlot. A Person is tied to a Topic as a moderator. Each Person can have multiple Topics as an interest. The hard constraints are that a Person cannot be moderator in two Topics at the same TimeSlot and that there cannot be multiple Topics in the same Room at the same TimeSlot. rule conflictingModeratorInSameTimeslot when $leftTopic : Topic($leftId : id, $leftTimeslot : timeSlot, timeSlot != null, $leftModerator: moderator) $rightTopic : Topic(timeSlot == $leftTimeslot, moderator == $leftModerator, id $leftId) then scoreHolder.addHardConstraintMatch(kcontext, -1); end rule multipleTopicsInSameRoomAndTimeslot when $leftTopic : Topic($leftId : id, $leftTimeslot : timeSlot, timeSlot != null, $leftRoom: room) $rightTopic : Topic(timeSlot == $leftTimeslot, room == $leftRoom, id $leftId) then scoreHolder.addHardConstraintMatch(kcontext, -1); end yep, that's like in the curriculum course scheduling example Mats Norén wrote The soft constraint that I have a problem with is that a Person has multiple Topics as interests and I would like to penalize the Solution with the number of Topics in the Persons interests collection with the number of Topics that are allocated at the same TimeSlot. Any ideas on how to go about this? when $p : Person $rightTopic : Topic( $leftId : id, $t : timelsot) exists Interest(person == $p, topic == $leftTopic) Topic(id $leftId, timeslot == $t) exists Interest(person == $p, topic == $rightTopic) then // This will count the number of conflicting topic pairs // 2 conflicting topics count 1 // 3 conflicting topics count 3 // 4 conflicting topics count 6 You 'll probably want to split up the class Topic into Topic and TopicAssignement, like in the examination example (see domain diagram in latest manual) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Planner-tp4023586p4023658.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] Some Puzzles in planner
erere121 wrote Hello every one ,I study the drool.plannar recently and both tried the planner 5.5 and planner 6.0(optaplanner) to solve my problem. I found something puzzles: 1 Is there any big difference between planner 5.5 and planner 6.0. I run the same process in both planner 5.5 and planner 6.0 with the same config, I find planner 5.5 gives the solution with 19hard broken while planner 6.0 give the solution with 502hard broken ! I am not sure why it happens. 2 When I open the demo in optaplanner in eclipse, I find every scoreHolder.addConstraintMatch(); have the error like this:The method addConstraintMatch(kcontext,..) in the type SimpleScoreHolder is not applicable for the arguments (RuleContext, int), can anybody help me. 3 The problem has a solution which breaks no rules while both planner 5.5 and 6.0 never found it using the tabu search and hill climb search. I wonder is it right or is there any other global search method in planner. 1. That should not happen. Turn on enviromentMode FAST_ASSERT to validate you don't have any score corruption. 2. Sounds like your eclipse is using the wrong optaplanner-core jar on it's classpath to compile 3. It could be that there's no feasible solution (= 0 hard constraints broken) to your solution, but I 'd only start believing this if environmentMode doesn't find any score corruption. If it's a really tiny problem, you can use the configuration bruteForce to be 100% sure. (Note: Tabu search currently doesn't automatically scale down to tiny problems (= less than 10 planning entities), you have to manually lower the planingEntityTabu configuration setting. -- View this message in context: http://drools.46999.n3.nabble.com/Some-Puzzles-in-planner-tp4023580p4023659.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] Ways to list the globals
Okay, took me a while to extract the code and just included the minimal. I know how to reproduce this bug (or something I have done wrong) now. Take a look at testing 2 and 3. Those are where I cannot list the global but the global is set in fact. Now we can continue trying to answer my question and stop guessing or pre-assuming you knew the reason already :P java source: Rule file: Output: -- View this message in context: http://drools.46999.n3.nabble.com/Ways-to-list-the-globals-tp4023616p4023660.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] drools key word
I was looking for a way to get a rule's name within the 'then' condition of the rule.. found an old post on another forum that recommended this (which works): drools.getRule().getName() My question is, what is this 'drools' keyword? could anyone point me to documentation that outlines what else can be done with it. Thanks in advance. Rich. -- View this message in context: http://drools.46999.n3.nabble.com/drools-key-word-tp4023662.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools key word
It was deprecated to kcontext some releases ago. The interface name is RuleContext. http://docs.jboss.org/jbpm/v5.2/javadocs/org/drools/runtime/rule/RuleContext.html Mark On 3 May 2013, at 10:14, rjr201 rich.j.ri...@gmail.com wrote: I was looking for a way to get a rule's name within the 'then' condition of the rule.. found an old post on another forum that recommended this (which works): drools.getRule().getName() My question is, what is this 'drools' keyword? could anyone point me to documentation that outlines what else can be done with it. Thanks in advance. Rich. -- View this message in context: http://drools.46999.n3.nabble.com/drools-key-word-tp4023662.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] drools key word
That's exactly what I needed. Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/drools-key-word-tp4023662p4023665.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] GSOC project - Realtime Collaborative Editor for Drools Decision Tables using Errai OT/EC
Errai has recently added OTEC support, which is a web based system for collaborative editing. I thought this would be really interesting project, working on cutting edge web technologies for anyone doing a GSOC submission. Or actually anyone looking for an engaging task :) https://community.jboss.org/wiki/GSOC13Ideas#Realtime_Collaborative_Editor_for_Drools_Decision_Tables_using_Errao_OTEC Errai OTEC (Operationaly Transformed, Eventually Consistent Data Syncrhonization) facilitates builing Google Wave and Google Docs type applications, with multiple authors in real time on the same document. Two videos showing OTEC editing working in real time for collaboritive authoring: https://www.youtube.com/watch?v=ChCasRr0cZc https://www.youtube.com/watch?v=Wvf5pbOM920 Drools has extensive Decision Table support, which provides a spreadsheet like authoring tool for rules. Errai OTEC can allow two authors to work on the document at the same time. It would provide the following features: -Current cursor/edit location for each user in the document. -Edits to Cells to appear as they happen. -Cell locking, so only one Cell can be updated by one user at a time. Knowledge prerequisite: Java, GWT, Errai Skill level: Medium Contact(s): Michael Anstis Mentor(s): Michael Anstis Associated project(s): Drools, Guvnor, Errai Notes:___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 5.5 run time exception from the library code but no impact to the rule evaluation result
Just want to put the exception out here in case it is meaningful to the development or whoever ran into this before. It occurred but does not impact the result of the process. Exception in thread Thread-6 java.lang.NullPointerException at java.lang.String.init(String.java:210) at org.mvel2.ast.ASTNode.toString(ASTNode.java:426) at org.mvel2.ast.Or.toString(Or.java:59) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:247) at org.drools.rule.constraint.ConditionAnalyzer.analyzeSingleCondition(ConditionAnalyzer.java:106) at org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:99) at org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:70) at org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:83) at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:270) at org.drools.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:51) at org.drools.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:250) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Sean ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Camel get ksession results
Hi, I'm using Drools integration with Camel and have to be able to get the objects that were validated by a rule in a stateless ksession later in the Camel route. My camel-server.xml has something similar to this: policy ref=droolsPolicy bean ref=createList / to uri=drools:node1/ksession1 / bean ref=afterRules / /policy in the createList bean I create a list of java objects and call CommandFactory.newBatchExecution(commandList); My Drools rule responds as expected. So far so good. But then later when execution reaches afterRules bean, the exchange body has empty lists for both facts and results. What I want at this point is to be able to get all the objects which were compatible with the rule (a simple sysout). The ones that didn't match the rule, are simply disposed. How can I solve that? Drools v5.5.0 Final Camel 2.10.4 Thanks! Mauro -- View this message in context: http://drools.46999.n3.nabble.com/Camel-get-ksession-results-tp4023670.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] Camel get ksession results
Hi Charles, to be honest, I wasn't sure about the drools policy and added it to check the results, if that's what you mean.. Br, Mauro -- View this message in context: http://drools.46999.n3.nabble.com/Camel-get-ksession-results-tp4023670p4023672.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] How to find rules, that use special fields in their Condition
Hi, the following code traverses rules and their conditions. However, I did not find a method to find conditions, that match over a certain field of a declared class. I know, that the rule API should be hidden for good reasons (Mark Proctor). for(Rule ruleDef : kb.getKnowledgePackages().iterator().next().getRules()) { for(RuleConditionElement rce : ((RuleImpl)ruleDef).getRule().getLhs().getChildren()) { for(Map.EntryString, Declaration entry : rce.getInnerDeclarations().entrySet()) { ?? Thanks, Marc -- View this message in context: http://drools.46999.n3.nabble.com/How-to-find-rules-that-use-special-fields-in-their-Condition-tp4023673.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] Does Drools have memory address equals check operator
In another word, do we have operator doing what object == object in Java? thanks Sean ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Consequence Exception with too many events
I am new to Drools (Expert and Fusion) and have been reading through the materials over the last few days. After going through some of the tutorial code I wrote a very quick and dirty to perform a base assessment of the speed of Fusion / Expert. My code is below. The strange thing I'm currently receiving is, if I insert 100k events the test completes successfully, if I insert 150k events, I receive a ConsequenceException caused by an NPE. Being new to Drools I must be doing something wrong, can anyone please provide some guidance? (Main function) Counter cc = new Counter (); session.insert (cc); for (int i = 0; i 15; i++) { entryPoint01.insert (new MyEvent ()); } (Counter Class) public class Counter { private long total = 0; // get / set total public void addValue (int val) { total += val; } } (MyEvent Class) public class MyEvent { private int value = 1; // get / set value } (DRL file) declare MyEvent @role (event) @expires (1s) end rule Count the rules when $ev : MyEvent () from entry-point entryPoint01 $pc : Counter () then $cc.addValue ($ev.getValue ()); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Does Drools have memory address equals check operator
There's a paragraph or two about assertion modes, i.e., equality or identity in the Drools Expert manual. Note that inserting identical objects is against the meaning of fact, and that may also be true for objects that are equals(). For explicit control about the distinction between == and equals() wrap your condition code in eval(), where Drools does not interfere. -W On 03/05/2013, Sean Su sean.x...@gmail.com wrote: In another word, do we have operator doing what object == object in Java? thanks Sean ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users