Hello Mark

Firstly I would like to appreciate the hard work done on Drools. It is a
wonderful project and we are seriously considering it as a possible
alternative to the commercial rule engine that we are using now.

I have a few queries regarding Drools that I wish to get clarification on.

1) Is there a way in which we can invoke an initialize function to
initialize a few variables within the DRL file and use them in the rules.

An example of what I expect is

<java:functions>
int age;

public void init(){
age = obj.getAge(); // obj is given as an application data
}

 </java:functions>

<rule ....
<java:condition >age == 24 </java:condition >
.........
</rule>


the init() would be called automatically that would let us do any
initialization required.

2) We have a condition and a consequence which is fine. But business users
are of the expectation of seeing an If then Else Construct and so a negative
consequence would also be required. It is possible to achieve a negative
rule by explicitly writing them as negative, but since rules are framed in a
forward manner, it becomes a bit complex to deal with when rules are in
large numbers.

An example of the above case would be

<java:condition >age &gt; 25</java:condition >
 <java:condition >sex == 'M'</java:condition >
<java:consequence>
</java:consequence>

I wanted an error message in case it went wrong , which is not available
now.
--
Thanks and Regards
Jayaram C S

Reply via email to