Hi all,

Lately I've build a site on mmbase where most relations were
unidirectional. I made the choice to do this for speed and consistency:
it should make for simpler database queries, and the programmer always
knows which node is at which end of a relation.

In the process of building the system I've encountered some strange
behaviour:

1. When doing a cloud.getList() multilevel query you always need to
specify the path from source to destination no matter how you set the
searchDir parameter. This seems like a (documentation?) bug to me.

2. Node.getRelations() or getRelatedNodes() only return the relations
for which the Node is the source. As far as I know there is no way of
getting only the relations or related nodes for which the Node is the
destination - except for the cloud.getList() method.

suggestion:
I really would like something like Node.getParentRelations(),
Node.getParentNodes() and Node.getChildRelations() and
Node.getChildNodes() for this, and let Node.getRelations() and
Node.getRelatedNodes() always return both even when using unidirectional
relations.

Also I would like the searchDir parameter on cloud.getList() to work as
documented independent of the directionality of the relations.

I realize the current behaviour has probably been in mmbase for a long
time, so changing the functionality for getRelatedNodes() and
getRelations() might break some sites. Still it seems to be more in line
with the API docs:

" NodeList getRelatedNodes()
          Returns all related nodes. "

" RelationList getRelations()
          Returns all relation nodes attached to this node."

The impact of this change depends on the number of sites that currently
use unidirectional relations, and depend on the current behaviour, which
might not be many, but I couldn't really say.

Hope this starts some discussion :-)

Met vriendelijke groeten,
Joost Diepenmaat
Framfab Nederland



Reply via email to