本文介绍了在Cypher查询中结束UNWIND语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有一个解开参数的密码查询,则该查询部分之后的所有内容都称为解开次数的x倍.我想找出一种方法来结束放松并继续做其他事情.
If I have a cypher query that unwinds a parameter, everything after that portion of the query is called x number of times of the unwind. I'd like to figure out a way to end the unwind and continue with other things.
MATCH (thing:Thing)
UNWIND { names } AS name
CREATE thing-[:HAS_NAME]-(n:Name {name: name})
//done with the unwind
WITH (thing)
CREATE thing[:HAS_AGE]-(a:Age {age: 20})
在上面的示例中,由于展开,我将得到两个东西-[:HAS_AGE]->()关系.我必须将其拆分为单独的语句吗?
In the above example, I will end up with two thing-[:HAS_AGE]->() relationships because of the unwind. Do I have to split this into separate statements?
推荐答案
展开后,您会有两行.如果您在继续前进之前重新折叠thing
,则您将再次拥有一张.
After the unwind you have two rows. If you re-collapse thing
before moving on you will then have a single again.
MATCH (thing:Thing)
UNWIND { names } AS name
CREATE thing-[:HAS_NAME]-(n:Name {name: name})
//done with the unwind
WITH distinct thing
CREATE thing[:HAS_AGE]-(a:Age {age: 20})
这篇关于在Cypher查询中结束UNWIND语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!