All Manuals > KnowledgeWorks and Prolog User Guide > 7 Reference Guide

defcontext Macro

Summary

Defines a context.

Package

kw

Signature

defcontext context-name &key refractoriness auto-return 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

The macro defcontext 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.

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.

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

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

If documentation is supplied, 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) - 01 Dec 2021 19:35:35