A Real-time Expert System Environment
for on-line Decision Support Applications

Technical Specifications

Forward Chaining Rules

The Forward Chaining Rules of RTXPS define the sequence of the ACTIONS. They set the status values of the ACTIONs depending on the status o the other ACTIONs and/or the values of the DESCRIPTORs.

Syntax:

RULE <rule#>
IF   <condition>
THEN <action>
ENDURLE

<condition> := <condition <logical operator> <condition>
            := ACTION(<action name>) == <status value>
            := DESCRIPTOR(<descriptor name>) <comparative operator> <operand>
            := TRUE
<action>    := ACTION(<action name>) =>  DESCRIPTOR(<descriptor name>) | 
                                         <status value> | repeat
            := ACTION(<action name>) =>> DESCRIPTOR(<descriptor name>) | 
                                         <status value>
            := GROUP(<group label>) => enable | disable | repeat
            := DESCRIPTOR(<descriptor name>) = DESCRIPTOR(<descriptor name>) | 
                                               <constant>
<logical operator>     := AND | OR
<comparative operator> :=  < | > | <= | >= | == | !=
<status value> := ready | pending | ignored | failed | done
<operand>   := DESCRIPTOR(<descriptor name>) | <constant>
<constant>  := string | number

Depending on the action part 6 Types of Forward Chaining Rules can be distinguished:

  • ACTION => value
    The rule assigns a value to the specified ACTION, but only if the ACTION does not yet have a value assigned.
     

  • ACTION =>> value
    The rule assigns a value to the specified ACTION, overriding the current value.
     

  • GROUP => enable | disable
    The rules enables | disables the usage of the ACTIONs assigned to the specified GROUP.
     

  • ACTION => repeat
    The rule resets the ACTION value to ready and such repeats the the specified ACTION.
     

  • GROUP => repeat
    The rule clears the values of the ACTION assigned to the specified group and sets the value of the first ACTION in ths GROUP to ready, such repeating the ACTIONs in the GROUP.
     

  • DESCRIPTOR = value
    The rule assigns a value to the specified descriptor and does not have any direct effect on scheduling the ACTIONs.

Examples for the 6 types are:

RULE 000004
IF   ACTION(Zero_Action) == done
THEN ACTION(First_Action) => ready
ENDRULE

RULE 000010
IF   ACTION(First_Action) == ignored
THEN ACTION(First_Action) =>> done
ENDRULE

RULE 000020
IF   TRUE
THEN GROUP(0002) => enable
ENDRULE

RULE 000030
IF   DESCRIPTOR(score) < 100
THEN ACTION(Test_Score) => repeat
ENDRULE

RULE 000040
IF   ACTION(Test_Score) == done 
AND  DESCRIPTOR(score) < 50
THEN GROUP(0002) => repeat
ENDRULE

RULE 000041
IF   ACTION(Test_Score) == done 
AND  DESCRIPTOR(score) < 50
THEN DECRIPTOR(test) = failed
ENDRULE

script2rules

The preprocessor script2rules can be used to automatically transform a script file into Forward Chaining Rules.

For all ACTIONs listed in the script file script2rules automatically generates the sequential scheduling rules. All other elements of the script file are not modified.

script2rules expects a script file as its only argument and writes to stdout:

Synopsis: script2rules <scriptfile>
(/usr/local/bin/script2rules) 

The following sample script file:

ACTION: <action1> 
ACTION: <action2> 
RULE <nr> 
IF <condition> 
AND <condition> 
OR  <condition> 
THEN <conclusion> 
ENDRULE 
# <comment line> 
ACTION: <action3> 

is transformed by script2rules into:

RULE     1
IF TRUE
THEN ACTION(<action1> => ready
ENDRULE

RULE     2
IF   ACTION(<action1> == done
THEN ACTION(<action2> => ready
ENDRULE

RULE <nr>
IF <condition>
AND <condition>
OR  <condition>
HEN <conclusion>
ENDRULE

# <comment line>

RULE     3
IF   ACTION(<action2> == done
THEN ACTION(<action3> => ready
ENDRULE

Copyright 1995-2003 by:   ESS   Environmental Software and Services GmbH AUSTRIA