For simplicity's sake, I'll assume that a student's exams are numbered
consecutively, and that the number of exams taken is available from a
Student attribute. Then, rules like this one
rule "load last exam"
Student( $id : id, $ex : exams >= 3 )
not Exam( id == $id, no == $ex )
// code to load and assert last Exam
will create the missing facts.
It seems that you are looking for a "generic" way. There isn't,
2010/7/1 jobin wilson <jobinwilson(a)gmail.com>
Thanks W for the quick response....you are absolutely correct,to reward all the students
based on some criteria,all of them should be in WM.But the average of "last 3 out of
all > 75" should become a part of the reward criteria and the challenge as you
mentioned would be how to restrict the exam facts to the ones which are relevant for
evaluating this criteria.
Is there a concept of some kind of a rule pre-processor or an engine which can identify
the context of the rule and load the limited facts based on that context?
Thanks & Regards
2010/6/30 Wolfgang Laun <wolfgang.laun(a)gmail.com>
> 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(a)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
>> 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
> rules-users mailing list
rules-users mailing list