[rules-users] Fwd: [rules-dev] eval problem

Michael Anstis michael.anstis at gmail.com
Tue Mar 1 04:41:37 EST 2011


Forwarded from drools-dev.

Based upon the single rule you show it is difficult to determine whether the
issue you report is caused elsewhere.

Some general comments however:-

   - It is essential to include an "update($patient);" in your RHS if the
   rule engine is to see the change in Patient properties in other rules.


   - How many instances of Patient to you have in WM? Rules will activate
   for each instance that match patterns.


---------- Forwarded message ----------
From: Nico ROEDERER <ino.nicolas at gmail.com>
Date: 1 March 2011 09:15
Subject: Re: [rules-dev] eval problem
To: Rules Dev List <rules-dev at lists.jboss.org>


 (1) -> yes because when I print the value, the value is correct ( = 2 ).
Not the eval.
(2) -> yes, true. My list is in alphabtic mode...
(3) -> Every test I make made the wrong result

eval( $patient.getNbFactRisque() == 0)
or $patient : PatientDto( nbFactRisque == 0 ) ...
---> Why does those test are true dispite nbFactRisque = 2 ????

*It works fine when I run x time drools (one call for one rule) but it
doesn't work when I run one time with a List of rules.*

Can you tell me the right mailing list for those problems ?


Le 01/03/2011 10:03, Wolfgang Laun a écrit :

Please do not use this list for simple questions - it is reserved for
discussion Drools development itself.

(1) Did you inform the Drools engine about incrementing nbFactRisque?
(2) There is no such thing as "alphabetic mode" for rule execution.
(3) Why do you use eval when you can test the fact field?

Indication: Drools Expert manual, three times per day ;-)
-W


On 1 March 2011 09:17, Nico ROEDERER <ino.nicolas at gmail.com> wrote:

>  Hi,
>
> I've got an other problem with an eval function.
> I will try to discribe the path to the error.
>
> I've got a repository where some people can put rules with .drl extension.
> My program is listing this repository and execute every rule in this
> repository.
>
> At the begining, I've got a 'PatientDto' who have a property :
> int nbFactRisque;
> (with getters and setters)
>
> Some rules increments this number.
>
> In the last rule (the rules are executed in alphabetic mode) I'm testing
> this number like this :
>
> rule "RisqueNormal"
>     when
>         $patient : PatientDto()
>         eval( $patient.getNbFactRisque() == 0)
>     then
>         $patient.addDonnees( Constants.CLE_RISQUEPATIENT,
> Constants.RISQUE_NORMAL );
>         System.out.println("RisqueNormal vérifié." +
> $patient.getNbFactRisque() + "Facteurs.");
> end
>
> Here's my problem :
> The 'Then' traitement is always executed so the eval always think that $patient.getNbFactRisque()
> is equal to 0.
> But the system.out.println() show me that $patient.getNbFactRisque()  = 2
> !
>
> Here's the output : "RisqueNormal vérifié.2Facteurs.".
>
> Perhaps I did something wrong ? Can someone help me ?
> Thank you.
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>

_______________________________________________
rules-dev mailing
listrules-dev at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-dev


_______________________________________________
rules-dev mailing list
rules-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110301/1c70fe38/attachment.html 


More information about the rules-users mailing list