Hi, the attached patch solves the problem with the "forgotten" associations. The main reason for the problem was that the slot index was incorrectly named in the controller-index-table of the store controller.
Is this patch format ok? We are admittedly all but darcs experts. Regards Lukas, Marc & Christoph On Tue, Jul 22, 2008 at 08:17:21AM -0400, Ian Eslick wrote: > Sorry everyone, I'm not going to be able to get to this until at least > Friday and probably not until next week. > > The association mechanism isn't that big and is mostly built on top of > the core elephant other than some metaclass support. If someone wants > to look into it - the associations.lisp file and the metaclass.lisp > files have all you'd need to figure out what is going on. Associations > simply create and manage indices. The only magic is intercepting slot > reads/writes and updating the indices appropriately. I don't doubt that > there is likely to be corner cases the code doesn't yet handle. A second > (or third or fourth) pair of eyes is likely to be very helpful here. > > Ian > > On Jul 22, 2008, at 6:00 AM, LukasGiessmann wrote: > >> hi, >> >> i also tried to make a simple example of this situation and after a >> while >> i noticed the following behavior of the class A: >> >> --- >> (defpclass A() >> ((id :initarg :id :accessor id-of :index t) >> (points-to :accessor points-to :associate (A pointed-by) :many-to- >> many t) >> (pointed-by :accessor pointed-by :associate (A points-to) :many-to- >> many >> t))) >> --- >> >> the association index of the slots points-to and pointed-by is the >> same. >> so i redefined the class: >> >> --- >> (defpclass A() >> ((id :initarg :id :accessor id-of :index t) >> (points-to :accessor points-to :associate (A points-to) :many-to- >> many t) >> (pointed-by :accessor pointed-by :associate (AnotherClass points-to) >> :many-to-many t))) >> --- >> >> afterwards i made 2 instances of the new definition and checked the >> indices and they were not equal. >> >> finally i defined the original class A and made the directed >> associations, >> it worked. >> >> there's also the original file attached, with the exact program >> sequence. >> >> >> regards >> >> lukas >> >> >> >>> Hi, >>> >>> we came across a (to us) surprising behavior of the association code >>> in >>> elephant-unstable: If we generate associations between instances of >>> the >>> same >>> class, then elephant forces these associations to be symmetric. That >>> means >>> we >>> cannot use association slots to implement directed graphs. >>> >>> For example, the attached program is supposed to set up a "diamond"; >>> We'd >>> therefore expect the following output: >>> >>> Node A: >>> successors: (B C) >>> predecessors: () >>> Node B: >>> successors: (D) >>> predecessors: (A) >>> Node C: >>> successors: (D) >>> predecessors: (A) >>> Node D: >>> successors: () >>> predecessors: (B C) >>> >>> However, elephant makes both the successor and the predecessor slot >>> hold >>> always the same references: >>> >>> Node A: >>> successors: (B C) >>> predecessors: (B C) >>> Node B: >>> successors: (A D) >>> predecessors: (A D) >>> Node C: >>> successors: (A D) >>> predecessors: (A D) >>> Node D: >>> successors: (B C) >>> predecessors: (B C) >>> >>> Is this by design or is this a bug? Or did we simply use the >>> association >>> API >>> incorrectly? >>> >>> Regards >>> >>> Christoph >>> >> <directed_graph_works >> .lisp>_______________________________________________ >> elephant-devel site list >> elephant-devel@common-lisp.net >> http://common-lisp.net/mailman/listinfo/elephant-devel > > _______________________________________________ > elephant-devel site list > elephant-devel@common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -- FH Worms - University of Applied Sciences Fachbereich Informatik / Telekommunikation Erenburgerstr. 19, 67549 Worms, Germany
diff -rN -u old-elephant/src/elephant/associations.lisp new-elephant/src/elephant/associations.lisp --- old-elephant/src/elephant/associations.lisp 2008-07-23 18:44:10.000000000 +0200 +++ new-elephant/src/elephant/associations.lisp 2008-07-23 18:44:10.000000000 +0200 @@ -128,7 +128,7 @@ (aif (get-controller-association-index slot-def sc) (progn (add-association-slot-index it slot-def sc) it) (let ((new-idx (make-dup-btree sc))) - (add-slot-index sc new-idx (foreign-classname slot-def) (foreign-slotname slot-def)) + (add-slot-index sc new-idx (association-slot-base slot-def) (slot-definition-name slot-def)) (add-association-slot-index new-idx slot-def sc) new-idx))))
_______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel