Probably the easiest way is to use the *0.. variable length path notation (0 or more); also, it's a good idea to put arrows in your queries:
MATCH (n:Variant { name:'variant2' })<-[:UPDATED_VARIANT*0..]-(v)--(a:Allele) RETURN n,v,a In cases where no :UPDATED_VARIANT relationship exists, n and v will be the same node. Wes On Tue, Jan 21, 2014 at 12:38 PM, Alex Frieden <a...@frieden.org> wrote: > Hi all, I have this graph. http://console.neo4j.org/r/2yadry (let me > know if that doesn't work) > create > (_6:Allele {name:"allele1"}), > (_7:Variant {name:"variant1"}), > (_8:Variant {name:"variant2"}), > _6-[:HAS_VARIANT]->_7, > _7-[:UPDATED_VARIANT]->_8 > > I want to be able to get the allele from any variant on the chain. So > this works: > > MATCH (n:Variant {name:'variant2'})-[:UPDATED_VARIANT]-(v)--(a:Allele) > RETURN n,v,a; > > however, if I don't want to start with the last one in the chain, it > doesn't work. > > How can I modify this so it returns the allele for any variant on the > chain. Thanks! > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to neo4j+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.