If you want to reward all students you'll have to have all students in WM, at one time or other. Assuming that you aren't dealing with all the students in China, it doesn't matter much how you do this.

Now as for a student's exams, there might be an advantage if you could restrict the set of facts to those that are actually required to compute the average of "last 3 out of all". But to fetch just these, you'd have to know some key (e.g., student+course) - but I don't see how you can construct that without having the exam object with all its attributes, especially the date.


2010/6/30 jobin wilson <jobinwilson@gmail.com>
Hello List,

I have a very basic question about inserting facts into the working memory dynamically.For firing the rules,we should be having all our facts in the working memory.In that case,How will we deal with the situation where the facts that we need for evaluation of a particular rule is dependent on the rule itself (needs to be brought it dynamically)?

Say for example say i want to use rule engine to reward all students with average scores for all subjects > 75 for the past 3 exams.

The facts that i have are the Student objects & their Subject wise scores(one to many relation;one student to many exams & each exams having many subjects).
I want the "when" condition to be satisfied for all students whose average scores for all subjects for the past 3 exams to be greater than 75
and the consequence to be to just print out the name of the student.

In this case,should i be loading all the student objects & each of their past exam scores in the whole system to find student objects satisfying this critera?
Since i already know that the rule just need the average scores for just the past 3 exams for each student,wouldn't loading the whole facts be inefficient?
Is there a way in which i can specify somehow how much of the facts needs to be loaded before firing the rule based on the rule itself?
i mean a rule which is aware of the quantity of the facts on which it needs to work on(considering loading 3 facts versus 100 facts)?

Thanks a lot in advance for all your inputs and suggestions on this.

Thanks & Regards
Jobin Wilson

rules-users mailing list