ARL Master Index


Rule Block Statements

All logic rules in an Able ruleset are grouped into named "rule blocks". A ruleset can have many rule blocks and rules in one rule block can invoke rules in other rule blocks by using the invokeRuleBlock() built-in method.

Rule block statements are the last statements in a ruleset.


    RuleSet <nameOfRuleSet> (
      .
      .
      .


      Rules <nameOfRuleBlock> (                // One or more named rule blocks
        <rule>+                                // One or more rules in a rule block
      )

    ) ;End of ruleset
      

On this page...


About Rule Blocks

All rules in an Able ruleset are grouped into named "rule blocks". A ruleset can have many rule blocks and rules in one rule block can invoke rules in other rule blocks.

There are three special rule blocks, however. One of them is required, and the other two are optional. The required rule block must be unnamed (it is the only rule block that can be unnamed) or it must have the name of MAIN (completely case insensitive). The MAIN rule block is the one that is processed by the specified inferencing algorithm. (See InferenceMethod.)

The two optional rule blocks are INIT and IDLE. (Again, these names are completely case insensitive.) The INIT rule block, if present, is processed once and only once the very first time a ruleset is processed. It can be used, as the name implies, to perform initialization of the ruleset. The rules in it are processed sequentially. The IDLE rule block, if present, is processed each time a ruleset's inference engine finishes processing, in its special way, the MAIN rule block. As for the INIT rule block, rules in the IDLE rule block are processed sequentially.

The names of any other rule blocks in a ruleset are case sensitive, and the rules in them are not processed in any way unless the rule blocks are explicitly called from some rule that is processed. If called, rules in these rule blocks are processed sequentially.

Return to top


Rule Block Statement Syntax

Syntax

   Rules <nameOfRuleBlock> (
    <rule>+                                // One or more rules in a rule block
   )
      

Parameters

       <nameOfRuleBlock>
Is one of INIT, MAIN, or IDLE, case insensitive, designating one of the special rule blocks; is omitted, designating the rule block as the MAIN rule block; is an identifier that names a callable rule block.
       <rule>
Is one or more rule statements.

Examples

    RuleSet <nameOfRuleSet> (
      .
      .
      .

       Rules init (                                       // Special rule block INIT
        a1: someVar = someFunction();
        .
        .
        .
       )


       Rules (                                            // Special rule block MAIN
        m1: if   someVar >= 100
            then result   = invokeRuleBlock("fooBlock")
        .
        .
        .
       )


       Rules fooBlock (                                   // Callable rule block
        f1: someVar = someOtherFunction();
        .
        .
        .
       )

    )
      

Return to top


Able Rule Language master index.
Able RuleSet Editor master index.
Rules package table of contents.

Last modified: Thu Mar 29 10:12:29 CST 2001