Re: [rules-users] Accepted idiom for binding variable to restriction?
Why not use from? The manual suggest this approach to reason over data that is not explicitly asserted in knowledge base. It seems to me that it fits best in the requirement of Laird. Please correct me if this is bad practice: $response: Response() $question: Question(ID == XYZ) from $response.question Is there some advantage/disadvantage on using 'from' instead of 'eval' in this case? Regards. Giovanni 2010/6/2 Edson Tirelli tire...@post.com Syntactically speaking, I don't think the eval is necessary: $response : Response( $question : question, question.ID == XYZ ) Behind the scenes Drools will still generate an eval to resolve the nested property constraint, but the rule stays simple to read and maintain. Edson 2010/6/2 Wolfgang Laun wolfgang.l...@gmail.com The inline eval constraint is what you want: a boolean expression, within parentheses. $response : Response( $question : question, eval(question.getID().equals( XYZ ) ) ) See the Drools Expert manual, section on Left Hand Side... -W On 1 June 2010 23:54, Laird Nelson ljnel...@gmail.com wrote: I have a fact that is inserted into my rule base. It is a Response. A Response has a Question that it is a response to. At the moment, the Question itself is not separately inserted into the knowledge base. I would ideally like to keep it this way. What's the best approach for binding variables to both the Response and its associated Question? That is, if the Question were inserted, it would be relatively easy: when $question : Question( ) $response : Response( question == $question ) ...but I'm finding myself somewhat confused how to extract a Question out of a Response, particularly when, say, I want to select only Responses whose associated Question IDs are XYZ: when $response : Response( $question : question.ID == XYZ ) // boy howdy does this seem wrong Is the easiest thing to do here to add a second rule that just inserts the questions: when $response : Response then insert($response.getQuestion()) end ...? I would love to stay away from this if I could. Thanks, Laird ___ 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 -- 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 5.1.M1 with JBoss AS 5.X
Hello All, Drools 5.1.M1 is bundled with a JBoss 4.2.3 GA in download section, ok I red http://community.jboss.org/wiki/DroolsGuvnor50inJBossAS5 info but just wanted to get on the safe side: Has it been tested/validated to get Drools 5.1.M1(Guvnor) to be used and deployed over a JBoss AS 5.x as of today? Cheers, François. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Using pipelines
I tried looking for one but couldn't see one in the PipelineFactory that can be used when I've received an object from the jms queue. I'm hoping that I'm just being blind or something... From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Mark Proctor Sent: 03 June 2010 07:28 To: rules-users@lists.jboss.org Subject: Re: [rules-users] Using pipelines On 02/06/2010 11:15, Swindells, Thomas wrote: I'm not trying to fire a particular rule, I'm trying to get the pattern matching inside the knowledge session to actually run, eg the equivalent of calling ksession.fireAllRules() but having the pipeline doing it at the correct time. Did you add the FireAllRulesCommand? Mark Thomas From: rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of rudolf michael Sent: 02 June 2010 10:39 To: Rules Users List Subject: Re: [rules-users] Using pipelines you can't explicitly fire a rule...it is not like calling a method. rules are fired when there is a pattern matches inside your KnowledgeSession. 2010/6/2 Swindells, Thomas tswinde...@nds.commailto:tswinde...@nds.com I've still not managed to work this out, How do I actually get my rules to fire when using a pipeline? Thanks, Thomas From: rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas Sent: 30 May 2010 18:47 To: Rules Users List Subject: [rules-users] Using pipelines I've been trying to learn how to use pipelines to execute some rules. I've had a look at the JaxbSimpleJmsMessengerTest as that seemed a good place to start and copy the code from (using drools 5.0.1). However running the test doesn't seem to actually run any of the rules - I've tried adding println's but they don't appear, nor do the globals appear to get populated. What am I missing? Thomas ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.commailto: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 ** ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.commailto: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.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.commailto: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.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Using pipelines
On 03/06/2010 11:05, Swindells, Thomas wrote: I tried looking for one but couldn't see one in the PipelineFactory that can be used when I've received an object from the jms queue. I'm hoping that I'm just being blind or something... I'd not use that, stick with the CommandFactory and send a batch of commands, and just use the CommandExecutor stage in the pipeline for this. All of the pipeline stuff will go, with a Camel pushed as the default way to execute commands. Mark *From:* rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] *On Behalf Of *Mark Proctor *Sent:* 03 June 2010 07:28 *To:* rules-users@lists.jboss.org *Subject:* Re: [rules-users] Using pipelines On 02/06/2010 11:15, Swindells, Thomas wrote: I'm not trying to fire a particular rule, I'm trying to get the pattern matching inside the knowledge session to actually run, eg the equivalent of calling ksession.fireAllRules() but having the pipeline doing it at the correct time. Did you add the FireAllRulesCommand? Mark Thomas *From:* rules-users-boun...@lists.jboss.org mailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] *On Behalf Of *rudolf michael *Sent:* 02 June 2010 10:39 *To:* Rules Users List *Subject:* Re: [rules-users] Using pipelines you can't explicitly fire a rule...it is not like calling a method. rules are fired when there is a pattern matches inside your KnowledgeSession. 2010/6/2 Swindells, Thomas tswinde...@nds.com mailto:tswinde...@nds.com I've still not managed to work this out, How do I actually get my rules to fire when using a pipeline? Thanks, Thomas *From:* rules-users-boun...@lists.jboss.org mailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org mailto:rules-users-boun...@lists.jboss.org] *On Behalf Of *Swindells, Thomas *Sent:* 30 May 2010 18:47 *To:* Rules Users List *Subject:* [rules-users] Using pipelines I've been trying to learn how to use pipelines to execute some rules. I've had a look at the JaxbSimpleJmsMessengerTest as that seemed a good place to start and copy the code from (using drools 5.0.1). However running the test doesn't seem to actually run any of the rules -- I've tried adding println's but they don't appear, nor do the globals appear to get populated. What am I missing? Thomas ** 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 mailto: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 ** ** 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 mailto: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 mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com mailto: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
[rules-users] Firing a rule if at least its two conditions are satified
Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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
Re: [rules-users] Using pipelines
Ah, that was next in my list of technologies to look at anyway so I guess I'll just look at camel and forget about the pipeline stuff. Are there any good starting points/examples that are worth studying? Thanks, Thomas From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Mark Proctor Sent: 03 June 2010 11:47 To: rules-users@lists.jboss.org Subject: Re: [rules-users] Using pipelines On 03/06/2010 11:05, Swindells, Thomas wrote: I tried looking for one but couldn't see one in the PipelineFactory that can be used when I've received an object from the jms queue. I'm hoping that I'm just being blind or something... I'd not use that, stick with the CommandFactory and send a batch of commands, and just use the CommandExecutor stage in the pipeline for this. All of the pipeline stuff will go, with a Camel pushed as the default way to execute commands. Mark From: rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Mark Proctor Sent: 03 June 2010 07:28 To: rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org Subject: Re: [rules-users] Using pipelines On 02/06/2010 11:15, Swindells, Thomas wrote: I'm not trying to fire a particular rule, I'm trying to get the pattern matching inside the knowledge session to actually run, eg the equivalent of calling ksession.fireAllRules() but having the pipeline doing it at the correct time. Did you add the FireAllRulesCommand? Mark Thomas From: rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of rudolf michael Sent: 02 June 2010 10:39 To: Rules Users List Subject: Re: [rules-users] Using pipelines you can't explicitly fire a rule...it is not like calling a method. rules are fired when there is a pattern matches inside your KnowledgeSession. 2010/6/2 Swindells, Thomas tswinde...@nds.commailto:tswinde...@nds.com I've still not managed to work this out, How do I actually get my rules to fire when using a pipeline? Thanks, Thomas From: rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas Sent: 30 May 2010 18:47 To: Rules Users List Subject: [rules-users] Using pipelines I've been trying to learn how to use pipelines to execute some rules. I've had a look at the JaxbSimpleJmsMessengerTest as that seemed a good place to start and copy the code from (using drools 5.0.1). However running the test doesn't seem to actually run any of the rules - I've tried adding println's but they don't appear, nor do the globals appear to get populated. What am I missing? Thomas ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.commailto: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 ** ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.commailto: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.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.commailto:postmas...@nds.com and
Re: [rules-users] Firing a rule if at least its two conditions are satified
If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then cnt=cnt+1; End Rule action 1, after everything Salience -10 When eval(cnt=2) Then execute action 1 End Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de skasab2s Envoyé : jeudi 3 juin 2010 14:04 À : rules-users@lists.jboss.org Objet : [rules-users] Firing a rule if at least its two conditions are satified Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing a rule if at least its two conditions are satified
IMO you can just use activation groups and not have to deal with incrementing, something like: rule first activation-group myactgrp when Condition A Condition B then ... end rule second activation-group myactgrp when Condition A Condition C then ... end rule third activation-group myactgrp when Condition B Condition C then ... end When one of these rules fire it will cancel the activation of all other rules in the same activation group. You can also then add salience to control rule priority. On 6/3/10 8:15 AM, PAYET, Manuel wrote: If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then cnt=cnt+1; End Rule action 1, after everything Salience -10 When eval(cnt=2) Then execute action 1 End Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de skasab2s Envoyé : jeudi 3 juin 2010 14:04 À : rules-users@lists.jboss.org Objet : [rules-users] Firing a rule if at least its two conditions are satified Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ 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] Firing a rule if at least its two conditions are satified
Yes, you're right Tihomir Surdilovic your solution is way more elegant than mine. And to skasab2s: you should use a function to avoid copy and paste three time the same then clause De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de Tihomir Surdilovic Envoyé : jeudi 3 juin 2010 14:40 À : rules-users@lists.jboss.org Objet : Re: [rules-users] Firing a rule if at least its two conditions are satified IMO you can just use activation groups and not have to deal with incrementing, something like: rule first activation-group myactgrp when Condition A Condition B then ... end rule second activation-group myactgrp when Condition A Condition C then ... end rule third activation-group myactgrp when Condition B Condition C then ... end When one of these rules fire it will cancel the activation of all other rules in the same activation group. You can also then add salience to control rule priority. On 6/3/10 8:15 AM, PAYET, Manuel wrote: If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then cnt=cnt+1; End Rule action 1, after everything Salience -10 When eval(cnt=2) Then execute action 1 End Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable -Message d'origine- De : rules-users-boun...@lists.jboss.orgmailto:rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de skasab2s Envoyé : jeudi 3 juin 2010 14:04 À : rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org Objet : [rules-users] Firing a rule if at least its two conditions are satified Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users /PREp style=font-family:arial;color:grey style=font-size:13pxThis message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message./pPRE ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Error reading brl files in eclipse
Hi, I know this is repeated again but I tried the solution mentioned in the previous posts and it doesn't work. When I created a guided rule in eclipse, I get blank dropdowns when choosing the facts. I added the jar file for the classes as an external reference I also added a .package file to the directory where my rules are located. The package file contains import statements of the classes. I also added the required classes in the same directory. But nothing seems to work. If I import my .brl rule from the guvnor repository I am unable to open it. Gives me an error. I tried reading it in a text editor and shows me the correct xml format. Please help!!! Thank you. /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing a rule if at least its two conditions are satified
This will not work. Rules will not predictably react to changes in global variables. Use an object in working memory. GreG On Jun 3, 2010, at 7:15, PAYET, Manuel manuel.pa...@capgemini.com wrote: If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then cnt=cnt+1; End Rule action 1, after everything Salience -10 When eval(cnt=2) Then execute action 1 End Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de skasab2s Envoyé : jeudi 3 juin 2010 14:04 À : rules-users@lists.jboss.org Objet : [rules-users] Firing a rule if at least its two conditions are satified Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ 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] Firing a rule if at least its two conditions are satified
The solutions given are useable anyway, Thanks for this information GreG -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de Greg Barton Envoyé : jeudi 3 juin 2010 15:29 À : Rules Users List Objet : Re: [rules-users] Firing a rule if at least its two conditions are satified This will not work. Rules will not predictably react to changes in global variables. Use an object in working memory. GreG On Jun 3, 2010, at 7:15, PAYET, Manuel manuel.pa...@capgemini.com wrote: If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then cnt=cnt+1; End Rule action 1, after everything Salience -10 When eval(cnt=2) Then execute action 1 End Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de skasab2s Envoyé : jeudi 3 juin 2010 14:04 À : rules-users@lists.jboss.org Objet : [rules-users] Firing a rule if at least its two conditions are satified Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ 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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing a rule if at least its two conditions are satified
By the solutions given I didn't mean to tell mine was good, apparently it's not, I was talking about the other ones. -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de PAYET, Manuel Envoyé : jeudi 3 juin 2010 15:33 À : Rules Users List Objet : Re: [rules-users] Firing a rule if at least its two conditions are satified The solutions given are useable anyway, Thanks for this information GreG -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de Greg Barton Envoyé : jeudi 3 juin 2010 15:29 À : Rules Users List Objet : Re: [rules-users] Firing a rule if at least its two conditions are satified This will not work. Rules will not predictably react to changes in global variables. Use an object in working memory. GreG On Jun 3, 2010, at 7:15, PAYET, Manuel manuel.pa...@capgemini.com wrote: If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then cnt=cnt+1; End Rule action 1, after everything Salience -10 When eval(cnt=2) Then execute action 1 End Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de skasab2s Envoyé : jeudi 3 juin 2010 14:04 À : rules-users@lists.jboss.org Objet : [rules-users] Firing a rule if at least its two conditions are satified Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ 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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Accepted idiom for binding variable to restriction?
For simple constraints like this, using nested accessors is lighter and simpler than using from. Edson 2010/6/3 Giovanni Motta motta...@gmail.com Why not use from? The manual suggest this approach to reason over data that is not explicitly asserted in knowledge base. It seems to me that it fits best in the requirement of Laird. Please correct me if this is bad practice: $response: Response() $question: Question(ID == XYZ) from $response.question Is there some advantage/disadvantage on using 'from' instead of 'eval' in this case? Regards. Giovanni 2010/6/2 Edson Tirelli tire...@post.com Syntactically speaking, I don't think the eval is necessary: $response : Response( $question : question, question.ID == XYZ ) Behind the scenes Drools will still generate an eval to resolve the nested property constraint, but the rule stays simple to read and maintain. Edson 2010/6/2 Wolfgang Laun wolfgang.l...@gmail.com The inline eval constraint is what you want: a boolean expression, within parentheses. $response : Response( $question : question, eval(question.getID().equals( XYZ ) ) ) See the Drools Expert manual, section on Left Hand Side... -W On 1 June 2010 23:54, Laird Nelson ljnel...@gmail.com wrote: I have a fact that is inserted into my rule base. It is a Response. A Response has a Question that it is a response to. At the moment, the Question itself is not separately inserted into the knowledge base. I would ideally like to keep it this way. What's the best approach for binding variables to both the Response and its associated Question? That is, if the Question were inserted, it would be relatively easy: when $question : Question( ) $response : Response( question == $question ) ...but I'm finding myself somewhat confused how to extract a Question out of a Response, particularly when, say, I want to select only Responses whose associated Question IDs are XYZ: when $response : Response( $question : question.ID == XYZ ) // boy howdy does this seem wrong Is the easiest thing to do here to add a second rule that just inserts the questions: when $response : Response then insert($response.getQuestion()) end ...? I would love to stay away from this if I could. Thanks, Laird ___ 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 -- 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 ___ 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] Accepted idiom for binding variable to restriction?
Edson Tirelli-3 wrote: For simple constraints like this, using nested accessors is lighter and simpler than using from. Phrases like this should go in a drools best practice sections :-) Does something like that exist? When you read the docs, you get the impression that from is the only way to access objects not explicitly inserted into the working memory. Okay, it seems logical that you can also evaluate them with an explicit or implicit (read invisible) eval. But for me, it isn't really clear when to use an eval, usually promoted as less efficient, and when to use the from operator. Greetz Evert -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Accepted-idiom-for-binding-variable-to-restriction-tp863400p867757.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
Re: [rules-users] Firing a rule if at least its two conditions are satified
I had to do something like this. The way I did it is by prividing a method in my object in working memory that takes multiple Boolean conditions and loops through them and return true if at least N of the conditions were true. So, this funtions will take N and a list of all conditions. Then it returns true or false. So, your eval will look like this: eval(obj.atLeastNTrue(n, conditionA, conditionB, conditionC, etc)) Sent from my iPhone On Jun 3, 2010, at 7:03 AM, skasab2s skasa...@smail.inf.fh-brs.de wrote: Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do you know how to implement this? Any ideas or hints? Many thanks and regards! skasab2s. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.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] Ordering of collected elements
Hi, I have a rule with the condition that looks like below: when item : Item() list : ArrayList(size 0) from collect ( SubItem( type == X ) from item.getSubItemList()) When I execute this rule, it seems to me that the order of elements in the collected list is not the same as they were in the subItemList of the item. Is there a simple way to ensure the same ordering in both original list and the collected list without using accumulate or sorted list? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Ordering-of-collected-elements-tp868051p868051.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] Object Referencing error:
Hi, I am getting the following error when I try to do complex object referencing in drools: My class: A{ String Type; B objectb; //getters and setters for above } My rules: rule prod when $a :A(Type == Prod , objectB != ) then B bobject = new B(); bobject.setType( Prod ); bobject.setId($a.getNumber().getId()); update(bobject); end I want to basically output a file which has updated values of B (type, Id) Error: org.drools.spi.ConsequenceException: org.drools.FactException: Update error: handle not found for object: com.org...@f42ad0. Is it in the working memory? at org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439) at com.org.DroolsTest.main(DroolsTest.java:30) Caused by: org.drools.FactException: Update error: handle not found for object: com.org...@f42ad0. Is it in the working memory? at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:100) at com.org.Rule_Prod_Ip_0.consequence(Rule_Prod_Ip_0.java:10) at com.org.Rule_Prod_Ip_0ConsequenceInvoker.evaluate(Rule_Prod_Ip_0ConsequenceInvoker.java:22) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554) ... 4 more Please help! I am very new to drools! Not able to figure out why this error: I am using eclipse and working on Windows machine. Error above was generated on eclipse console. Thank you. M /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Use Drools-Guvnor .pkg
Hi, I’m new to drools, just started evaluating Drools-Guvnor for a project. To take advantage of Java-enums I’m using the current 5.1.0 Milestone 2. I created a decision table (web-guided) in drools-guvnor and deployed the package snapshot, which is downloadable and returns a .pkg-File. This File is in some Binary format (non plaintext). When I try to load that package in code using a KnowledgeAgent it fails on the following code line: knowledgeAgent.applyChangeSet(resource); with an Exception: “java.lang.RuntimeException: Unable to parse ChangeSet … Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.”. I debugged it, and it seems to try to parse XML content from this binary file.. Can anyone tell me the proper way to load a package from a remote Guvnor installation? Thx! Complete code: KnowledgeAgent knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(testAgent); UrlResource resource = (UrlResource) ResourceFactory.newUrlResource(url); resource.setBasicAuthentication(enabled); resource.setUsername(whatever); resource.setPassword(); knowledgeAgent.applyChangeSet(resource); KnowledgeBase knowledgeBase = knowledgeAgent.getKnowledgeBase(); Stacktrace: java.lang.RuntimeException: Unable to parse ChangeSet at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:323) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:130) at com.efgfp.hermes.drools.test.DroolsTest.testDroolsDecisionTable(DroolsTest.java:37) 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:597) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644) at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140) 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:597) at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770) at org.testng.internal.Invoker.invokeMethod(Invoker.java:539) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121) at org.testng.TestRunner.runWorkers(TestRunner.java:908) at org.testng.TestRunner.privateRun(TestRunner.java:617) at org.testng.TestRunner.run(TestRunner.java:498) at org.testng.SuiteRunner.runTest(SuiteRunner.java:329) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:324) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:296) at org.testng.SuiteRunner.run(SuiteRunner.java:201) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915) at org.testng.TestNG.runSuitesLocally(TestNG.java:879) at org.testng.TestNG.run(TestNG.java:787) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:79) 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:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110) Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1038) at
Re: [rules-users] Object Referencing error:
You can't modify bobject, becuase it doesn't exist inside the session. You just created it a few lines above. Maybe you need an insert() or maybe you need the bobject reference from the LHS. Something like this: *rule* prod *when* $a :A(Type == Prod , objectB != ) *then* B bobject = *new* B(); $a.getObjectB().setType( Prod ); $a.getObjectB().setId($a.getNumber().getId()); *update*($a); * end* Note that you need to update $a and not B, because A is the inserted Fact in your session. Best, 2010/6/3 Fnu Mahalakshmi fmahalaks...@nyx.com Hi, I am getting the following error when I try to do complex object referencing in drools: My class: A{ String Type; B objectb; //getters and setters for above } My rules: *rule* prod *when* $a :A(Type == Prod , objectB != ) *then* B bobject = *new* B(); bobject.setType( Prod ); bobject.setId($a.getNumber().getId()); *update*(bobject); *end* * * *I want to basically output a file which has updated values of B (type, Id) * * * *Error:* *org.drools.spi.ConsequenceException*: *org.drools.FactException*: Update error: handle not found for object: com.org...@f42ad0. Is it in the working memory? at org.drools.base.DefaultConsequenceExceptionHandler.handleException(* DefaultConsequenceExceptionHandler.java:13*) at org.drools.common.DefaultAgenda.fireActivation(* DefaultAgenda.java:558*) at org.drools.common.DefaultAgenda.fireNextItem(* DefaultAgenda.java:518*) at org.drools.common.AbstractWorkingMemory.fireAllRules(* AbstractWorkingMemory.java:475*) at org.drools.common.AbstractWorkingMemory.fireAllRules(* AbstractWorkingMemory.java:439*) at com.org.DroolsTest.main(*DroolsTest.java:30*) Caused by: *org.drools.FactException*: Update error: handle not found for object: com.org...@f42ad0. Is it in the working memory? at org.drools.base.DefaultKnowledgeHelper.update(* DefaultKnowledgeHelper.java:100*) at com.org.Rule_Prod_Ip_0.consequence(*Rule_Prod_Ip_0.java:10*) at com.org.Rule_Prod_Ip_0ConsequenceInvoker.evaluate(* Rule_Prod_Ip_0ConsequenceInvoker.java:22*) at org.drools.common.DefaultAgenda.fireActivation(* DefaultAgenda.java:554*) ... 4 more Please help! I am very new to drools! Not able to figure out why this error: I am using eclipse and working on Windows machine. Error above was generated on eclipse console. Thank you. M -- *Please consider the environment before printing this email.* *Visit our website at http://www.nyse.com * Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. * ___ 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
Re: [rules-users] Use Drools-Guvnor .pkg
Indeed, the change set is an xml file specifying the resources to add/modify/remove. Take a look at the change set structure here: http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e788 http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e788 Best, On Thu, Jun 3, 2010 at 5:48 PM, Josua josua.troe...@bluewin.ch wrote: Hi, I’m new to drools, just started evaluating Drools-Guvnor for a project. To take advantage of Java-enums I’m using the current 5.1.0 Milestone 2. I created a decision table (web-guided) in drools-guvnor and deployed the package snapshot, which is downloadable and returns a .pkg-File. This File is in some Binary format (non plaintext). When I try to load that package in code using a KnowledgeAgent it fails on the following code line: knowledgeAgent.applyChangeSet(resource); with an Exception: “java.lang.RuntimeException: Unable to parse ChangeSet … Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.”. I debugged it, and it seems to try to parse XML content from this binary file.. Can anyone tell me the proper way to load a package from a remote Guvnor installation? Thx! Complete code: KnowledgeAgent knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent(testAgent); UrlResource resource = (UrlResource) ResourceFactory.newUrlResource(url); resource.setBasicAuthentication(enabled); resource.setUsername(whatever); resource.setPassword(); knowledgeAgent.applyChangeSet(resource); KnowledgeBase knowledgeBase = knowledgeAgent.getKnowledgeBase(); Stacktrace: java.lang.RuntimeException: Unable to parse ChangeSet at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:323) at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:130) at com.efgfp.hermes.drools.test.DroolsTest.testDroolsDecisionTable(DroolsTest.java:37) 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:597) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644) at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140) 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:597) at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770) at org.testng.internal.Invoker.invokeMethod(Invoker.java:539) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121) at org.testng.TestRunner.runWorkers(TestRunner.java:908) at org.testng.TestRunner.privateRun(TestRunner.java:617) at org.testng.TestRunner.run(TestRunner.java:498) at org.testng.SuiteRunner.runTest(SuiteRunner.java:329) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:324) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:296) at org.testng.SuiteRunner.run(SuiteRunner.java:201) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915) at org.testng.TestNG.runSuitesLocally(TestNG.java:879) at org.testng.TestNG.run(TestNG.java:787) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:79) 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:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110) Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. at
Re: [rules-users] Object Referencing Error
was generated on eclipse console. Thank you. M -- *Please consider the environment before printing this email.* *Visit our website at http://www.nyse.com * Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Esteban Aliverti -- next part -- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100603/f0f29ddf/attachment.html -- ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users End of rules-users Digest, Vol 43, Issue 15 *** Please consider the environment before printing this email. Visit our website at http://www.nyse.com Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. ___ 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