Unbounded variable length paths do not match if the path length is zero

19 views
Skip to first unread message

Byron Ruth

unread,
Dec 11, 2014, 7:35:03 PM12/11/14
to ne...@googlegroups.com
The query:

MATCH (n)-[:foo*]->()

will not match if n does not have at least one foo relationship. However, explicitly setting the lower bound to 0 works:

MATCH (n)-[:foo*0..1000]->()

Was this an intentional design? Using an asterisk to impose "at least one" is a bit non-conventional at least in the regular expression space.

Michael Hunger

unread,
Dec 11, 2014, 8:13:20 PM12/11/14
to ne...@googlegroups.com
Yes that was intentional. As the case that the start-node itself should be included (again) in that path is a more special case.

You're right that coming from regexp that might be confusing, but so far I've never heard/had hat association.

The star just is for "variable".

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Byron Ruth

unread,
Dec 11, 2014, 9:36:31 PM12/11/14
to ne...@googlegroups.com, ne...@googlegroups.com
Thank you for the response. I guess the "variable" aspect is confusing when the zero isn't included in the set. 




You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/0xl24nDApN0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages