Please Make a Donation:
Support This Project

Hosted by:
SourceForge.net Logo

Fc_rule Syntax

Fc_rule

Forward-chaining rules have three parts:

  1. A unique name.
  2. An optional foreach clause.
  3. An assert clause.
fc_rule ::= IDENTIFIER ':' NL INDENT
               [fc_foreach]
               fc_assert
            DEINDENT

The IDENTIFIER uniquely names this rule and is used as the corresponding python function name in the generated <rb_name>_fc.py file.

Foreach clause

fc_foreach ::= 'foreach' NL INDENT
                   {fc_premise NL}
               DEINDENT

fc_premise ::= fact_pattern
             | python_premise

fact_pattern ::= IDENTIFIER '.' IDENTIFIER '(' [{pattern,}] ')'

Here are links to the definitions for pattern and python_premise.

If the foreach clause is not used, the rule is always fired once.

If the foreach clause is used, the rule is fired for each combination of true premises.

Assert clause

fc_assert ::= 'assert' NL INDENT
                  {assertion NL}
              DEINDENT

assertion ::= fact_pattern
            | 'python' ':' NL INDENT
                  {python_statement NL}
              DEINDENT

The assert clause lists new facts to assert, and/or python statements to execute each time the rule is fired. Each of these may include pattern variables which should also appear in the foreach clause where they are bound to a value. These values will then be substituted into the facts and python statements.

More:

Fc_rule Syntax

The syntax of a forward-chaining rule.

Pattern Syntax

The syntax of a pattern used to match data values.

Python Premise Syntax

The syntax of a python premise.

Bc_rule Syntax

The syntax of a backward-chaining rule.

Page last modified Thu, Nov 08 2007.