I haven't looked at that code in a bit, but I suspect that the right thing happens if you just remove the association definition from defclass and reevaluate the defclass form. Can you mark this as a bug in elephant so I can remember to look into it later?

Thank you,
Ian

On Jul 4, 2008, at 4:24 AM, LukasGiessmann wrote:

hello,

since our last mail working with associations turned out to go quite well
but one more problem came up:
i tried to change the associations by removing it and replacing it by a
new association. but the function "remove-association" only works
partially.

1. in this one-to-one association the function doesn't work at all.
---
(defpclass job()
 ((title :initarg :title :accessor title-of :index t)
  (company :initarg :company :accessor company-of :index t)
  (job-holder :initarg :job-holder :accessor job-holder-of :associate
person)))

(defpclass person()
 ((name :initarg :name :accessor name-of :index t)
  (job :initarg :job :accessor job-of :associate job)))
---

an error message shows up:

(remove-association *job1* 'job-holder *person1*) ; -> There is no
applicable method for the generic function #<STANDARD-GENERIC- FUNCTION
ELEPHANT::OID (1)> when called with arguments (NIL).

same thing happens when i use the following statement:
(setf (job-holder-of *job1*) nil)


2. by one-to-many associations generally nothing happens at all.
---
(defpclass job()
 ((title :initarg :title :accessor title-of :index t)
  (company :initarg :company :accessor company-of :index t)
  (job-holders :accessor job-holders-of :associate (person job))))

(defpclass person()
 ((name :initarg :name :accessor name-of :index t)
  (job :initarg :job :accessor job-of :associate job)))
---

it only works in this case:
---
(drop-instance *person2*)
(remove-association *job2* 'job-holders *person2*)
---


3. in the case of many-to-many associations everything goes fine.

how do i get the "remove-association" function to work?
are there other ways for changing associations?


thank you for your help

lukas

_______________________________________________
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

Reply via email to