![]() |
Coding rules in xps4xps |
![]() |
Thanks to the underlying functionality (the inference engine), coding rules is quite close to the natural language. A general principle is that the expert system can provide answers to questions of type 'Is ...', 'Has ...'. Correspondingly, the name of the rules is of form IsXXX or HasXXX, and the class name of the implemented rule is xrIsXXX or xrHasXXX, where xr stands for 'eXpert Rule'. As an example, consider the rule resulting status if the binding energy is known. In everyday language, it sounds like:
Binding energy is available if energy data are on binding energy scale or energy data are on kinetic energy scale and excitation energy is knownTo describe the rule in a more formal way, a meta-language format is used. The coding you have to do is to derive a new rule from the generic XPS rule, give it a name (a logical one as class name and a string one for using in reasoning), and to write the "Fire" method. I.e. you have to write the native language expression using the syntax of the used program language. The result is: xpRuleGeneric Fire(void) { return xrIsEnergyBE(InfoSource) OR ( xrIsEnergyKE(InfoSource) AND xrIsXEnergyKnown(InfoSource) ) ; } |