next up previous contents index
Next: Declaring Rules Up: Special Forms Previous: Declaring a Taxonomy of

Declaring Slots and their Domains


(:slot  atom (domain tex2html_wrap_inline1330 ) descriptor tex2html_wrap_inline1326 )

Declares a new slot and types it using domain tex2html_wrap_inline1330 . Typing is enforced using an if-added rule. For example:


declares the slot has-disease to be a relation between people and diseases. If one then asserts:


Algernon concludes that p1 isa people, and d1 isa diseases.

In general, domains must be Algernon sets, defined by the time the slot is accessed. A warning is given if a domain is undefined when the :slot is asserted. However, a domain may also be declared to be one of the Lisp datatypes, :number, :string, :symbol or :list. The variable *lisp-type-domains* holds the current complete list of permissible Lisp datatypes. The domain specification nil is completely unconstrained.

:slot takes the following ``keyword'' arguments:

:cardinality  n
Asserts that the slot holds at most n values. Defaults to nil (no restriction). In the current implementation, cardinality information is primarily used to limit the application of if-needed rules (if a slot is queried but is full then the rules are not applied).
:backlink  slot2
Backlinks the slot to slot2. This means that if Algernon learns (slot f1 f2) it will conclude (via an if-added rule) (slot2 f2 f1). slot2 must already be defined.
:inverse  slot2
Asserts that the inverse of the slot is slot2. This is equivalent to bi-directional backlinks.
:comment  string
Adds a comment for the slot.

(:declare-slot  atom (domain tex2html_wrap_inline1330 ) [:cardinality number])

This is a limited-purpose version of :slot, allowing only the :cardinality keyword, used in the early stages of setting up the knowledge-base.

See section 4 for examples of the use of :taxonomy and :slot.

Micheal S. Hewett
Tue Oct 29 11:28:38 CST 1996