Rules Field
The rules field is used when a parameter value should be determined by rules and not by a question. The rules field has the following syntax :
<rules field> ::= rules <parameter rules> .
<parameter rules> ::= <parameter rule> {,<parameter rules>}
<parameter rule> ::= <expression> [if <boolean-expression>]
For instance consider a rules field like this:
rules
<expression> if <boolean-expression>,
<expression> if <boolean-expression>,
<expression> if <boolean-expression>,
<expression> .
The parameter will in this case receive the value of the first <expression> if the first <boolean-expression> is satisfied, and so on. Notice that the optional last <expression> has no corresponding <boolean-expression>. It is a catch all <expression> which is used to determine a value for the given parameter if none of the <boolean-expression>s are fullfilled.
Note that all the rules must be wellformed and thus, when evaluated, every <expression> must give a value which conforms to the type of the parameter.
Note also that a parameter with a rules field may NOT contain a question field. When there is a rules field, any existing explanation field can never be accessed by the expert system user and it is therefore only present for the convenience of the knowledge engineer.
Examples
rules
'blue' if frequency < 1000,
'orange' if frequency >= 1000 and frequency < 2000,
'red' if frequency > 2000 and frequency < 3000,
'invisible'.
rules
(height * (length + width)) * 2 if shape = box,
height * width * width / 2 if shape = pyramid,
4 / 3 * 22 * radius * radius if shape = ball.