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

查看:22
本文介绍了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天全站免登陆