From: Ray Z. <rz...@co...> - 2004-02-16 15:52:21
|
On Feb 15, 2004, at 8:45 PM, Vsevolod (Simon) Ilyushchenko wrote: > I was wondering if it's possible to implement in SPOPS "has_many" > relationship (in addition to "has_a" and "links_to"). Obviously, it > can be done through "links_to", but at the cost of an additional > database table which makes things more cumbersome. For things like a > bug database, where one software project references several bugs, but > no bugs belong to more than one software project, "links_to" is an > overkill. If the id of the owner is stored in a field of the owned > object, the implementation can be similar to the already existing code > for the other relationships. When you talk about a "has-many" relationship, I think you are just looking at the other end of a has-a relationship, right? To use your example, a bug has-a project that it belongs to. If I interpret correctly what it is that you want, you're looking for the ability to define a relationship that would automatically generate methods in your "software project" object to fetch the corresponding list of bugs, for example. If so, I invested some effort a few years ago in defining a generalized relationship configuration syntax which handles this case (as well as the has-a and links-to). You can find my proposal in the openinteract-dev archives. The first one [1], posted on 7/3/01 is quite long and spells things out in pretty much detail. The second [2] was posted in Jan 2002 and includes some additions and updates to the proposed design. At the time, Chris seemed pretty interested in eventually having some variation of this design included in SPOPS. I've implemented only small pieces of it for my own use and I suspect it just that on Chris's end it just came down to a shortage of tuits. Assuming I've interpreted correctly what you want, I would encourage you to have a look at what I proposed. It would be really wonderful if it addresses what you need and you actually have some time to implement it and get it incorporated officially into SPOPS. [1] http://www.geocrawler.com/archives/3/8393/2001/7/0/6095774/ [2] http://www.geocrawler.com/archives/3/8393/2002/1/0/7464826/ Ray Zimmerman Director, Laboratory for Experimental Economics and Decision Research 428-B Phillips Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645 fax: (815) 377-3932 |