This is an archive of an inactive wiki and cannot be modified.

As explained in section General Production Rules, a production rule is instantiated by binding the variables that are free in the condition and action parts of a rule to values that are specified by matching patterns against a set of facts.

This section specifies the sublanguage of patterns that determines what can appear as a pattern in a rule supported by RIF-PRD. The sublanguage of pattern in RIF-PRD extends the RIF-PRD condition language specified in section Conditions.

Syntax of the RIF-PRD Condition Language

The RIF-PRD pattern language supports positive patterns as well as negative patterns.

The overall structure of the syntax used in the RIF-PRD condition pattern is depicted on the following diagram, which extends the RIF-PRD condition language diagram.

Presentation Syntax

We now give an EBNF for the RIF-PRD presentation syntax.

  PATTERN         ::= ATOMIC | NotPattern
  NotPattern      ::= ' NOT ( ' ATOMIC ' ) '

A PATTERN is an ATOMIC. It can be negated, in which case it is a NotPattern, which is a NonMonNot as defined in section Conditions, with the restriction that the associated formula must be an ATOMIC.

In this document, we commonly use: pattern, to denote the ATOMIC in a PATTERN. We qualify the pattern: negative pattern, when the PATTERN is a NotPattern, and: positive pattern, otherwise.

XML syntax

The XML syntax for the RIF-PRD pattern language is the XML syntax of the RIF-PRD condition language, restricted as relevant.

Operational semantics for RIF-PRD pattern language

(Some of the definitions below are borrowed from HAK.)

Let V be a countably infinite set of variable symbols and let Const be a set of constant symbols. The set T of ground terms is defined as follows:

We call substitution a finitely non-identical assignment of terms to variables; i.e., a function σ from V to T such that the set {?xV | ?x ≠ σ(?x)} is finite. This set is called the domain of σ and denoted by Dom(σ). Such a substitution is also written as a set such as σ = {ti/?xi}i=1..n where Dom(σ) = {?xi}i=1..n and σ(?xi) = ti for i = 1 to n.

That definition restricts the usual definition, which does not limit T to ground terms.

Let Var: LPV, be a function from the RIF-PRD pattern language LP to V that, given a pattern pLP, returns the set of the variable symbols Var(p) that appear free in p. If P is a set of patterns: P = {pi}, i = 1..n, we note Var(P) = ∪i=1..n Var(pi).

Given a pattern p and a fact - or ground pattern - t, pattern-matching is the operation that computes a substition σ for the free variables of p - i.e. Var(p) ⊆ Dom(σ) - such that σ(p) and t are identical formulae, possibly modulo a theory T. If there is such a substitution, we say that p matches t (modulo T).

This draft of RIF-PRD leaves any matching theory T, or the reference to such a theory, implicit, and it will be usually left implicit in the document as well. It is the responsibility of the consumer of a RIF-PRD document to decide which matching theory to apply, if any. Future versions of this draft will allow the explicit reference to matching theories represented in XML schemas, RDF schemas and graphs, and OWL ontologies. Future extensions of RIF-PRD may allow further sources of matching theories.

Given a pattern p and a set of facts S, if there is no substitution with Var(p) ⊆ Dom(σ) and no fact tS such that p matches t, we say that p dismatches S.

We call Working Memory (WM), the set of facts against which patterns are matched. The WM is left implicit in this draft : it is the responsibility of the consumer of a RIF-PRD document to decide against which sets of facts the patterns have to be matched. In future version of this draft, the RIF-PRD pattern language may be extended to allow that the source of facts against which the patterns are to be matched be explicitely specified.

A pattern is true iff it matches at least one fact in WM. A set of patterns P = {pi}, i = 1..n, is true - or matches the WM - iff all its element patterns are true; that is, if there is a substitution σ, such that Var(P) ⊆ Dom(σ) and σ(pi) ∈ WM for all i = 1..n.

Given a, possibly empty, substitution σ, a NotPattern NOT(p) is true iff σ(p) dismatches WM: we say that p σ-dismatches WM. A set of patterns P = {NOT(pi)}, is true iff σ(pi) dismatches WM for all the pi such that NOT(pi)P. We say that the set P- = {pi | NOT(pi)P} σ-dismatches the WM.

Model theory for RIF-PRD pattern language

The above operational semantics does not change the model theoretic semantics that is defined for ATOMIC and NonMonNot formulae in section Conditions.

As a consequence, patterns could be freely added as conjuncts to a CONDITION is it were not for their specific operational role in production rules; and they can be in the cases where that specific role is irrelevant.