I noticed there was a disparity between get-instances-by-class and
map-inverted-index.  I will let the code speak for itself:

BOOKS> (length (ele:map-inverted-index #'(lambda (isbn obj) obj) 'material
'isbn :collect
t))

1945

BOOKS> (length (ele:get-instances-by-class 'material))
0
BOOKS> (defparameter f (make-instance 'material :title "Fake Book"))
F

BOOKS> (length (ele:get-instances-by-class 'material))
1

BOOKS> (length (ele:map-inverted-index #'(lambda (isbn obj) obj) 'material
'isbn :collect
t))

1946

There is a similar problem with the university class.

BOOKS> (length (ele:get-instances-by-class 'university))
0
BOOKS> *stanford-university*
#<UNIVERSITY
oid:204>

BOOKS> (official-name *stanford-university*)
"Stanford University"

All of the instances in the database were created in a prior session.  Then
I shut down the DB and restarted Lisp.  Now MAP-CLASS and
GET-INSTANCES-BY-CLASS return nil for all classes.  It seems like new
instances get added to the "class index," but older instances are not
found.  However, these classes persist in the inverted slot indexes.  Can
anybody diagnose what's going on?

here are the definitions of the classes:

(defclass department ()
  ((university :initarg :university :initform nil :accessor
department-university
               :index t)
   (official-name :initarg :official-name :initform nil :accessor
official-name)
   (common-name :initarg :common-name :initform nil :accessor common-name)
   (abbreviation :initarg :abbreviation :initform nil :accessor abbreviation
                 :index t))
  (:metaclass ele:persistent-metaclass)
  (:documentation "A department has a bunch of course listings."))

(defclass material ()
  ((title :initarg :title :initform nil :accessor material-title
          :index t)
   (authors :initarg :authors :initform nil :accessor material-authors) ;; a
list of
authors

   (edition :initarg :edition :initform nil :accessor material-edition)
   (isbn :initarg :isbn :initform nil :accessor material-isbn
         :index t)
   (asin :initarg :asin :initform nil :accessor material-asin
         :index t
         :documentation "An Amazon.com identifier that uniquely identifies
the material")
   (image-uri :initarg :image-uri :initform nil :accessor
material-image-uri))
  (:metaclass ele:persistent-metaclass))

Thanks,
Red
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to