[elephant-devel] changing association slots

LukasGiessmann inf1045 at fh-worms.de
Fri Jul 4 08:24:56 UTC 2008


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




More information about the elephant-devel mailing list