forget [Macro]

forgetm [Macro]


Purpose

The forget macro is used to retract propositions from the Loom database. These propositions may state that an instance belongs to a given concept or has a particular feature, or that a certain relationship holds between two or more instances.

The forgetm macro retracts one or more propositions, and then advances to a new knowledge base state.

Syntax

forget &body propositions
forgetm &body propositions

Arguments

The propositions argument consists of zero or more propositions (see Remarks below) which are to be retracted.

Value

The forget macro normally returns the symbol ok. However, if propositions contains one or more :about clauses, the subject of the last such clause is returned. The forgetm macro returns the newly-advanced state time.

Remarks

  proposition ::= 
      ( concept instance ) | 
      ( relation instance+ value ) | 
      ( :CREATE ?Var concept [:CLOS] ) | 
      ( :ABOUT instance about-clause* )
  about-clause ::= 
      concept | ( concept ) | ( relation value ) | 
      ( :FILLED-BY relation value+ ) | 
      ( {:AT-LEAST | :AT-MOST | :EXACTLY} Integer relation ) | 
      ( {:ALL | :SOME | :THE} relation concept )
Each proposition in the propositions argument above has the following syntax: Each about-clause in a proposition has the form:

A concept, relation, or instance may be either a symbol that names a Loom object, or a variable beginning with the character ?. An instance may also be a constant or a formula, where a formula is a list of the form (relation instance).

All ?-variables in a retraction are assumed to be bound externally. The value of an external ?-variable should be a Loom object, i.e., a concept, relation, or instance, rather than the name of such an object. If the symbol * is used in place of a role value, all fillers of that role are retracted.

The Loom Grammar at the end of this manual is too general in the following respects: (1) Loom does not currently support the retraction of :same-as propositions, and (2) :filled-by-list cannot be used in the :about clause of a retraction.

Concepts and relations referenced by name in a retraction must be defined at the time the retraction is compiled. References to an instance, say A, bind to a previously declared concept or relation with name A, if such exists, and otherwise they bind to an existing instance with identifier A.

Examples

(forget (Person Joe)) ==> OK 
(forget (age Joe 30) (wife Joe Sue) (Teacher Sue)) ==> OK 
(forget (age (wife Joe) (+ (age Joe) 1))) ==> OK 
(forgetm (child Joe *)) ==> 3 
(setq ?C (fc Person) ?R (fr age) ?I (fi Joe) ?V 30) 
(forgetm (?C ?I) (?R ?I ?V)) ==> 4 
(forget (:about Joe Person (wife Sue))) ==> |I|JOE 
(forgetm (:about Joe (child Fred) (child Mary))) ==> 5 
(forgetm (:about Joe (:filled-by child Fred Mary Don))) ==> 6 
(forgetm (:about Joe (:at-least 3 child) (:at-most 1 daughter) 
                     (:exactly 2 son))) ==> 7 
(forgetm (:about Joe (:all child Adult) (:some son Bachelor))) ==> 8 
(setq ?I (fi Joe) ?R (fr child) ?C (fc Adult)) 
(forgetm (:about ?I (:all ?R ?C))) ==> 9 

See Also

Last modified: Jun 1 1995