Michel Pelletier wrote:
>>Date: Wed, 04 May 2005 08:17:09 +0200
>>From: "Achim Domma (Procoders)" <[EMAIL PROTECTED]>
>>Subject: [Zope3-dev] relational data
>>Message-ID: <[EMAIL PROTECTED]>
>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>I'm evaluating ZOPE for some projects we might have to implement. ZODB
>>looks very nice for storing object hierarchies but I don't understand
>>how to store relational data.
>>For example, f I store people and qualified realations between them, I
>>usally have a table 'person' which hold the person records,
>>'relation_type' which hold the possible relations and
>>'person_person_relation' which holds the ids of the related persons and
>>the id of the type of the relation.
>>I don't see how I would store something like this in ZODB and I want to
>>understand if it's better to stick with a relational database for such a
>>case. Or is there a solution, which I might not see at the moment?
>>This should be no criticism, I only want to understand what Zope is good
>>for and where something else might suite my needs better.
>ZODB does not strictly require hierarchical object graphs, that's a
>Zopeism, ZODB will allow you to construct arbitrary object graphs.
>Given that it can store "relations" as well as it can store any other
>object. Storing references like you describe can be done easily in ZODB.
>There are three existing systems like this to my knowledge.
>Although the terminology differs depending on what system you are
>looking at, I'll use RDF terms here, subject (referer), predicate
>(reference) and object (referent). So if your relationship is "Bob
>likes Mary" then 'Bob' is the subject, 'likes' is the predicate, and
>'Mary' is the object. This subject/predicate/object model goes by many
>names but for the sake of discussion lets call it SPO.
>Storing these references can be done any number of ways, but in ZODB I
>have seen two ways, the first is from Zemantic (http://zemantic.org/)
>which is a very early Zope 3 product that stores RDF. Zemantic lets you
>store and query SPO relations (called "triples" in RDF). Each subject,
>predicate, and object is stored in a multi-dimensional ZODB BTree.
>The second is Archetype references (for Zope 2) that use a ZCatalog to
>store basically a very similar data structure to what Zemantic uses, a
>three column "table" (constructed of ZCatalog indexes) that index the
>relationships in each dimension. Archetype references are pretty mature
>and offer more features than Zemantic that go beyond RDF, but as of now
>it's Zope 2 only.
>The third framework comes with the SchoolBell Zope 3 product I have no
>experience with and I don't know exactly how it stores its data, but I
>suspect it is less "bleeding edge" than Zemantic (I can say that with
>some confidence because I am in the middle of upgrading Zemantic to
>rdflib 2.1, which is pretty radically different than 2.0).
>Or, of course, you can just use a relational database which might give
>you more piece of mind.
>Hope that helps,
I believe that there are different usages of relationships.
The one is to store information into databases in format such as RDF
with the ability to do advanced queries (Zemantic). That is the Semantic
Web approach, ontologies, the idea of a universal way of representing
knowledge, etc.. This involves the existence of a standard language to
represent objects and the relationships between them.
The other usage is the ability to connect objects together and move some
of the logic from the object to the relationship itself, i.e. more or
less the Schoolbell approach. Relationships changes trigger events that
allow other objects to react to these changes. One of the biggest
problems when you're creating a relation between two objects through
references is how to deal the case where one of the objects gets
deleted, copied, renamed, duplicated, etc.? Implementing this on an
object level is difficult because it means that the object must know
about the nature of the other objects that it will be related too and it
must know how to deal with changes done on these objects. One the
related object is changed it is also the relationship that is changed,
and when you create the relationship in the first place, you must also
tell: what happens if the relationship is modified? Otherwise you'll get
orphans, dead links, cycles (if you connect A to B, B to C and then C to
A, and try to dereference A) ..
Zope3-dev mailing list