为什么汤姆·汉克斯(Tom Hanks)在此密码查询中不返回? [英] Why isnt Tom Hanks returned in this cypher query?
问题描述
从Neo4j电影介绍中运行此视频时
When running this from the Neo4j movie intro
MATCH (tom:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors) RETURN coActors.name
我原本希望找回汤姆·汉克斯",因为他也匹配了match子句的右侧".
I was expecting to get "Tom Hanks" back since he also matches the "right side" of the match clause.
左侧匹配的节点为什么不右侧匹配?
How come a node matched on left side not matches on the right side?
推荐答案
在单个模式中多次匹配的关系将不包括在内.
左侧的(tom)-[:ACTED_IN]->(m)
匹配汤姆·汉克斯(Tom Hanks)与电影之间的ACTED_IN
关系.这种关系将在右侧不再匹配.
Relationships that are matched multiple times in a single pattern will not be included.
(tom)-[:ACTED_IN]->(m)
on the left matches the ACTED_IN
relationship from Tom Hanks to the movie. This relationship will not be matched again on the right hand side.
《 Neo4j手册》中的更多示例- http://neo4j.com/docs/stable/cypherdoc-uniqueness.html
Some more examples of this in the Neo4j Manual- http://neo4j.com/docs/stable/cypherdoc-uniqueness.html
这篇关于为什么汤姆·汉克斯(Tom Hanks)在此密码查询中不返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!