问题描述
http://console.neo4j.org/r/yx62bk
在上图中,查询
start n=node(7,8,9)
match n-[objectScore:score]->o-[:object_of_destination]->d<-[:destination_score]-n,
o-[:instance_of]->ot, o-[:date]->oDate, d-[:date]->dDate where ot.name='HOTEL'
return n, o, objectScore, d;
将o返回为空.
更改查询以删除关系标识符-objectScore
Change the query to remove relationship identifier - objectScore
start n=node(7,8,9)
match n-[:score]->o-[:object_of_destination]->d<-[:destination_score]-n,
o-[:instance_of]->ot, o-[:date]->oDate, d-[:date]->dDate where ot.name='HOTEL'
return n, o, objectScore, d;
并且输出正确返回o节点.
and the output returns o node correctly.
对于我的情况,我需要两个.不知道该怎么做?对此有任何建议.
For my scenario I need both of them. Not sure How to do that? Any suggestions on this.
推荐答案
很好的发现.我们在github上跟踪Cypher的问题,所以我在那打开了一个问题: https://github .com/neo4j/community/issues/837
Nice find. We track Cypher issues on github, so I've opened an issue about it there: https://github.com/neo4j/community/issues/837
非常感谢您举报!
我发现了问题.具有讽刺意味的是,一种简单的解决方法是引入可选关系.问题出在Cypher可以使用的匹配器之一中,并且通过将一部分图案标记为可选图案,您可以强制Cypher使用其他匹配器.如果您想
I've found the problem. A simple workaround is to, ironically, introduce an optional relationship. The problem is located in one of the matchers Cypher can use, and by marking a piece of your pattern as optional, you force Cypher to use a different matcher. If you want to
因此,将您的MATCH更改为此:
So, change your MATCH to this:
match n-[objectScore:score]->o-[:object_of_destination]->d<-[:destination_score]-n,
o-[:instance_of]->ot,
o-[:date]->oDate,
d-[?:date]->dDate
一个真正的解决方案正在研究之中.
A real fix is in the works.
这篇关于Neo4j Cypher版本1.8:带有关系标识符的可能的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!