[ZODB-Dev] Re: [Zope3-dev] PROPOSAL: ZODB Relationships

sean.upton at uniontrib.com sean.upton at uniontrib.com
Fri May 9 13:16:10 EDT 2003


Like in UML, associations have names/labels, and like in UML, associations
should have direction and roles.

+-------------+
|    Worm     |+
+-------------+|
 +:::::::::::::+
"Diner" | * 
        | 
        | Eats         1 +----------------+
        +--------------->|    Polonius    |
                "Dinner" +----------------+
                  (role)

In this case, there are worms who are dining on Polonius.  The
association/relationship is an "eats" or "eaten" relationship (depending on
your perspective): both are, as Hamlet puts it, "at supper" but in much
different senses (direction is important).  You should be able to also
infer:

+-------------+
|    Worm     |+
+-------------+|
 +:::::::::::::+
"Diner" ^ * 
        | 
        | Eaten by     1 +----------------+
        +----------------|    Polonius    |
                "Dinner" +----------------+
                  (role)

If a relationship is stored that the worm "eats" polonius, and we have some
global place to lookup the inverse relationship label, we can also ask
Polonius who (or what) is eating him.  Or we could ask the relationship
service playing the part of Hamlet for the inverse.

The point is, when the relationship is created, we need to store a label
about the relationship, or we have no way to infer the inverse.

Note: this is shown as a single many to one relationship, but it is just a
simplified representation of multiple similar many-to-one relationships.
There would need to be a way to have Polonius query all relationships to all
worms eating at him, provided the worms have names (don't they?). ;)  All
these many-to-one instances are part of the same association or
"relationship set" if I understand correctly, and that relationship set
might have two labels depending upon direction; if you use lookup tables for
the inverse, only one would have to be stored.

Sean

-----Original Message-----
From: Shane Hathaway [mailto:shane at zope.com]
Sent: Friday, May 09, 2003 11:43 AM
To: Phillip J. Eby
Cc: roche at upfrontsystems.co.za; zodb-dev at zope.org
Subject: Re: [ZODB-Dev] Re: [Zope3-dev] PROPOSAL: ZODB Relationships


Phillip J. Eby wrote:
> At 12:24 PM 5/9/03 -0400, Shane Hathaway wrote:
> 
>> True.  We're still tinkering with terminology.  Each call to the 
>> Relationship() constructor names a distinct relationship set.
> 
> Why?  What good is that?
> 
>>   (Oops, I guess the examples in the proposal don't make it possible 
>> for a Relationship to know its name.)
> 
> Why do they need to?
> 
>>   Currently there is no connection between relationship sets, other 
>> than being stored in the same repository.
> 
> What's a relationship "set", and what value does it add?

Those questions are hard to answer.  Maybe if I used the term 
association instead of "relationship set", you'd see what I'm saying:

Each call to the assocation constructor names a distinct association. 
The association constructor should expect an association name as the 
first argument.  There is no connection between associations, other than 
the fact that a shared repository might store links for several 
associations.

I got the term relationship set from a paper on the web.  But the 
vocabulary we've been working with has been limiting.  UML's association 
concept seems a much better fit because it provides a large enough 
vocabulary: association end, link, association name, association class, etc.

Shane


_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev at zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev



More information about the ZODB-Dev mailing list