Hi Mark,
First of all thanks for the response. Using global variables may be a good
workaround for in/out parameters.
Our purpose of using named parameters is to differentiate between facts
which may be of the same type but may have different role (without forcing
the rule author to add this logic in the patterns).
for example - one can write the following rule:
rule "Rule1"
when
$anemia: Diagnosis(alias == "anemia")
$hypertension: Diagnosis(alias == "hypertension")
//business logic here
Diagnosis (code == "5") from $anemia and
Diagnosis (code == "7") from $hypertension
then
#DO something
end
but this solution is much better since it extracts the alias complexity
outside of the rule:
#declare any global variables here
global java.util.List anemia;
global java.util.List hypertension;
rule "Rule1"
when
//business logic here
Diagnosis (code == "5") from anemia
and
Diagnosis (code == "7") from hypertension
then
#DO something
end
this solution will of course force us to introduce the facts twice - once as
normal facts inserted to the working memory and once as globals in order to
allow the parameterization.
will this workaround cause unwanted results (since the facts appear twice)?
Thanks
Yoni
--
View this message in context:
http://www.nabble.com/Rule-Parameters-Aliases-tp18359434p18689227.html
Sent from the drools - dev mailing list archive at
Nabble.com.