[Zope3-dev] annotations and relations

Jean-Marc Orliaguet jmo at ita.chalmers.se
Fri Aug 12 13:54:21 EDT 2005


Derrick Hudson wrote:

>On Fri, Aug 12, 2005 at 03:07:33PM +0200, Jean-Marc Orliaguet wrote:
>
>| What I don't like about annotations is that the information is stored on
>| the object itself.
>
>FYI the annotations framework can be used while storing the annotation
>elsewhere.  For example
>    http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Book/principalannotation.html
>
>
>| That's why I'm using relations in cpsskins
>| (http://svn.nuxeo.org/trac/pub/file/z3lab/cpsskins/trunk/storage/relations.py)
>| instead of using annotations even for trivial things such has whether an
>| object is visible or not.
>[...]
>
>I'll have to research this some more.  It sounds like some interesting
>ideas on how to organize and manage the data.
>
>-D
>
>  
>

Hi Derrick!

maybe I didn't explain what the actual issue is:

The problem is not whether the annotation data is stored *elsewhere* but
whether the annotation data is "tied" with object or not.

If it is tied with the object, then whenever you use annotations to
store a relation between several objects, you have to store the relation
twice if the relation is dyadic, to be able to do a reverse lookup:

cf. zope.app.dublincore.dcterms

    "Relation.Requires":             ("dcterms:requires", ""),
    "Relation.Is Required By":       ("dcterms:isRequiredBy", ""),

You'd store

"Relation.Requires"__ B  in  A

and

"Relation.Is Required By" __ A in B

So storing dyadic relations as annotations is a bit of a hack.
Schoolbell relationships also store dyadic relations as annotations,
that takes twice as much information as is actually needed.

However if you do not tie the relation with the objects of the relation
(the relates), then you need to store the relation only *once*, because
if you have a first that "Relation.Requires" a second, then you can
lookup the seconds that are "Relation.Is Required By"the first, by using
the same "Relation.Requires" predicate.

The issue become even more complicated with triadic relations (a
relation between 3 objects). The classical hack consists in storing 3
dyadic relations between 3 objects, i.e. in the end 6 times as much
information as is actually required and it's logically incorrect too
(since you can't build genuine triadic relations with help of a
combination of dyadic relations). RDF does something called
"reification" to simulate triadic relations.

Anyway the bottomline is that an enormous amount of information has to
be duplicated for nothing.

cheers
/JM





More information about the Zope3-dev mailing list