|Cypher: dynamic START clauses? (ID or index query)||Aseem Kishore||12/24/12 12:43 PM|
Is there any way to have a dynamic START clause, where the node/rel ID or index query comes from a preceding WITH?
(You can of course parametrize the START clause; I mean where the value isn't known in advance, but rather derived within the query itself.)
Here's the scenario I'm thinking of: node A is a supernode with a million relationships of type X, and just one of type Y. We want to follow the Y relationship efficiently.
We could use a global relationship index to index that Y relationship with something associating it to node A.
But in the spirit of graph databases ("index-free adjacency"), I was wondering why not store the Y relationship's ID as a property on node A? Then you could efficiently fetch the Y relationship if you had node A.
I presume I could do this in Gremlin, but I was hoping it'd be possible in Cypher. Something like:
WITH n, n.yRelId as yRelId
MATCH n -[r]-> foo
(I'm assuming btw that `MATCH n -[r]-> foo` will be optimized to not scan all of n's relationships if `r` is already a START point. I hope that's indeed the case?)
If this isn't possible today, please consider this a feature request. =) Happy to file an issue if so.
|Re: [Neo4j] Cypher: dynamic START clauses? (ID or index query)||Michael Hunger||12/24/12 2:14 PM|
Right now, neither node() nor relationship() take expressions as parameters, I think that is a sensible feature request, please file it on GitHub