KnowledgeWorks and Prolog User Guide > 7 Reference Guide

NextPrevUpTopContentsIndex

defcontext

Macro
Summary

Defines a context.

Signature

defcontext context-name &key ( refractoriness t) ( auto-return t) strategy meta documentation

Arguments

context-name

The name of the context being defined.

refractoriness

A boolean.

auto-return

A boolean.

strategy

A list of symbols.

meta

A list of actions.

documentation

A string.

Description

Defines a context named context-name . If a context of that name already exists then it, and all the rules in it, are first removed.

If refractoriness is nil then a rule instantiation remains eligible to fire again after firing once. If refractoriness is t (the default) then each rule instantiation will only fire once.

The auto-return indicates, when there are no more rules to be fired in the context, whether to signal an error or simply to pass control to the next context on the agenda. The default value t passes control on without an error.

The strategy is the conflict resolution strategy for the context, consisting of a list of tactic names.

The meta is a list of actions which make up the optional meta-interpreter for the context.

If documentation is given, then it should be a string. The value can be retrieved by calling the function documentation with doc-type context .

Examples
(defcontext my-context :strategy (priority recency))
(defcontext another-context :strategy (order)
  :meta ((start-cycle)
         (instantiation ?inst)
         (fire-rule)
         (cut)
         (another-context)))
See also

standard-context
-lex
lex
-mea
mea
-order
order
-priority
priority
-recency
recency
-specificity
specificity


KnowledgeWorks and Prolog User Guide (Macintosh version) - 22 Dec 2009

NextPrevUpTopContentsIndex