%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % File: derive.data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :- multifile dyn/1. :- dynamic dyn/1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % All User-definable functions should be given in derive.db, e.g. % this one below: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% derive_module_mark(Exam, Prac, Mark) :- Mark is Exam * 0.7 + Prac * 0.3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /* dyn(ent_occ('Person', 'John', [])). dyn(ent_occ('Module', 'ES' , [])). dyn(ent_occ('Module Performance', 'John-ES' , [('Module', 'ES'), ('Person', 'John')] )). dyn(ent_occ('Practical', 'p1' , [])). dyn(ent_occ('Practical', 'p2' , [])). dyn(ent_occ('Practical Assign to Module', 'ES-p1' , [('Module', 'ES'), ('Practical', 'p1')] )). dyn(ent_occ('Practical Assign to Module', 'ES-p2' , [('Module', 'ES'), ('Practical', 'p2')] )). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dyn(ent_occ_att('Practical Assign to Module', 'ES-p1' , 'Practical Mark', 75)). dyn(ent_occ_att('Practical Assign to Module', 'ES-p1' , 'Practical Mark', 80)). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dyn(ent_occ_att('Module Performance', 'John-ES', 'Exam Mark', 80)). dyn(ent_occ_att('Module Performance', 'John-ES', 'Average Practical Mark', 80)). */ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% derive_att_rule('Module Performance', _EntID, [('Module', P1), ('Person', P2)], 'Module Mark', ModuleMark, [('Module', P1), ('Person', P2)], ['Module Performance', 'Average Practical Mark', 'Exam Mark'], [derive_module_mark(Exam, Prac, ModuleMark)], [use, the, derive_module_mark(Exam, Prac, ModuleMark), for, calculation, find, attribute, 'Exam Mark', for, entity, 'Module Performance', with, condition, entity-ancestor, ('Module', P1), and, with, condition, entity-ancestor, ('Person', P2), when,finished,save,the,result, in, Exam, find, attribute, 'Average Practical Mark', for, entity, 'Module Performance', with, condition, entity-ancestor, ('Module', P1), and, with, condition, entity-ancestor, ('Person', P2), when,finished,save,the,result, in, Prac, call, derive_module_mark(Exam, Prac, ModuleMark) ] ). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%