All Manuals > KnowledgeWorks and Prolog User Guide > 3 Rules > 3.1 Forward chaining > 3.1.5 Control Flow

NextPrevUpTopContentsIndex Contexts

Contexts are the groups into which rules are partitioned. The context default-context always exists. Contexts are defined by:

<context> ::=
          (defcontext <context-name>
                      [:strategy <CRS>]
                      [:auto-return t | nil]
                      [:meta <meta-actions>])
                      [:documentation <doc-string>])

where <context-name> is a symbol, <CRS> is a conflict resolution strategy defaulting to (priority recency order) (see below). If :auto-return is set to t (the default) then when the context has no more rules to fire, control passes to the next context on the agenda, but if it is nil an error occurs (a rule in the context should have issued a (return) instruction explicitly). The :meta option is necessary only if the default behavior of the context is to be modified and is explained in Meta Rule Protocol. If :documentation is given, then doc-string should be a string and the value can be retrieved by calling the function documentation with doc-type context .

KnowledgeWorks and Prolog User Guide (Windows version) - 6 Dec 2011