Hi all,

i'm quiet new in drools (a french speaking so i appologise for my english
mistakes) and i'm surprise by the folowing problem
in drools example i found this code ...

Example 3.14. Return Value operator

Person( girlAge : age, sex == "F" )
Person( age == ( new Integer(girlAge.intValue() + 2) ), sex == 'M' )

This let me think that i can use method of an assigned variable in the
equality test

this my rule file

package be.labocollard.server.rules ;

import java.lang.Integer;
import java.lang.Double;

import be.labocollard.server.types.HumanSexType;
import be.labocollard.server.entities.Result;
import be.labocollard.server.entities.Resultat;
import be.labocollard.server.entities.Prestation;
import be.labocollard.server.entities.PrestationFacturable;
import be.labocollard.server.entities.Utilisateur;

rule "asserteResultatAndPrestation"
        when
                PrestationFacturable ( $resultat : resultat , $prestation : 
prestation) 
        then
                assert ( $resultat );
                assert ($prestation);
        end

rule "findRelevantResult"
        when 
                $resultat : Resultat()
                eval($resultat.getResults().size()>0)
        then
                assert($resultat.getResults().iterator().next());
        end             

rule "testPsaId"
        when
                $prestation : Prestation(id == "psaId") 
                $prestationFacturable : PrestationFacturable 
(prestation==$prestation,
$resultat : resultat)
                $result : Result (doubleValue < (new Double(12)))
                
                Resultat (id == $resultat.getId(), results contains $result )
>>> this sentence makes problem ...
>>> and i would like to avoid eval 
>>>             #eval ($resultat.getId()==id && 
$resultat.getResults().contains($result) )

                Utilisateur (age < (new Integer(55))) || Utilisateur (sex !=
HumanSexType.MALE)
        then
                retract($prestationFacturable);
        end     
                
Is there a drools guru to explain my misunderstanding ????

thanks a lot 

and thanks to drools developpers for those wonderfull tools

JLL
-- 
View this message in context: 
http://www.nabble.com/explanation-on-drl-usage-tf3535518.html#a9868635
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to