defkb [Macro]


The defkb macro creates a new knowledge base.


defkb name parentKbs &key path-name package export-names-p monotonic-p


The name argument is a symbol or string that names the new knowledge base.

The parentKbs argument is a symbol or string, or a list of symbols or strings, which name the immediate parents of the new knowledge base. If this argument is nil, it defaults to upper-structure-kb.

The path-name argument is a string which specifies the file to be used for saving and restoring the new knowledge base.

The package argument is a symbol or string that specifies the package into which a saved version of the knowledge base should be loaded. This package name is written into the file created by save-kb. It defaults to the current package.

If the export-names-p argument is t, Loom exports the names of all objects created in the new knowledge base. Names are exported from the package in which they reside, which may be different from the package argument or from the current package. By default, names are not exported.

If the monotonic-p argument is t, Loom assumes that assertions made about instances in this knowledge base will not be retracted. Operations that Loom cannot undo, such as the generation and merging of skolems, should only be performed in a monotonic knowledge base.


The newly created knowledge base is returned.


If an old knowledge base with the same name exists, defkb destroys that knowledge base, and its children recursively, before creating the new knowledge base.

The upper-structure-kb knowledge base is created by Loom and populated with built-in concepts and relations. All user knowledge bases are descendants of upper-structure-kb.

The bottom-kb knowledge base is created by Loom and is dynamically relinked so that it is always lower than any other knowledge base. Loom objects in all knowledge bases are visible from bottom-kb.

Unlike Lisp packages, inheritance between knowledge bases is transitive. From a given knowledge base, references can be made to objects in that knowledge base, in its parents, and in all of its ancestors.


(defkb foo-kb nil) ==> |K|FOO-KB 
(defkb foobar-kb (foo-kb bar-kb) :pathname "foobar-kb.lisp" 
       :package USER :export-names-p t) ==> |K|FOOBAR-KB

See Also

Last modified: Jun 1 1995