get-values [Function]


Purpose

The get-values function gets the fillers of a given multiple-valued or single-valued role on a given instance.

Syntax

get-values instance role &key asserted-p 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.

If the asserted-p argument is t, then the fillers of role are returned only if they were explicitly asserted to fill that role. Default fillers, inferred fillers, and fillers of subroles of role are not returned.

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 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 rr) 
(defrelation ss :is (:and rr (:range A))) 
(tellm (A Sue) (:about Joe (rr Sue) (:filled-by ss Mary '(3 4 5)))) 
(get-values 'Joe 'rr) ==> (|I|SUE |I|MARY (3 4 5)) \
(get-values 'Joe 'rr :asserted-p t) ==> (|I|SUE) 
(defrelation r :characteristics :single-valued) 
(set-value 'Joe 'r 'Sue) 
(get-values (fi Joe) (fr r)) ==> (|I|SUE) 
(set-value 'Joe 'r '(3 4 5)) 
(get-values 'Joe 'r :context "CL-USER-KB") ==> ((3 4 5)) 
(get-values 'Joe 'x :no-error-p t) ==> NIL :MISSING-ROLE

See Also

Last modified: Dec 15 1995