get-value [Function]


Purpose

The get-value function gets the filler of a given single-valued role on a given instance.

Syntax

get-value 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 single-valued relation, or the name of such a relation.

If the asserted-p argument is t, then the filler of role is returned only if it was explicitly asserted to fill that role. A default filler, inferred filler, or filler of a subrole of role is 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, the filler of role is returned. Otherwise, if no-error-p is set, then: (1) if role has multiple fillers, the first filler is returned, (2) if instance (or role) cannot be found, the two values nil and :missing-instance (or :missing-role) are returned.

Examples

(defrelation r :characteristics :single-valued) 
(defrelation s :is-primitive r :characteristics :single-valued) 
(set-value 'Joe 's 'Sue) 
(get-value 'Joe 'r) ==> |I|SUE 
(get-value 'Joe 'r :asserted-p t) ==> NIL 
(set-value 'Joe 's '(3 4 5)) 
(get-value (fi Joe) (fr s) :context "CL-USER-THEORY") ==> (3 4 5) 
(defrelation ss) 
(set-values 'Joe 'ss '(3 4 5)) 
(get-value 'Joe 'ss :no-error-p t) ==> 3 
(get-value 'Joe 'xx :no-error-p t) ==> NIL :MISSING-ROLE

See Also

Last modified: Dec 15 1995