Please Make a Donation:
Support This Project

Hosted by:
Get Python Knowledge Engine (PyKE) at Fast, secure and Free Open Source software downloads

Fc_rule Syntax


Forward-chaining rules have three parts:

  1. A unique name.
  2. An optional foreach clause.
  3. An assert clause.

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

Foreach clause

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

fc_premise ::= fact_pattern
             | compound_premise
             | python_premise

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

Here are links to the definitions for pattern, compound_premise and python_premise.

If the foreach clause is omitted, the rule is always fired once.

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

Assert clause

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

assertion ::= fact_pattern
            | python_statements

Here is the link to the definitions of python_statements.

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.


Fc_rule Syntax

The syntax of a forward-chaining rule.

Bc_rule Syntax

The syntax of a backward-chaining rule.

Pattern Syntax

The syntax of a pattern used to match data values.

Compound Premise Syntax

The syntax of compound premises.

Python Premise Syntax

The syntax of a python_premise.

Page last modified Mon, Oct 27 2008.