Re: [rules-users] stopping the rule sequence execution
You can retract the object and it will stop firing rules. Let me know if that doesnt work. Regards, Sachin Sent from my iPhone On Aug 9, 2011, at 12:12 AM, "prasad6779 [via Drools]" wrote: > Hi All, > > please help me, > > i am having 10 rules i want to stop the another rules when a rule is fail my > condition in any of rule 1-10. > > how can we achieve > > > advance thks > > Regards > prasad > prasad6779 > > > If you reply to this email, your message will be added to the discussion > below: > http://drools.46999.n3.nabble.com/stopping-the-rule-sequence-execution-tp3237751p3237751.html > To unsubscribe from Drools, click here. -- View this message in context: http://drools.46999.n3.nabble.com/stopping-the-rule-sequence-execution-tp3237751p3237788.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] Off to a very bad start - please help
You should try with m2Eclipse, it will be easier to handle the dependencies. Maven will take care of the dependencies and the project structure showing you all the resources and adding all of them in the class path. If you don't want to use maven , you should provide all the drools dependencies to the project and set up the right build path in order to see your resources, as in any java project. Cheers. On Mon, Aug 8, 2011 at 9:20 PM, ronalbury wrote: > I wasn't clear. The resource files copied over as well as the Java files. > However, the resources (and subdirectories) do not show up at the outer > level, as they do on the imported project. > http://drools.46999.n3.nabble.com/file/n3237310/DroolsProblem.png > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Off-to-a-very-bad-start-please-help-tp3237300p3237310.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 > -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jbug.com.ar - Salatino "Salaboy" Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Off to a very bad start - please help
I wasn't clear. The resource files copied over as well as the Java files. However, the resources (and subdirectories) do not show up at the outer level, as they do on the imported project. http://drools.46999.n3.nabble.com/file/n3237310/DroolsProblem.png -- View this message in context: http://drools.46999.n3.nabble.com/Off-to-a-very-bad-start-please-help-tp3237300p3237310.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] Off to a very bad start - please help
I downloaded droosljbpm-tools-distribution-5.2.0.Final and installed the plugins in eclipse. I downloaded droolsjbpm-integration-distribution-5.2.0.Final and imported the example project into eclipse (Helios) per instructions in the ReadMeDroolsjbpmintegration.txt file. I used the first mechanism(File/Import) rather than the second (which required m2eclipse plugin). The project is full of errors, and none of the java files would compile. There were no class files generated. I created a Drools project from scratch. I copied the src directory from the example into the new project. The java files now compile and the errors are gone, however something is wrong because it can't find any of the drl files. Also, src/main/resources is not showing in the project tree. I believe that I have followed the directions to the letter (in the first case), and took a wild stab (in the second case) and I am still at the starting point. Won't someone please help me (and shouldn't the ReadMe file be fixed so others don't have this problem) Thanks Ron -- View this message in context: http://drools.46999.n3.nabble.com/Off-to-a-very-bad-start-please-help-tp3237300p3237300.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] Lock-on-active and ruleflow-group
I have three rules: rule "First rule" salience 20 ruleflow-group "rfs_1" lock-on-active true when $c: Car(color == "red") then $c.setPrice(1); update($c); end rule "Second rule" salience 25 ruleflow-group "rfs_1" lock-on-active true when $c: Car(size == "small") then $c.setPrice(2); update($c); end rule "Second step" salience 40 ruleflow-group "rfs_2" lock-on-active true when $c: Car() then System.out.println($c); end I have class, for example Car, which has three prioperties: color, size, price. I insert into session fact-Car("red", "small"), next start process, and execute rules. After that, price value is 1. I thought that "Second rule" should be fired only because it has bigger salience but it is exactly the opposite. Could anyone explain me why first rule was executed/fired and what can I do to fire only "Second rule" (without invoking "First rule"). Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Lock-on-active-and-ruleflow-group-tp3237089p3237089.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] Guvnor - Unable to load a required class !! Help
Is "com.employee.Fire" listed in the "Configuration: Imported types" box on the main screen for your package in Guvnor? -John -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Guvnor-Unable-to-load-a-required-class-Help-tp3230887p3236720.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] startsWith function
In 5.2 this is supposed to work just fine: CDRRecords( calledNumber.startsWith("011") ) Edson 2011/8/8 Mattias Nilsson Grip > > aftab wrote: > > > > I want to define rules for below function, > > > > private boolean isFixedNumber(Call call){ > > > > if(call.getCalledNumber().startsWith("01") || > > call.getCalledNumber().startsWith("02") || > > call.getCalledNumber().startsWith("03") ){ > > return true; > > } > > else{ > > return false; > > } > > } > > > > Give some hints how can i define it ? > > I was trying to define it in below format, > > rule "Is Fixed Number" > > dialect "java" > > when c : CDRRecords > > (calledNumber.startsWith( "011") ) > > then > > c.setFixedNetNumber(true); > > System.out.println("c.setFixedNetNumber (true) "); // > consequence > > > > end > > > > > > Thanks in advance for your support ... > > > If you're using Drools 5.2 you should be able to do: > > c : CDRRecords( calledNumber str[startsWith] "011" ) > > If you are on earlier version of Drools you can match with a regular > expression: > > c : CDRRecords( calledNumber matches "011.*" ) > > /Mattias > > -- > View this message in context: > http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.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 > -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools5.2.2 integration with scala2.9.0.1
Thank Mario, Thank a lot for the reply. The solution was really helpful and I am able to run my code. I would also like to know is there any guideline or document to debug these kind of errors, since it doesn't show any problem at compile time or runtime. Thanks, Puneet -- View this message in context: http://drools.46999.n3.nabble.com/Drools5-2-2-integration-with-scala2-9-0-1-tp3229566p3236613.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 Execution Server memory leak?
Hi, We are having the same problem with a similar setup (drools 5.2.0 Final) using stateless sessions and camel integration, using a KB with ~3000 rules. Session memory is never reclaimed, and after some hours we got an out of memory error. We still dont know the cause, but the profiler shows that these objects are increasing rapidly: org.drools.reteoo.BetaMemory 176.478 +176.163 (+55925 %) 6.893 kB org.drools.core.util.LeftTupleList 175.467 +175.156 (+56320 %) 6.854 kB org.drools.core.util.RightTupleList 172.806 +172.536 (+63902 %) 6.750 kB org.drools.rule.ContextEntry[ ] 164.784 +164.724 (+274540 %)2.659 kB org.drools.core.util.Entry[ ] 160.520 +160.449 (+225985 %)16.561 kB org.drools.core.util.ObjectHashMap 158.309 +158.253 (+282595 %) 6.183 kB org.drools.reteoo.AccumulateNode$AccumulateMemory154.505+154.503 (+7725150 %)4.828 kB org.mvel2.integration.impl.IndexVariableResolver 76.262+76.234 (+272264 %) 1.787 kB We used drools 5.1.1 before with no problems, so we think this leak is upgrade related. Regards, TL -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Drools-Execution-Server-memory-leak-tp3118864p3235954.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] Inserting multiple objects of the same class as facts
Hello Wolfgang, Thank you so much for your clue. I was caught up with the drools semantics and forgot to check what I was doing in my test case. The keys zimbraDomainName, and zimbraDomainType are present or absent depending on the kind of response map I am dealing with and in the test that I was doing, these two keys are not present. Regards, Murty. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Inserting-multiple-objects-of-the-same-class-as-facts-tp3229524p3235600.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] RuleAgent - loading rules help ?
Here is some more details: * Currently our system loads rules from Guvnor installed on a server (version 5.0.0) The problem is that there is no way to debug remotely the rules which are already deployed on Guvnor. So I was wondering "what if I load the rule I need to debug from my local machine instead maybe then I'll be able to debug it..." * On my local machine I have drools 5.1.0 Here is part of the original code: public synchronized void loadRulebasesDefinition() { ruleBaseList = RulesMapper.getRulesMapper().retrieveAllRuleBases(); for (Entry entry : ruleBaseList.entrySet()) { Rule currentRuleDefinition = entry.getValue(); Properties ruleBaseProperties = createRuleBaseProperties(currentRuleDefinition); RuleAgent agent = RuleAgent.newRuleAgent(ruleBaseProperties); currentRuleDefinition.setRuleBase(agent.getRuleBase()); } } private Properties createRuleBaseProperties(Rule ruleDefinition) { Properties properties = new Properties(); properties.setProperty("url", ruleDefinition.getRuleBaseURL()); properties.setProperty("poll", Integer.toString(ruleDefinition.getRuleBasePoll())); return properties; } The info about the rules is retrieved by the Mapper class from a DB and the result is a map: Map ruleBaseList So I modified the loadRulebasesDefinition() method and I changed the url info in the DB for some of the rules to start with "local:" and to point to a location on my machine: -- public synchronized void loadRulebasesDefinition() { ruleBaseList = RulesMapper.getRulesMapper().retrieveAllRuleBases(); for (Entry entry : ruleBaseList.entrySet()) { Rule currentRuleDefinition = entry.getValue(); Properties ruleBaseProperties = createRuleBaseProperties(currentRuleDefinition); if (ruleBaseProperties.getProperty("url").startsWith("local:")) { try { String path = ruleBaseProperties.getProperty("url").replaceAll("local:", ""); File file = new File(path); Reader source = new InputStreamReader(new FileInputStream(file)); PackageBuilder builder = new PackageBuilder(); builder.addPackageFromDrl( source ); org.drools.rule.Package pkg = builder.getPackage(); RuleBase ruleBase = RuleBaseFactory.newRuleBase(); ruleBase.addPackage( pkg ); currentRuleDefinition.setRuleBase(ruleBase); } catch (DroolsParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { RuleAgent agent = RuleAgent.newRuleAgent(ruleBaseProperties); currentRuleDefinition.setRuleBase(agent.getRuleBase()); } } } When I start the project it looks like working, But when I try to "debug as Drools application" it goes to some point - loads some rules from URLs etc - and boom: Exception in thread "main" org.drools.RuntimeDroolsException: [Error: not a statement, or badly formed structure] [Near : {... Unknown }] Any idea ? Thanks & Best regards Ivan From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Esteban Aliverti Sent: Monday, August 08, 2011 1:32 PM To: Rules Users List Subject: Re: [rules-users] RuleAgent - loading rules help ? Which version of drools are you using? If you are using a change-set to feed you kagent, then you can use other protocols rather than http to get your rules from: file://, classpath:// Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com 2011/8/8 Ivan Peshev ( M-Tel ) mailto:ivan.pes...@mobiltel.bg>> Hello, Is there a way to tell RuleAgent to load rules not only from remote URL ? i.e. some rules from URL and some rules from LOCAL path on my computer. (e.g.: c:\some\folder\rule.drl) Or if it's not possible exactly that way is there another way to have some rules loaded from URLs and some rules loaded from local path ? Best Regards Ivan ___
Re: [rules-users] RuleAgent - loading rules help ?
Which version of drools are you using? If you are using a change-set to feed you kagent, then you can use other protocols rather than http to get your rules from: file://, classpath:// Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com 2011/8/8 Ivan Peshev ( M-Tel ) > Hello, > > ** ** > > Is there a way to tell RuleAgent to load rules not only from remote URL ?* > *** > > i.e. some rules from URL and some rules from LOCAL path on my computer.*** > * > > (e.g.: c:\some\folder\rule.drl) > > ** ** > > Or if it’s not possible exactly that way is there another way to have some > rules loaded from URLs and some rules loaded from local path ? > > ** ** > > ** ** > > ** ** > > Best Regards > > Ivan > > ** ** > > ___ > 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] RuleAgent - loading rules help ?
Have you tried just using a file url? From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Ivan Peshev ( M-Tel ) Sent: 08 August 2011 11:04 To: rules-users@lists.jboss.org Subject: [rules-users] RuleAgent - loading rules help ? Hello, Is there a way to tell RuleAgent to load rules not only from remote URL ? i.e. some rules from URL and some rules from LOCAL path on my computer. (e.g.: c:\some\folder\rule.drl) Or if it's not possible exactly that way is there another way to have some rules loaded from URLs and some rules loaded from local path ? Best Regards Ivan ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: > > Is there any disadvantage switching in stateful session? > If you switch to stateful sessions you have to ensure that you call the dispose-method on your session when you are done with it. Otherwise you could get a memory leak. Other than that I can't think of any disadvantage. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235136.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] RuleAgent - loading rules help ?
Hello, Is there a way to tell RuleAgent to load rules not only from remote URL ? i.e. some rules from URL and some rules from LOCAL path on my computer. (e.g.: c:\some\folder\rule.drl) Or if it's not possible exactly that way is there another way to have some rules loaded from URLs and some rules loaded from local path ? Best Regards Ivan ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
Is there any disadvantage switching in stateful session? Mattias Nilsson Grip wrote: > > If you switch to stateful session instead of stateless you could use > agenda > groups to achieve something similar. See Drools Expert user guide for > details on how to use agenda groups. > > /Mattias > -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235084.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] Fire Rule in Stateless Knowledge Session
Can you give some reference link ot code snippet? that would be helpful :) Esteban wrote: > > You can have a map of kbases containing the specific rules. When a request > arrives, you get the proper kbase from the map and create a ksession from > it. > > Another way could be to use Control Objects in your rules. > > Best Regards, > > > > Esteban Aliverti > - Developer @ http://www.plugtree.com > - Blog @ http://ilesteban.wordpress.com > -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235070.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] Fire Rule in Stateless Knowledge Session
Thanks Mattias... Now Wolfgang's solution will work Mattias Nilsson Grip wrote: > > The Rete algorithm will make sure that this does not become slow when > number of rules increases. Multiple rules with the same condition will > only result in one node in the Rete tree. I.e. each unique condition will > only be checked once. > > /Mattias > -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235065.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 4.0.7 compatible with Jboss 3.2.7
Thanks for the update. Would like to know if Drools version 4.0.7 is compatible with J-boss version 3.2.7. /BR Dibya > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Drools5-2-2-integration-with-scala2-9-0-1-tp3229566p3231390.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > > > -- > > Message: 2 > Date: Sun, 7 Aug 2011 14:33:25 +0200 > From: Dibya Ranjan > Subject: [rules-users] Regd Drools compatibility with Jboss version > To: rules-users@lists.jboss.org > Message-ID: > > > Content-Type: text/plain; charset="iso-8859-1" > > Hi > > We have a requirement to implement Drools in an application ,which is > hosting the application server in Jboss with version as 3.2.7. > > It further uses java 1.4 version with the application being build and > deployed with Ant 1.6.2. > > Could anyone help me in providing the Drools version that is compatible > with > above . > > -- > With Warm Regards > > Dibya Ranjan > - > *** > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: > > I thought of doing same but this will become slow when number of rules are > more (100 or 200 rules). The given condition will be checked in each rule. > The Rete algorithm will make sure that this does not become slow when number of rules increases. Multiple rules with the same condition will only result in one node in the Rete tree. I.e. each unique condition will only be checked once. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234977.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] Fire Rule in Stateless Knowledge Session
Because of node sharing, it shouldn't be that bad if you use the Request() constraint as the first conditional element of your rules. You must also use always the same order when checking for more than 1 request. For example: rule "Rule1" when Request ( type == "Rq1" || type == "Rq2") ... then end rule "Rule2" when Request ( type == "Rq1" || type == "Rq2") <--- Constraints are in the same order ... then end Wolfgang, please correct me if I'm wrong :) Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Mon, Aug 8, 2011 at 10:41 AM, snehils wrote: > I thought of doing same but this will become slow when number of rules are > more (100 or 200 rules). The given condition will be checked in each rule. > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234939.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] Fire Rule in Stateless Knowledge Session
snehils wrote: > > Hi, > > I am new in Drools. I am using Drools version 5.1.0 > > My requirement is kind of request response, where I have to perform some > checks for the request and respond the result. Hence, I decided to go with > stateless knowledge session. > > I have prepared .DRL file and it contains set of rules. When some request > receives I have to identify the rule(s) belongs to that request and then > fire the rule(s). > > I am not able to figure out how to categories the rules request wise in > DRL file? Also, how to fire only those rules which belongs to the > category. > > For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are > rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 > belongs to Rq2 and R4, R5 belongs to Rq3. > > When some request receives only its belonging rules should be fired. For > example, on receiving of Rq2 only R3 should be fired. > > Please provide me some code snipped or link. > > Thanks > One way could be to have conditions in your rules that check what kind of request it is. Without knowing your problem in detail it's hard to know if this is feasible. E.g. you could insert a request object as a fact into the session and let rules in R3 have condition: when Request(type = "Rq2") ... If you switch to stateful session instead of stateless you could use agenda groups to achieve something similar. See Drools Expert user guide for details on how to use agenda groups. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234944.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] Fire Rule in Stateless Knowledge Session
I thought of doing same but this will become slow when number of rules are more (100 or 200 rules). The given condition will be checked in each rule. -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234939.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] Fire Rule in Stateless Knowledge Session
You can have a map of kbases containing the specific rules. When a request arrives, you get the proper kbase from the map and create a ksession from it. Another way could be to use Control Objects in your rules. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Mon, Aug 8, 2011 at 10:23 AM, snehils wrote: > Hi, > > I am new in Drools. I am using Drools version 5.1.0 > > My requirement is kind of request response, where I have to perform some > checks for the request and respond the result. Hence, I decided to go with > stateless knowledge session. > > I have prepared .DRL file and it contains set of rules. When some request > receives I have to identify the rule(s) belongs to that request and then > fire the rule(s). > > I am not able to figure out how to categories the rules request wise in DRL > file? Also, how to fire only those rules which belongs to the category. > > For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are > rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs > to Rq2 and R4, R5 belongs to Rq3. > > When some request receives only its belonging rules should be fired. For > example, on receiving of Rq2 only R3 should be fired. > > Please provide me some code snipped or link. > > Thanks > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234893.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] Fire Rule in Stateless Knowledge Session
Basically you could do rule RL1 when Request( type == "Rq1",... ) which limits the rule to Requests of this type. -W On 8 August 2011 10:23, snehils wrote: > Hi, > > I am new in Drools. I am using Drools version 5.1.0 > > My requirement is kind of request response, where I have to perform some > checks for the request and respond the result. Hence, I decided to go with > stateless knowledge session. > > I have prepared .DRL file and it contains set of rules. When some request > receives I have to identify the rule(s) belongs to that request and then > fire the rule(s). > > I am not able to figure out how to categories the rules request wise in DRL > file? Also, how to fire only those rules which belongs to the category. > > For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are > rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs > to Rq2 and R4, R5 belongs to Rq3. > > When some request receives only its belonging rules should be fired. For > example, on receiving of Rq2 only R3 should be fired. > > Please provide me some code snipped or link. > > Thanks > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234893.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Fire Rule in Stateless Knowledge Session
Hi, I am new in Drools. I am using Drools version 5.1.0 My requirement is kind of request response, where I have to perform some checks for the request and respond the result. Hence, I decided to go with stateless knowledge session. I have prepared .DRL file and it contains set of rules. When some request receives I have to identify the rule(s) belongs to that request and then fire the rule(s). I am not able to figure out how to categories the rules request wise in DRL file? Also, how to fire only those rules which belongs to the category. For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs to Rq2 and R4, R5 belongs to Rq3. When some request receives only its belonging rules should be fired. For example, on receiving of Rq2 only R3 should be fired. Please provide me some code snipped or link. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234893.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] org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
bhavindalal wrote: > > Hello, > I am new to Drools. On starting to execute a simple program, eclipse gives > the following stacktrace as error. I even included the org.eclipse.jdt > that comes with eclipse, but it is still giving me error. Anybody please > suggest the problem. I am using Drools 5.0 and its dependencies and > Eclipse Helios > > java.lang.NoSuchMethodError: > org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem; > at > org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:321) > at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335) > at > org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351) > at > org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51) > at > org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389) > at > org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56) > at > org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74) > at > org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690) > at > org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653) > at > org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290) > at > org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488) > at > org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25) > at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40) > at com.sample.DroolsTest.main(DroolsTest.java:23) > > Thanks > Looks like the problem could be caused by the existence of multiple versions of JDT compiler on the classpath. Similar problems are described here: http://community.jboss.org/wiki/RulesTomcat You could try switching to janino compiler instead of JDT by setting system property "drools.compiler" to "JANINO". For example: -Ddrools.compiler=JANINO in your program launch settings. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/org-eclipse-jdt-internal-compiler-CompilationResult-getProblems-tp3211240p3234883.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] a newbi question
On 8 August 2011 10:02, wutongjoe wrote: > hello all, > > I am a newbi on Drools and started my test work with a modified exapmle > included in drools v4.0.7.The compiled drl from a very simple modified xls > file is like the follwing : > > > --code--- > package org.drools.examples.decisiontable; > #generated from Decision Table > import org.apache.commons.lang.time.DateUtils; > import java.util.Date; > #From row number: 11 > rule "Pricing bracket_11" > >when >DateUtils.SEMI_MONTH==1001 > This looks very wrong. The result of compiling a correct decision table should look like SomeFactName( someFieldName == 1001) >then >policy.setBasePrice(999); > Where does the variable "policy" come from? It isn't bound to anything. > end > -code- > > but I got an exception stack when trying to addPackage after compile : > > --stack > Exception in thread "Main Thread" org.drools.rule.InvalidRulePackage: > [9,22]: unknown:9:22 mismatched token: [@46,221:222='==',<76>,9:22]; > expecting type LEFT_PAREN >at org.drools.rule.Package.checkValidity(Package.java:424) >at > org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394) >at > > org.drools.examples.PricingRuleDTExample.buildRuleBase(PricingRuleDTExample.java:67) >at > > org.drools.examples.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:38) >at > org.drools.examples.PricingRuleDTExample.main(PricingRuleDTExample.java:26) > --stack > > yes,I was trying to test the usage of > org.apache.commons.lang.time.DateUtils > inside a xls file,but it seemed something went wrong. Spreadsheets over xls are not a convenient vehicle for testing conditional expressions or rule patterns in general. Write some DRL rules for this purpose. > Can someone tell me > what caused the exception? Syntax errors. Make sure to read the documentation on spreadsheets; how to define a Fact type for a conditional element (a "pattern") and how to add constraints to it. -W > thanks a lot > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] a newbi question
hello all, I am a newbi on Drools and started my test work with a modified exapmle included in drools v4.0.7.The compiled drl from a very simple modified xls file is like the follwing : --code--- package org.drools.examples.decisiontable; #generated from Decision Table import org.apache.commons.lang.time.DateUtils; import java.util.Date; #From row number: 11 rule "Pricing bracket_11" when DateUtils.SEMI_MONTH==1001 then policy.setBasePrice(999); end -code- but I got an exception stack when trying to addPackage after compile : --stack Exception in thread "Main Thread" org.drools.rule.InvalidRulePackage: [9,22]: unknown:9:22 mismatched token: [@46,221:222='==',<76>,9:22]; expecting type LEFT_PAREN at org.drools.rule.Package.checkValidity(Package.java:424) at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394) at org.drools.examples.PricingRuleDTExample.buildRuleBase(PricingRuleDTExample.java:67) at org.drools.examples.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:38) at org.drools.examples.PricingRuleDTExample.main(PricingRuleDTExample.java:26) --stack yes,I was trying to test the usage of org.apache.commons.lang.time.DateUtils inside a xls file,but it seemed something went wrong.Can someone tell me what caused the exception? thanks a lot -- View this message in context: http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.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] Help needed
prasad.pbc wrote: > > Hi Guys, > Iam using Eclipse tool for writing drl , i have written drl . > Then i have written an ant script to convert this drl to PKG . > i have used drools5.1.1.jars. i was sucessfully convert drl to pkg. > > knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); > kbuilder.add( ResourceFactory.newFileResource( > "c:/Sample.pkg" ), > ResourceType.PKG ); > iam getting below error: > > java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be > cast to org.drools.rule.Package > at > org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487) > at > org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) > at com.test.rules.MyRulesEngine.(MyRulesEngine.java:51) > at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39) > at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38) > > > Can anybody help resolving my problem.. > > Thanks > prasad > Based on the stack trace I would guess that the file Sample.pkg contains a serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you could try to do your export like this: KnowledgeBase kbase = ...; KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next(); FileOutputStream fos = new FileOutputStream(new File("c:/Sample.pkg")); DroolsStreamUtils.streamOut(fos, kpackage); /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.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] startsWith function
aftab wrote: > > I want to define rules for below function, > > private boolean isFixedNumber(Call call){ > > if(call.getCalledNumber().startsWith("01") || > call.getCalledNumber().startsWith("02") || > call.getCalledNumber().startsWith("03") ){ > return true; > } > else{ > return false; > } > } > > Give some hints how can i define it ? > I was trying to define it in below format, > rule "Is Fixed Number" > dialect "java" > when c : CDRRecords > (calledNumber.startsWith( "011") ) > then > c.setFixedNetNumber(true); > System.out.println("c.setFixedNetNumber (true) "); // > consequence > > end > > > Thanks in advance for your support ... > If you're using Drools 5.2 you should be able to do: c : CDRRecords( calledNumber str[startsWith] "011" ) If you are on earlier version of Drools you can match with a regular expression: c : CDRRecords( calledNumber matches "011.*" ) /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.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