连接两个没有关系的节点意味着什么?
我写了下面三个查询,并试图理解这三个查询之间的区别。
查询1:
MATCH (person)-[r]->(otherPerson)
查询2:
MATCH (person)-->(otherPerson)
查询3:
MATCH (person)--(otherPerson)
请告诉我这三个查询之间是否有任何区别。
I have written below three queries and trying to understand difference between all 3 of them.
Query1:
MATCH (person)-[r]->(otherPerson)
Query2:
MATCH (person)-->(otherPerson)
Query3:
MATCH (person)--(otherPerson)
Please let me know if there is any difference between the three queries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查询 1 和 2 基本相同,您要求的是通过从
person
节点开始到otherPerson
节点结束的关系连接的所有节点。在查询 1 中,您还向实际关系r
添加别名/标签,这将允许您返回该关系。在查询 1 中,您可以执行在查询 2 中,您无法返回关系。
查询 3 与查询 2 类似,只不过您要求的是通过在
person
节点开始或结束以及在otherPerson
节点开始或结束的关系连接的所有节点。查询 1 和 2 将找到所有节点并给它们添加
person
标签。然后,它将删除所有出站关系并将连接的节点标记为otherPerson
。对于查询 1,该关系还将被赋予标签r
。查询 3 将匹配相同的模式,只不过它将遍历传入和传出边缘以查找
otherPerso
节点。Query 1 and 2 are basically the same, you are asking for all nodes connected by relationships that start at the
person
nodes and end at theotherPerson
node. In Query 1 you are also adding an alias/label to the actual relationshipr
that would allow you to return the relationship. In Query 1 you could doIn Query 2, you could not return the relationship.
Query 3 is similar to Query 2 except that you are asking for all nodes connected by relationships that start or end at the
person
nodes and start or end at theotherPerson
node.Query 1 and 2 will find all nodes and give them a label of
person
. It will then go out all outbound relationships and label the connected node asotherPerson
. In the case of Query 1 the relationship will also be given a label ofr
.Query 3 will match the same pattern except it will traverse both incoming and outgoing edges to find the
otherPerso
node.