get-inverse-values [Function]


Purpose

The get-inverse-values function returns a list of the instances which have a specified role filled by a specified instance.

Syntax

get-inverse-values instance role &key context no-error-p

Arguments

The instance argument is an instance, or an instance identifier.

The role argument is a relation, or the name of a relation.

The context argument is the context, or the symbol or string that names the context, where the lookup of instance and role begins. This defaults to the current context.

If the no-error-p argument is t, then error messages are suppressed.

Value

If the retrieval is successful, this function returns a list containing the inverse filler or fillers of role. Otherwise, if no-error-p is set and instance (or role) cannot be found, the two values nil and :missing-instance (or :missing-role) are returned.

Examples

(defrelation son :is (:and child (:range Male))) 
(defrelation parent :is (:inverse child)) 
(defrelation wife :characteristics :single-valued) 
(tellm (son Fred Joe) (parent Joe Mary) (wife Joe Sue)) 
(get-inverse-values 'Joe 'child) ==> (|I|FRED |I|MARY) 
(get-inverse-values (fi Sue) (fr wife) :context "CL-USER-THEORY") ==> (|I|JOE) 
(get-inverse-values 'Joe 'xxx :no-error-p t) ==> NIL :MISSING-ROLE

See Also

Last modified: Jun 1 1995