set-values [Function]


Purpose

The set-values function replaces the current value(s) of a given multiple-valued or single-valued role on a given instance.

Syntax

set-values instance role values &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 values argument is a list of objects which will be the new fillers of role. If a member of values is a symbol, the member is coerced to an instance unless the the range of role indicates that it should be interpreted as a constant. If role is single-valued, the value of role is set to the first member of values.

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 update is successful, the new value of role is returned. If it fails and no-error-p is set, then: (1) if the type of any member of value conflicts with the range of role, the two values nil and :type-clash are returned, (2) if instance (or role) cannot be found, nil and :missing-instance (or :missing-role) are returned.

Examples

(defrelation rr)
(set-values 'Joe 'rr '(3 4 5)) ==> (5 4 3) 
(set-values (fi Joe) (fr rr) nil :context "CL-USER-THEORY") ==> NIL 
(set-values 'Joe 'rr '(Mary)) ==> (|I|MARY) 
(defrelation ss :range Symbol) 
(set-values 'Joe 'ss '(Mary Sue)) ==> (SUE MARY) 
(set-values 'Joe 'ss '(3) :no-error-p t) ==> NIL :TYPE-CLASH 
(defrelation r :characteristics :single-valued) 
(set-values 'Joe 'r '(3 4 5)) ==> (5 4 3) 
(get-values 'Joe 'r) ==> (3)

See Also

Last modified: Jun 1 1995