remove-value [Function]


Purpose

The remove-value function removes a value from a given role on a given instance.

Syntax

remove-value instance role value &key kb 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 value argument is the value to be removed from the fillers of role. If value is a list, the list is interpreted as a single role filler. If value is a symbol, the value is coerced to an instance unless the the range of role indicates that it should be interpreted as a constant.

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

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

Value

If the update is successful, the newly removed value is returned. 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) 
(set-values 'Joe 'rr '(Mary Sue (3 4 5))) ==> (|I|MARY |I|SUE (3 4 5)) 
(remove-value 'Joe 'rr 'Mary) ==> |I|MARY 
(remove-value 'Joe 'rr '(3 4 5)) ==> (3 4 5) 
(get-values 'Joe 'rr) ==> (|I|SUE) 
(defrelation ss :range Symbol) 
(add-value 'Joe 'ss 'Mary) ==> MARY 
(remove-value 'Joe 'ss 'Mary) ==> MARY 
(remove-value 'Joe 'xx 'Mary :no-error-p t) ==> NIL :MISSING-ROLE

See Also

Last modified: Jun 1 1995