在 Cypher 查询中结束 UNWIND 语句 [英] End UNWIND statement in a Cypher Query
本文介绍了在 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 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文