Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypher: CREATE with bidirectional rel fails #1341

Closed
jotomo opened this issue Oct 21, 2013 · 6 comments
Closed

Cypher: CREATE with bidirectional rel fails #1341

jotomo opened this issue Oct 21, 2013 · 6 comments

Comments

@jotomo
Copy link
Contributor

jotomo commented Oct 21, 2013

neo4j-sh (0)$ create n<-[:r]->m;             
PatternException: Relationships need to have a direction when used to CREATE.
neo4j-sh (0)$ dbinfo -g Kernel KernelVersion
{"KernelVersion": "Neo4j - Graph Database Kernel 2.0.0-M06"}

I've tested with a snapshot of cypher.jar, but that didn't help.

@jexp
Copy link
Member

jexp commented Oct 21, 2013

There is no bidirectional relationship in Neo and this restriction was added to make relationship creation a more explicit concern.

@jexp jexp closed this as completed Oct 21, 2013
@cleishm
Copy link
Contributor

cleishm commented Oct 21, 2013

Relationships in Neo4j always have a direction, even though Cypher can ignore it by allowing you to specify directionless/bidirectional patterns. However, ‘CREATE` must actually create the relationship, and so requires the direction to be specified. Of course, you can still ignore it in all future queries.

Do you have any suggestion for how we could make that more clear in the error message or documentation?

@jotomo
Copy link
Contributor Author

jotomo commented Oct 22, 2013

Thanks for educating me on this :-) The console got me confused which accepts the synax (e.g. http://console.neo4j.org/r/a6rw5t), at closer inspecting I see it created a relationship from end node to start node - one direction. So I guess the console has a version of 2.0 that doesn't throw this error message.
About making the error message clearer, is unidirectional a term that's common enough to be understood?
e.g. Relationships need to be unidirectional when used to CREATE

@jexp
Copy link
Member

jexp commented Oct 22, 2013

Console doesn't yet run M06 as it depends on infrastructure that is no longer supported by M06.

@jotomo
Copy link
Contributor Author

jotomo commented Oct 23, 2013

@cleishm So if this is error is thrown only in M06+ then there are probably more people who are gonna see this message, so it'd be nice to have it be clear. How about this, a bit longer, but explains more as well Only directed relationships are supported in CREATE, while MATCH allows to ignore direction. Let me know what works and I'll open a PR :-)

@jexp
Copy link
Member

jexp commented Oct 24, 2013

Love it. Sounds like great message, please do Johannes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants