问题
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