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
>
> --
> FH Worms - University of Applied Sciences
> Fachbereich Informatik / Telekommunikation
> Erenburgerstr. 19, 67549 Worms, Germany
> _______________________________________________
> elephant-devel site list
> elephant-devel@common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel

Attachment: directed_graph_works.lisp
Description: Binary data

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

Reply via email to