[Zope-CMF] Relating different objects to each other

sean.upton@uniontrib.com sean.upton@uniontrib.com
Sat, 12 Oct 2002 16:53:46 -0700


I like the simplicity and ease of using your mxmRelation product, and I like
the idea of consolidating all relation objects into a relation folder - it
makes a lot of sense.  I'm using this in my current projects and it works
out well, but my requirements are growing to have more complex relationship
management needs, unfortunately.  I want my non-technical news and content
staff to be able to add new types of relationships arbitrarily by using a
keyword/phrase/label to identify them.

What I would like to be able to do, in my particular case, is add
relationships that have metadata themselves, like a model ("has part" vs.
"related"), label ("Related Images", "Yesterday's Coverage"), (optionally) a
description, tie-ins to workflow via dependency tracking (if X is related to
Y, and what's more, that relationship is marked as a dependency, hold X with
a guard condition until Y is published, etc).  My current mode of thinking
is that a relationship should be an available CMF content type; each single
relationship in my complex multiple-media asset management system should tie
a one-to-one relationship between objects, and provide important metadata
and a field to determine if the relationship creates and required
dependencies (for workflow on those objects). A CMF relationship utility
tool should leverage the catalog to use these "managed relationships" to
assemble lists of related content on the fly by compositing all the
relationship objects that serve a particular object into a list of items,
provide a list of any dependencies in or not in a particular workflow state,
etc.  Said tool would likely need to prune or modify relationships for
deleted and/or moved content.  This is obviously ambitious, and not nearly
as turn-key as your mxmRelation product, but I'm likely to eventually go
down this road eventually, likely soon.

I'm not sure that I need new infrastructure (though I'm sure that whatever
is created won't be perfect - obvious questions arise like "what happens
when content moves").  With a bit of work, though, I think high-level,
user-customizable relationship tracking could be possible in Zope2/CMF;
hopefully, I'm right about this.

Sean

-----Original Message-----
From: Max M [mailto:maxm@mxm.dk]
Sent: Saturday, October 12, 2002 11:34 AM
To: sean.upton@uniontrib.com
Cc: StillSmallVoice@DirectvInternet.com; zope-cmf@zope.org
Subject: Re: [Zope-CMF] Relating different objects to each other


sean.upton@uniontrib.com wrote:
> Short term: use Max M's mxmRelation product (which is not CMF specific).
> For each type of relation, you will need to create a mxmRelation object in
> the root of your CMF site,


Just as a sidenote here on "best practice". I have found it usefull to 
have an objectmanager, or a folder, called "relations" in which I put 
all the relation objects.

relations/
     student_class
     student_teacher
     student_subjects
     etc ...

Also it makes it easier to delete all relations to an object when the 
object is deleted or moved, by simply:

for relation in self.relations:
     relation.delete(self)

And a few other things.

... cms stuff snipped ...

> Long term: I'm sure that eventually, need will dictate a more scalable
> relationship management tool in the CMF.  See thread on this in the
archives
> from a few days ago.


I don't think it is possible to make it much better in Zope than is done 
by mxmRelations. The nessecary infrastructure simply isn't there in Zope 2.x

In Z3 there will be the objecthub, which will make a relations product 
better and automate some of the things that has to be done manually now. 
But I have added code to maintain relations during a move of an object 
which is really very simple to use, and only adds a few extra lines to 
objects using it.

currently mxmRelations is basically a dictionary of paths.

relation = {
     'path/to/obj1':['path/to/obj2', 'path/to/obj3'],
     'path/to/obj2':['path/to/obj1', 'path/to/obj3'],
     'path/to/obj3':['path/to/obj1', 'path/to/obj2'],
}

By accident this is a so called "graph" as used in AI ;-)

The most obvious improvement of mxmRelations would be to convert this 
dictionary into a OOBtree structure. This will happen when I get the 
need, or when somebody sends me a patch ;-)

My guess is that it would be a *very* simple change! And would make the 
product as scalable as the ZODB allows.

Currently I have some thousand objects in each relation and I don't have 
performance problems. Put hundred of thousand of objects onto one and 
you could get problems. I don't know, I haven't tried :-)


regards Max M

"Skeptic Effect" or the "Randi Effect"
When a skeptic is near, supernatural effects seem to disappear.


_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests