Seems to me you have a different interpretation of "unidirectional". Knowing what which end is source and destination has nothing to do with it.
In MMBase, unidirectionality of relations means the relations can only be followed from source to destination. The behavour that you describe is a consequence of this: you can only get related nodes when you start from the node at the source end. I know it is confusing. I for one can't think of a situation where this feature could be useful. One thing you can do is change the relation definitions (reldef nodes) to bidirectional. Rob van Maris Senior Developer Finalist IT Group Java Specialists ------------------------------------------------------------- Amsterdam, The Netherlands Office: +31 20 5962301 (Direct) Mobile: +31 651444006 Fax: +31 20 5962331 ------------------------------------------------------------- > -----Oorspronkelijk bericht----- > Van: Joost Diepenmaat [mailto:[EMAIL PROTECTED]] > > 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 > > >
