Reinoud van Leeuwen wrote:

>On Fri, Nov 11, 2005 at 03:50:25PM +0100, Helmut Merz wrote:
>>A relation is an object providing the IRelation interface. This 
>>has got two attributes ('first', 'second' - dyadic relation) or 
>I've done this kind of thing in relational databases. Problem with 'first' 
>and 'second' is that it seems to imply some order. And if I try to find 
>all relations from an object I allways have to compare my ID to either 
>first or second.
>I solved my problem by chopping a relation into three parts: the relation 
>itself and both endpoints. In my database this generated an extra table 
>(and some more work when writing queries), but the solution became more 
>generic and flexible in the end.
>(See the database diagram on 
> . The two endpoints of 
>a relation are stored in two object_link records, the relation itself in 
>one link record.) 


I think that you want 1 relation that consists of:
- the elements in the relation (the relates)
- the predicate

then you can chop the relations into piece when you index it, but not

a relation is by definition 1 entity, if you start storing 2 items to
represent a single relation, you will have problems looming ahead when
it comes to managing the different "parts" of the relation. For instance
if you store A -> B and B -> A to represent A <-> B, you will have to
destroy A -> B if you remove B -> A.

This is why I use real triadic relations to avoid having complicated
constructions based on  dyadic relations that only make sense when
they're taken together. When I destroy a triadic relation between 3
objects, this is done in one take, not three takes.

then order in a relation is important:

    A kills B

is not the same as:

    B kills A

of course if the predicate is :

   __ is like __

it appears as though order is not important, but it is a question of
semantics, not a question of logic. A relation engine is not supposed to
know about semantics.


Zope3-dev mailing list

Reply via email to