If you think this is a bug open a jira with a self contained test
showing the problem
Mark
prateek.katiyar(a)wipro.com wrote:
------------------------------------------------------------------------
Subject:
RE: rules-users Digest, Vol 11, Issue 35
From:
<prateek.katiyar(a)wipro.com>
Date:
Fri, 5 Oct 2007 09:52:26 +0530
To:
<rules-users(a)lists.jboss.org>
To:
<rules-users(a)lists.jboss.org>
Received:
from
blr-ec-bh02.wipro.com (
blr-ec-bh02.wipro.com [10.201.50.92]) by
wip-ectls-mx3.wipro.com (Postfix) with ESMTP id 9D387224015 for
<rules-users(a)lists.jboss.org>; Fri, 5 Oct 2007 09:52:26 +0530 (IST)
Received:
from
BLR-EC-MBX02.wipro.com ([10.201.50.162]) by
blr-ec-bh02.wipro.com
with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Oct 2007 09:52:26 +0530
X-MimeOLE:
Produced By Microsoft Exchange V6.5
Content-class:
urn:content-classes:message
MIME-Version:
1.0
Content-Type:
multipart/mixed; boundary="----_=_NextPart_001_01C80707.55760219"
Message-ID:
<A94AD757879CE142B7CEBC3E6FF5D3EC02C6A9E8(a)BLR-EC-MBX02.wipro.com>
X-MS-Has-Attach:
yes
X-MS-TNEF-Correlator:
<A94AD757879CE142B7CEBC3E6FF5D3EC02C6A9E8(a)BLR-EC-MBX02.wipro.com>
Thread-Topic:
rules-users Digest, Vol 11, Issue 35
Thread-Index:
AcgGnOVGQFiEYv1pQ0q0oQgo6ESFtQAaBcdz
References:
<200710041531.l94FV5H3029167(a)chief.prod.atl2.jboss.com>
X-OriginalArrivalTime:
05 Oct 2007 04:22:26.0178 (UTC) FILETIME=[5590D620:01C80707]
Hi Mark
Thank for your reply.
When i tried with the rule file(.drl format) then also i faced the same problem.
Actually the problem is that when the function returns "true", the program
works fine.
But when the function returns "false",it gives the exception :
java.lang.NullPointerException
at org.drools.common.DefaultAgenda.getNextFocus(Unknown Source)
at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at com.wipro.loan.validation.bean.Final.main(Final.java:41)
I also tried with a additional rule of "MAIN" agenda-group but still it is
giving the same problem.
My additional rule was :
rule "impossible"
agenda-group "MAIN"
when
eval(false)
then
System.out.println("The impossible rule has fired");
end
I am sending my program in the attachment.
Now please give me the proper advice.
Have a great day.
With Regards
Prateek Katiyar
________________________________
From: rules-users-bounces(a)lists.jboss.org on behalf of
rules-users-request(a)lists.jboss.org
Sent: Thu 10/4/2007 9:01 PM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 11, Issue 35
Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. Re: Migration 3 to 4 (replace "->") (Edson Tirelli)
2. Re: BRMS - how to use variables on Action part? (Shahad Ahmed)
3. Re: BRMS Guided Editor w/ variable binding (Shahad Ahmed)
4. Re: Fucntion call in rule (Mark Proctor)
----------------------------------------------------------------------
Message: 1
Date: Thu, 4 Oct 2007 12:10:10 -0300
From: "Edson Tirelli" <tirelli(a)post.com>
Subject: Re: [rules-users] Migration 3 to 4 (replace "->")
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Message-ID:
<e6dd5ba30710040810l37cee366y4b91c074b386e4f8(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Markus,
We do support "->" in Drools 4.0 for backward compatibility, but we do
advise you to not use anymore, since we will drop support to it sometime in
the future. The alternative is simply to use an in-line eval:
BlaBlub( number : id, eval( BlaClass.staticFunction( number ) ) )
Also, we now have auto-vivification of attributes, so you don't need to
bind "id" anymore, if you will only use it inside the eval:
BlaBlub( eval( BlaClass.staticFunction( id ) ) )
I don't know if it was a typo in your e-mail, but you are missing a ")"
in the end of the line of your mapping:
[when]ist BlaBlub=BlaBlub(number : id -> ( BlaClass.staticFunction(number ))
)
Hope it helps.
Edson
2007/10/4, Markus Helbig <mhelbig81(a)googlemail.com>:
> In Drools 3 i used the following code (in a DSL file):
>
> [when]ist BlaBlub=BlaBlub(number : id -> ( BlaClass.staticFunction(
> number ))
>
> where id can be resolved be method getId in class BlaBlub and
> staticFunction ist a public static function in a helper class.
>
> Drools 4 doesn't allow me this construct, how should this be
> migrated?
>
> Any help is much appreciated
>
> Cheers
>
> Markus
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20071004/9328c34...
------------------------------
Message: 2
Date: Thu, 4 Oct 2007 16:17:36 +0100
From: "Shahad Ahmed" <shahad.ahmed2(a)gmail.com>
Subject: Re: [rules-users] BRMS - how to use variables on Action part?
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Message-ID:
<1d2fdded0710040817r14f9ee41o2e045bda56a84647(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Felipe,
When you define your LHS in the BRMS, there is an option to assign a
variable to the expression. In the When part, there should be a little green
triangle beside Person. Click on this to get a dialog called "Modify
constraints for Person". At the bottom of this dialog is an option to set a
variable name to bind to Person. Type p, or whatever you want into the text
box and then click the Set button beside the text box. You should now have a
LHS constraint of the form p:Person(...). Now create a Then action by
clicking the + at the RHS of the Then part. A dialog will appear called "Add
a new action". The first two option allows you to pick the variable p you
just created - you probably want the second option of "modify a fact" as you
want to call update(p) after modifying p. You should now see something like
Set [p] in the Then part. Click on the Green triangle above Set [p] and you
will get a dialog called "Add a field" with a list of the fields in the
Person class. Choose the one you want to set (approvedMount?). What this
does is actually call the method called setApprovedMount (Press View Source
button to see). The Set action should now have a text box where you can
enter the parameter $income * 1.2.
I've had a look at the source code for this functionality and it only allows
Setter methods to be called - unfortunately you cannot call any other
methods on Person.
Regards
Shahad
On 10/3/07, Felipe Piccolini <felipe.piccolini(a)bluesoft.cl> wrote:
> Ok, so to fit on the "not ignored emails" from the list Mark posted, I
> changed the title. However I following in the list
> anyways beacuse Im resending this email in less than 3 days.
>
>
> Note: Im not desperate, nor this is for today. This just came out today
> yesterday and well... its important to me, but I
> think I can get a work around for now.
>
>
> So here is the real on-topic question.
> -----------------
> Anyone knows how to use variables (from fields) setted on LHS, to modify a
> field on the RHS using the GUI editor
> from BRMS?
>
>
> What I need is to write this rule on BRMS.
>
>
> rule "Set approvedMount for a women"
> no-loop true
> when
> $p: Person($sex: sex == "F", $income: incomeMount)
> then
> $p.setApprovedMount($income * 1.2);
> update($p);
> end
>
>
> I know I can use formulas, but I only know how to set those on LHS, I dont
> know how to put a formula on RHS (setter of the field to modify).
>
>
> Thanks.
>
>
> *Felipe Piccolini M.*
> felipe.piccolini(a)bluesoft.cl
>
>
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20071004/69389ca...
------------------------------
Message: 3
Date: Thu, 4 Oct 2007 16:29:56 +0100
From: "Shahad Ahmed" <shahad.ahmed2(a)gmail.com>
Subject: Re: [rules-users] BRMS Guided Editor w/ variable binding
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Message-ID:
<1d2fdded0710040829t5b2c4e54n3efe8d37faab12f9(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Mat,
The option of binding and setting variables is already available in 4.0.1 GA
release of the BRMS. I've just replied to a similar post. Suppose you've
already defined some "when" constraint on an object of type Person and you
want to set the attribute name in the Then part:
When you define your When in the BRMS, there is an option to assign a
variable to the expression. In the When part, there should be a little green
triangle beside Person. Click on this to get a dialog called "Modify
constraints for Person". At the bottom of this dialog is an option to set a
variable name to bind to Person. Type p, or whatever you want into the text
box and then click the Set button beside the text box. You should now have a
When constraint of the form p:Person(...). Now create a Then action by
clicking the + at the RHS of the Then part. A dialog will appear called "Add
a new action". The first two options allows you to pick the variable p you
just created - choose the second option if you want to update p into the
Working memory after modifying it. You should now see something like Set [p]
in the Then part. Click on the Green triangle above Set [p] and you will get
a dialog called "Add a field" with a list of the fields in the Person class.
Choose the one you want to set (e.g. name). What this does is actually call
the method called setName (Press View Source button to see). The Set action
should now have a text box where you can enter the name parameter
Regards
Shahad
On 10/3/07, Drouin.Mathieu <Mathieu.Drouin(a)cic.gc.ca> wrote:
> Ok, I've read the rules, seems like I was infringing on #11. I might be
> violating #3 by sending this one though :)
>
>
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/
> trunk/target/docs/shared/images/Chapter-Examples/BRMS_Guided.png
>
> Is the guided editor with variable binding (shown above) going to be
> available in v.4.0.2? If not, is it possible to achieve a similar result
> without the help of DSL?
>
> Thanks,
>
> Mat
>
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20071004/a2980a1...
------------------------------
Message: 4
Date: Thu, 04 Oct 2007 16:30:40 +0100
From: Mark Proctor <mproctor(a)codehaus.org>
Subject: Re: [rules-users] Fucntion call in rule
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID: <47050720.90803(a)codehaus.org>
Content-Type: text/plain; charset="iso-8859-1"
As always with XML. First do it in DRL, when that works us the XMLDumper
to get the working XML out. This should provide you everything you know.
Mark
prateek.katiyar(a)wipro.com wrote:
> Hi
> I wrote a function in my rule file *"boolean test(String name)" *and
> when i use this function in the <lhs></lhs>
> part of one of my rule it's giving me the following error:
>
>
> org.drools.rule.InvalidRulePackage: Rule Compilation error The method
> test(String) is undefined for the type Rule_validateFullName_0
>
> at org.drools.rule.Package.checkValidity(Unknown Source)
>
> at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
>
> at com.wipro.loan.validation.bean.Final.readRule(_Final.java:75_)
>
> at com.wipro.loan.validation.bean.Final.main(_Final.java:28_)
>
> now i want to know that how can i pass the return value of a method of
> a bean class as a argument of *"boolean test(String name)"* method.
>
> I am sending the source files in the attachment.
>
> Please help me.
>
> /*With Regards*/
> /*Prateek*//**/
>
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> addressee(s) and may contain proprietary, confidential or privileged
> information. If you are not the intended recipient, you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of
> viruses. The company accepts no liability for any damage caused by any
> virus transmitted by this email.
>
>
www.wipro.com
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20071004/1be5b91...
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
End of rules-users Digest, Vol 11, Issue 35
*******************************************
------------------------------------------------------------------------
The information contained in this electronic message and any attachments to this message
are intended for the exclusive use of the addressee(s) and may contain proprietary,
confidential or privileged information. If you are not the intended recipient, you should
not disseminate, distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this
email and any attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
www.wipro.com
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users