Rule Declaration Language

The rule declaration language supports two types of rules: Decision rule or a Score rule.

Score rule:

  • A Score rule is composed of one or many rule sets.

  • Each rule-set computes a sub-score and is applied a weight.

  • The total score then would be the sum of all the individual scores of all the rule sets belonging to a rule.

  • A rule set is composed of one or many rule rows.

  • You can ‘roughly’ think of each Rule Row as a Conditional evaluation of the facts (a.k.a antecedent) & a score based on these conditions (a.k.a consequent).

Decision rule:

  • A Decision rule is always composed of only one rule set.

  • A rule set is composed of one or many rule rows.

  • You can ‘roughly’ think of each Rule Row as a Conditional evaluation of the facts (a.k.a antecedent) & a decision based on these conditions (a.k.a consequent).

  • A decision rule always arrives at a single decision at the end of parsing.

  • The decision can be anything (a numeric, a string such as YES/NO or even a JSON)

  • Once a Rule Row evaluates to True, the corresponding decision is returned immediately.

Antecedent and Consequent

  • An antecedent at the core is an evaluator. It evaluates one or many facts through an operator.

  • For evaluating numeric facts, a numeric operator is used. It can be one of (<=, <, >, >=, ==, <>, between, is_none)

  • For evaluating string facts, a string operator is used. It can be one of (in_list, contains, is_none, equals)

  • You can mix evaluation of more than one fact & combine the result with an “and” or “or” condition.

  • You can perform complex evaluations involving multiple facts combining AND and OR conditions recursively in the antecedent. See Examples.

  • A rule can be part of another rule. See Examples.

Last updated