For one, the START syntax is old and has been removed from Neo4j for some time, so don't use it. This is an old answer using an old syntax.
Also, that Stack Overflow answer is flawed.
The reason for that is likely the confusing form of that question. Here, look at the two patterns noted in the question:
$ start n = node:users(username='user1') match n-[r:HAS_COMMENT] -> a return a;
from the user node (n), they want to get the comments (a) where the pattern (n)-[:HAS_COMMENT]->(a) exists.
and
$ start n = node:comments(_id='c101') match n-[r:HAS_COMMENT] -> a return a;
from the comment(!) (n), they want to get the user (a), their pattern here is wrong, since in this one it's looking for a :HAS_COMMENT relationship in the wrong direction (comments do NOT have outgoing :HAS_COMMENT relationships to users!)
Note that they changed their starting label, but kept the variables the same, so n
in the first query is for the user, but in the second query it's the comment! In the first query, a
is the comment, but in the second a
is now the user! Since they kept the variables the same, but didn't change their direction, it specified a pattern that doesn't exist, so they got no results back.
FrobberOfBits is actually a great answerer of Neo4j questions on Stack Overflow, but they typo'd a bit on this answer. Here's what they likely meant to put:
start n = node:comments(_id='c101') match n<-[r:HAS_COMMENT] - a return a;
start n = node:comments(_id='c101') match a-[r:HAS_COMMENT] -> n return a;
Note that in both cases n
is the comment, and a
is the user. The pattern can be specified in any order, as long as the relationship direction is going from a user (a) to a comment (n)