[rules-users] Facing Problem in BRL

Sumeet Karawal sumeet.karawal at tcs.com
Wed May 18 04:53:20 EDT 2011


I assigned a variable also but I am still getting the error:

java.lang.RuntimeException: [4] Unable to expand: $person : PersonDetails
( $age : age < "20" )[6] Unable to expand: 		$person.setDiscount
( 10 );

Also the generated drl looks fine:

rule "example"
	dialect "mvel"
	when
		$person : PersonDetails( $age : age < "20" )
	then
		$person.setDiscount( 10 );
end

(Embedded image moved to file: pic02961.jpg)
Regards,
Sumeet Karawal
Mailto: sumeet.karawal at tcs.com



                                                                                                                       
  From:       Wolfgang Laun <wolfgang.laun at gmail.com>                                                                  
                                                                                                                       
  To:         Rules Users List <rules-users at lists.jboss.org>                                                           
                                                                                                                       
  Date:       05/18/2011 01:42 PM                                                                                      
                                                                                                                       
  Subject:    Re: [rules-users] Facing Problem in BRL                                                                  
                                                                                                                       
  Sent by:    rules-users-bounces at lists.jboss.org                                                                      
                                                                                                                       





It would help to see the "BRL Source" and the "Generated DRL". Change views
at the bottom of the window.
-W

2011/5/18 Abhay B. Chaware <Abhay.Chaware at kpitcummins.com>
  Also, if I understand correctly what you are trying to do, you should
  probably add a variable name to the PersonDetails fact and use that in
  the "then" part to assign the discount. See attached.





  (Embedded image moved to file: pic00224.jpg)





  -----Original Message-----
  From: rules-users-bounces at lists.jboss.org [mailto:
  rules-users-bounces at lists.jboss.org] On Behalf Of Sumeet Karawal
  Sent: Wednesday, May 18, 2011 11:47 AM
  To: Rules Users List
  Subject: Re: [rules-users] Facing Problem in BRL





  This is the brl that I have created:








  (Embedded image moved to file: pic18001.jpg)








  Regards,


  Sumeet Karawal


  Mailto: sumeet.karawal at tcs.com










    From:       "Abhay B. Chaware" <Abhay.Chaware at kpitcummins.com
  >




    To:         Rules Users List <rules-users at lists.jboss.org
  >




    Date:       05/18/2011 11:42
  AM                                                                                     





    Subject:    Re: [rules-users] Facing Problem in
  BRL




    Sent by:    rules-users-bounces at lists.jboss.org



















  Could you post your rule content here ?








  -----Original Message-----


  From: rules-users-bounces at lists.jboss.org [


  mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Sumeet Karawal


  Sent: Wednesday, May 18, 2011 11:38 AM


  To: rules-users at lists.jboss.org


  Subject: [rules-users] Facing Problem in BRL








  Hi,





  I am using Drools-Expert. I am having a class "Person" with data members
  as


  age and discount.


  I am trying to create a .brl. I have these statements in drools.package


  package com.rules;





  import com.model.PersonDetails;








  and in the example.brl I am providing the details of when and then


  conditions





  but on execution I am getting the following error :





  java.lang.RuntimeException: [4] Unable to expand: PersonDetails( age <


  "20" )[6] Unable to expand:                      PersonDetails fact0 =
  new


  PersonDetails


  ();[7] Unable to expand:                         fact0.setDiscount


  ( 10 );[8] Unable to


  expand:                        insert(fact0 );








  It would be helpful is somebody guide me on how execute it.





  Also, I am creating the knowledgebase as:





  private static KnowledgeBase createKnowledgeBase() {


   KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder
  ();


      builder.add (ResourceFactory.newClassPathResource(


  "com/rules/example.brl"),ResourceType.BRL);


      if (builder.hasErrors()) {


        throw new RuntimeException (builder.getErrors().toString ());


      }


      KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase
  ();


      knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages ());


      return knowledgeBase;}








  Thanks & Regards,


  Sumeet Karawal


  CEG - Open Source Technology Group


  Tata Consultancy Services


  Ph:- +912267782556


  Cell:- +919833236440


  Mailto: sumeet.karawal at tcs.com


  Website: http://www.tcs.com


  ____________________________________________


  Experience certainty.         IT Services


                                       Business Solutions


                                       Outsourcing


  ____________________________________________





  =====-----=====-----=====


  Notice: The information contained in this e-mail


  message and/or attachments to it may contain


  confidential or privileged information. If you are


  not the intended recipient, any dissemination, use,


  review, distribution, printing or copying of the


  information contained in this e-mail message


  and/or attachments to it are strictly prohibited. If


  you have received this communication in error,


  please notify us by reply e-mail or telephone and


  immediately and permanently delete the message


  and any attachments. Thank you











  _______________________________________________


  rules-users mailing list


  rules-users at lists.jboss.org


  https://lists.jboss.org/mailman/listinfo/rules-users











  _______________________________________________


  rules-users mailing list


  rules-users at lists.jboss.org


  https://lists.jboss.org/mailman/listinfo/rules-users





  =====-----=====-----=====


  Notice: The information contained in this e-mail


  message and/or attachments to it may contain


  confidential or privileged information. If you are


  not the intended recipient, any dissemination, use,


  review, distribution, printing or copying of the


  information contained in this e-mail message


  and/or attachments to it are strictly prohibited. If


  you have received this communication in error,


  please notify us by reply e-mail or telephone and


  immediately and permanently delete the message


  and any attachments. Thank you







  This message contains information that may be privileged or confidential
  and is the property of the KPIT Cummins Infosystems Ltd. 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. KPIT Cummins Infosystems Ltd. does not
  accept any liability for virus infected mails.

  _______________________________________________
  rules-users mailing list
  rules-users at lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic02961.jpg
Type: image/jpeg
Size: 159253 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20110518/7047b752/attachment.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic00224.jpg
Type: image/jpeg
Size: 24682 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20110518/7047b752/attachment-0001.jpg 


More information about the rules-users mailing list