Cypher查询中的多个MATCH子句和逗号之间有什么区别? [英] What is the difference between multiple MATCH clauses and a comma in a Cypher query?

查看:554
本文介绍了Cypher查询中的多个MATCH子句和逗号之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Neo4j的Cypher查询语言中,紧跟另一个的MATCH子句之间有什么区别:

In a Cypher query language for Neo4j, what is the difference between one MATCH clause immediately following another like this:

MATCH (d:Document{document_ID:2})
MATCH (d)--(s:Sentence)
RETURN d,s

与同一MATCH子句中的逗号分隔模式相对?例如:

Versus the comma-separated patterns in the same MATCH clause? E.g.:

MATCH (d:Document{document_ID:2}),(d)--(s:Sentence)
RETURN d,s

在此简单示例中,结果是相同的。但是有任何陷阱吗?

In this simple example the result is the same. But are there any "gotchas"?

推荐答案

有一个区别:逗号分隔的匹配实际上被视为同一模式的一部分。因此,例如,这里保证了每个关系在结果路径中仅出现一次的保证。

There is a difference: comma separated matches are actually considered part of the same pattern. So for instance the guarantee that each relationship appears only once in resulting path is upheld here.

单独的MATCH是单独的操作,它们的路径不形成单个模式,并且不没有这些保证。

Separate MATCHes are separate operations whose paths don't form a single patterns and which don't have these guarantees.

这篇关于Cypher查询中的多个MATCH子句和逗号之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆