All logic rules in an ABLE ruleset are grouped into named "rule block" methods. A ruleset can have many rule block methods and rules in one rule block can invoke rules in other rule blocks by using the invokeRuleBlock() built-in method.
Rule block methods are the last statements in a ruleset.
ruleset <nameOfRuleSet> { . . . void <nameOfRuleBlock> using <inferenceEngine>(control parameters) { <rule>+ // One or more rules in a rule block method } } |
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.
Syntax
void <nameOfRuleBlock>() ( <rule>+ // One or more rules in a rule block )
Parameters
init()
, main(), or idle(), case sensitive, designating one of the special rule blocks;Examples
ruleset <nameOfRuleSet> { . . . Rules init() { // Special rule block INIT a1: someVar = someFunction(); . . . } void main() using Script() { // Special rule block MAIN m1: if (someVar >= 100) then result = invokeRuleBlock("fooBlock"); . . . } void fooBlock() { // Callable rule block f1: someVar = someOtherFunction(); . . . } } |