[elephant-devel] associations between instances of the same class

LukasGiessmann inf1045 at fh-worms.de
Tue Jul 22 10:00:11 UTC 2008


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 at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: directed_graph_works.lisp
Type: application/octet-stream
Size: 2116 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20080722/aea98f6e/attachment.obj>


More information about the elephant-devel mailing list