2017-02-22 44 views

回答

2

此時,所述cypher不允許使用一個變量作爲路徑長度。

如果你使用一個版本的neo4j> = 3,你可以使用apoc path expander

match()-[r:contents|next_seq]->(n:word) where r.seqid={seqid} 
with count(distinct n) as cnt 
match (a:word)-[rels:next_seq {seqid: {seqid}}]->(:word)) 
with distinct a 
call apoc.path.expand(a, 'next_seq', '+word', 1, cnt) yield path 
with path WHERE ALL(rt in relationships(path) where rt.seqid={seqid}) 
return last(nodes(path)).name as name