next up previous contents index
Next: Slot-Access Functions Up: Operations on Frames Previous: Operations on Classes

Operations on Instances

 

This section provides operations for viewing frames as instances of classes. A frame is an instance frame if it is an instance of some class other than a class of classes. Frames can be an all-instance-of or a direct-instance-of a class. We use the term all types to refer to the set of class frames of which a frame is an instance. The direct types of a frame are those class frames of which the frame is a direct instance. A frame is an instance of a class if it is a direct instance of the class or it is a direct instance of a sub of the class. See Section 2.4 for more information.

instance-p  thing &key kb kb-local-only-p

Returns true in both of the following cases, otherwise returns nil. Case 1: thing is a frame object of the type appropriate for kb and thing is an instance frame. The frame may or may not be in kb. Case 2: thing is a symbol that identifies a frame in kb that is an instance frame.

Note that CLOS function instance-p Returns true for any CLOS object, including CLOS classes. In contrast, gfp:instance-p and class-p will only both return t when applied to the same frame if that frame is both an instance (a direct-instance of a class that is not a class of classes) and a class (a direct-instance of a class that is a class of classes, such as :CLASS).

create-instance  name direct-types &key kb error-p own-slots own-facets kb-local-only-p

Creates an instance frame whose name is given by the symbol name. The one or more classes that are direct types of the instance are given by direct-types, which may be an atom or a list. This function returns the new instance frame. Error-p affects the behavior of the function when a frame called name already exists; the function deletes the existing frame when error-p is nil rather than signaling an error. The parameters own-slots and own-facets have the same meaning as for create-frame .

get-instance-direct-types  instance &key kb kb-local-only-p

Returns a list of the direct types of instance.

get-instance-all-types  instance &key kb error-p kb-local-only-p

Returns a list of the all-types of instance.

mapcar-instance-direct-types  instance function &key kb kb-local-only-p

Maps function over the direct types of instance.

mapc-instance-direct-types  instance function &key kb kb-local-only-p

Maps function over the direct types of instance.

do-instance-direct-types  (var instance &key kb kb-local-only-p) &body body Macro

Repeatedly executes body with var bound to a different direct type of instance on each iteration.

mapcar-instance-all-types  instance function &key kb kb-local-only-p

Maps function over the types of instance.

mapc-instance-all-types  instance function &key kb kb-local-only-p

Maps function over the types of instance.

do-instance-all-types  (var instance &key kb kb-local-only-p) &body body Macro

Repeatedly executes body for all of the types of instance, with var bound to a different type for each iteration.


next up previous contents index
Next: Slot-Access Functions Up: Operations on Frames Previous: Operations on Classes

  • Peter Karp