Neo4j Cypher version 1.8 : Probable bug with relationship identifiers

泪湿孤枕 提交于 2020-01-02 06:01:31

问题


http://console.neo4j.org/r/yx62bk

In the graph above, the query

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;

returns o as null.

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;

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.


回答1:


Nice find. We track Cypher issues on github, so I've opened an issue about it there: https://github.com/neo4j/community/issues/837

Thanks so much for reporting it!

Edit: 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

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.



来源:https://stackoverflow.com/questions/12200889/neo4j-cypher-version-1-8-probable-bug-with-relationship-identifiers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!