Re: [rules-users] Rule is not firing

2009-10-26 Thread Macon Pegram
try simply:

rule Your First Rule
 dialect mvel
 when
  Message(message == Hello  )
 then
  System.out.println(First Rule fired);
end

On Mon, Oct 26, 2009 at 6:34 AM, satyasri.ch satyasri...@gmail.com wrote:


 Hi ,

 I am doing the sample drools project.

 Below are the sample rule and Fact class.

 when Running from eclipse ide both rules are working fine.
 Where as running the rule outside eclipse  ide only second rule fired .

 Suggest me any ideas


 --
 package test
 import test.Message;


 rule Your First Rule
 dialect mvel
 when
 m:Message(  )
 eval(m.getMessage() == Hello)
 then
 System.out.println(First Rule fired);
 end

 rule Your Second Rule
 dialect mvel
 when
 eval(true)`
 then
 System.out.println(Second Rule fired);
 end

 

 package test;
 public class Message{
 private String message;
 public String getMessage(){
 return this.message;
 }

 public void setMessage(String message) {
 this.message = message;
 }

 }


 Thanks,
 Satyasri.
 --
 View this message in context:
 http://www.nabble.com/Rule-is-not-firing-tp26056180p26056180.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Running drools 4 code using drools 5 jars

2009-09-09 Thread Macon Pegram
It is my understanding that the Rule apis are being discouraged in favor
of the Knowledge APIs.   They do still work in Drools 5 however, so you
should be ok just using that Jar file.

In my own project it was actually quite easy to make the switch since most
of the APIs are basic renamings.  I was able to flip my project in under and
hour from Rule based to Knowledge based.

2009/9/9 Nikhil D. Deshpande nikhil.deshpa...@mastek.com

  Hi,



 I have written some code using drools 4 jars.

 Now as drools 5 is launched, I want to migrate my existing ‘RuleBase’
 (drools 4) to ‘KnowledgeBase’(drools 5).



 1.   Can I/Should I use RuleBase, PackageBuilder,
 ExternalSpreadSheetCompiler using drools 5 jars??

 I  can use these classes as they are present in  *
 drools-compiler-5.0.1.jar*



 Is anybody facing the same issue?

 Please let me know if somebody has a solution for this.



 *Thanks  Regards,*

 *Nikhil *



 MASTEK LTD.
 Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
 In the US, we're called MAJESCOMASTEK


 ~~

 Opinions expressed in this e-mail are those of the individual and not that of 
 Mastek Limited, unless specifically indicated to that effect. Mastek Limited 
 does not accept any responsibility or liability for it. This e-mail and 
 attachments (if any) transmitted with it are confidential and/or privileged 
 and solely for the use of the intended person or entity to which it is 
 addressed. Any review, re-transmission, dissemination or other use of or 
 taking of any action in reliance upon this information by persons or entities 
 other than the intended recipient is prohibited. This e-mail and its 
 attachments have been scanned for the presence of computer viruses. It is the 
 responsibility of the recipient to run the virus check on e-mails and 
 attachments before opening them. If you have received this e-mail in error, 
 kindly delete this e-mail from desktop and server.

 ~~

 ___
 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] Is emptieness supported in Drools 5 (LHS)

2009-08-19 Thread Macon Pegram
Edson,

Thanks for clarifying this.  I appreciate it.

Macon

2009/8/19 Edson Tirelli tire...@post.com


Sometimes this is indeed not clear, so I will try to explain here.
 Drools uses MVEL to resolve some expressions and semantic code. Although we
 would like to make it 100% compatible and enable it to use mvel everywhere,
 that is easier said than done (but we do have someone working on that).

Anytime you want to force Drools to fallback into MVEL (or java, as the
 other supported dialect) you need to place your code inside an eval(). For
 some well known situations, Drools does this automatically, but that is not
 the case with empty.

For now, in your case, you could either do:

 MyGrabBag( someMap != null, someMap.empty == true )

Or if you are using mvel as your rule dialect:

 MyGrabBag( eval( someMap == empty ) )

[]s
Edson


 2009/8/18 Pegram, Macon zmpeg...@choosehmc.com

  According to MVEL they’ve added a convenience for checking the
 “emptiness” of a value (see: http://mvel.codehaus.org/Value+Tests )



 In MVEL you’d simply write:  myMap == empty



 This seemed like a MUCH cleaner way to write some of the LHS of the rules,
 so I thought I’d try it out.



 Given the following rule:

 *rule* Check Empties - Original

 *when *

 $grabBag : MyGrabBag(someMap != null)

 *eval* ($grabBag.getSomeMap().size() == 0)

 *then*

 *end*

 * *

 This could be rewritten:

 * *

 *rule* Check Empties - Simple

 *when *

 MyGrabBag(someMap == *empty*)

 *then*

 *end*



 The IDE (Eclipse 3.4.2 w/ Drools plugin) seems to recognize “empty”  is a
 keyword (it makes it bold), but the drools compiler in the IDE  reports:
 BuildError: Unable to create restriction '[VariableRestriction: == empty
 ]' for field 'someMap' in the rule 'Check Empties - Simple'

 BuildError: Unable to return Declaration for identifier 'empty'



 Am I assuming incorrectly that the LHS is fully MVEL compliant?



 ___
 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