[rules-users] Wading through the Drools knowledge waters

Krishnan krishiyer at gmail.com
Sun Jun 3 15:20:01 EDT 2007


hi anup,

In general the rule engine can work only on what the system knows. So, the
rules are written for objects that are going to be inserted into the working
memory. So, until an object of type "Foo" is created, no rule that is based
on object "Foo" will be executed.

In your example, seems to me that PhD. grad is a derived class of grad
student. So, you will create another rule for Ph.D grad GPA > 3.5. If you
are trying to represent PhD. grad inside Grad student object without
creating an object for Ph.D grad, then you will need to further refine your
grad student rule to have the check for not Ph.D. and Ph.D. student.

when "grad is not Phd"
    Grad ( GPA > 3.0, isPhD == false )
then
    System.out.println("Grad is in good standing");
end

when "grad is Phd"
    Grad ( GPA > 3.5, isPhD == true )
then
    System.out.println("Grad is in good standing");
end


HTH,
Krishnan.

On 6/2/07, Anup Joshi <arj.joshi at gmail.com> wrote:
>
> Greetings:
>
> I am a graduate student working on rules based systems in design. I had a
> very fundamental (theoretical) question
> on rules usage and would appreciate if you could be so kind as to help.
>
> Consider a hypothetical  university application that has the following
> objects:
>
> GradStudent
> GradStudentRecord (which contains details such as GPA etc.)
>
> GIven the above(and based on the drools docs I have read so far)
> I can write a rule as:
>
> when GradStudent.Record.GPA > 3  then student.standing = good
>
> So far everything is okay.
>
> Now consider the case where the University decides to have PhD Students.
> Note that there are no PhDStudent objects in the application yet but
> I wish to have a rule such as:
>  when PhDStudentRecord.GPA > 3.5  then student.standing = good
>
> Does the above scenario mean that I would have to code the application
> and add an extra PhDStudent object before I can write a rule ?
>
> In other words, is the following proposition true?
>
> Proposition: if there are N objects in an application, and I wish to use
> JBoss rules then the rule can be written only "in terms" of the N objects.
> If there is a rule to be written for a new  (K+1)th object, I would have
> to first code
> that new object in the application and then write the rule.
>
> I would appreciate if anyone could validate my thoughts above.
>
> Sincerely,
> Anup
> GradStudent
> Michigan Tech.
>
>
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
Sivaramakrishna Iyer Krishnan (Anand)

Never assume the obvious is true.
- William Safire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070603/43b8150d/attachment.html 


More information about the rules-users mailing list