Ronald Wildenberg wrote:
> Thanks, this is a good solution I think. I'll try it.
> 
> The final solution I came up with is:
> 
> Query query = cloud.createNodeQuery();
> query.addStep(cloud.getNodeManager("A"));
> query.addRelationStep(cloud.getNodeManager("A"), "related",
> "destination");
> cloud.getList(query);
> 
> This is more or less the same as you suggest and indeed has the
> disadvantage that every relation that needs to be obtained results in
> another database call. Putting relation numbers in a single constraint
> is a good way to solve this.

Is it not possible to set the 'step' to the relation? With
Node.setNodeStep(), and the the query must be executed on the right
nodemanager.


This is the way use by the several node-lists implementations to avoid a
query for every node. I'm not sure if the 'node' step also may be the
relation step itself, but you could try it.


Bbtw, i looked at Queries#getRelationNodesQuery:

 public static NodeQuery createRelationNodesQuery(Node node, NodeManager 
otherNodeManager, String role, String direction) {
        NodeQuery query = createNodeQuery(node);
        if (otherNodeManager == null) otherNodeManager = 
node.getCloud().getNodeManager("object");
        RelationStep step = query.addRelationStep(otherNodeManager, role, direction);
        query.setNodeStep(step);
        return query;
    }

which makes me think, that it is possible.

Michiel



-- 
Michiel Meeuwissen                  mihxil'
Mediacentrum 140 H'sum                [] ()
+31 (0)35 6772979         nl_NL eo_XX en_US




Reply via email to