NextPrevUpTopContentsIndex Examples

(def-named-kb-class truck ()
     ((location :initarg :location)
      (destination :initarg :destination)))
(make-instance 'truck 
               :kb-name 'ford1
               :location 'cambridge)

creates the instance #<KB-OBJECT FORD1> .

(make-instance 'truck :location 'london)

creates the instance #<KB-OBJECT TRUCK123> , and

(get-object 'ford1)

returns #<KB-OBJECT FORD1> and

(name (get-object 'ford1))

returns FORD1 . The class definition

(defclass truck (named-kb-object) ...)

would have been identical except that the second truck would have been given a name such as OBJECT345 rather than TRUCK123 (as def-named-kb-class overrides the inherited initform for th e kb-name slot (gentemp "OBJECT") with a more specific one (gentemp <class-name>) ).

KnowledgeWorks and Prolog User Guide - 4 Apr 2005