2010/4/7 Alastair James <al.ja...@gmail.com> > > > > > These two ways of traversing a graph complement each other, it's not > that > > > one is "better" than the other. Would you agree on this? > > > > I think I agree. I would hope to be able to use XPath/Gremlin style > querying > for most things, and a more programatic system for more complex ones. > Something like this will come along as well rather soon (I suspect)
> > > a JSON document describing the traverser, like: > > > > { "order": "depth first", > > "uniquness": "node", > > "return evaluator": > > { "language": "javascript", > > "body": "function shouldReturn( pos ) {...}" }, > > "prune evaluator": > > { "language": "javascript", > > "body": "function...." }, > > "relationships": [ > > { "direction": "outgoing", > > "type": "KNOWS" }, > > { "type": "LOVES" } > > ], > > "max depth": 4 } > > Looks good for my needs. Using javascript in this form looks sensible. > > Any idea about the performance implications of using a javax.scripting > language here? I guess not too severe. > As for javascript (Rhino engine at the moment) the code snippet will be compiled into java code the first time and then just rerun for consecutive calls. > > Is there any need for a shared context between calls to the evaluators? So > I > could store custom information and access it again when traversing further > nodes. So, you could passing a 'context' object (with its initial values) > that gets passed in as a second parameter to each evaluator function. Then > again, this is probably bad practice.... > We'll see what can be done about context and storing information in between calls, there's definately a need for that. > > Any idea how you will handle pagination? Obviously sorting is an issue as > you are unlikely to want the nodes in the traversal order. In my mind it > would be nice to allow the return evaluator to return a 'sorting value' > that > indicates that nodes rank in the result set. E.g. sorting on a score > attribute of the node: > > function shouldReturn(pos) > { > if (!some_condition) return false; > > return pos.currentNode().score; > } > > But I guess this is a comment on the Neo API as a whole? > > Cheers > > Al > _______________________________________________ > Neo mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user