Cypher to traverse back to original relations does not work

Following cypher does not work, Can anyone please throw some light? thanks.

MATCH (u:`user`)
  WHERE ID(u)=111 
  MATCH (u)<-[:`manager`]-(`subordinates`)-[:`manager`]->(`subordinates.manager`)
  RETURN 
    `subordinates.manager`

this does not return anything, I am expecting it to return the user with id 111

following cypher works,

MATCH (u:`user`)
  WHERE ID(u)=111 
  MATCH (u)<-[:`manager`]-(`subordinates`)
  MATCH (`subordinates`)-[:`manager`]->(`subordinates.manager`)
  RETURN 
    `subordinates.manager`

Hi,

Why aren't u just querying like:

MATCH (u:`user`)
WHERE ID(u)=111 
RETURN u

In any case, using ID is not suggested.

Your query is trying to find 2 different persons managed by subordinates tho.

H

Thanks for the reply. My question was around `

This path traversal does not go back to origin. I assume this is intentional by neo4j devs and wanted to know rationals behind this.

Hi Amit,

you have one user and you want to find all the subordinates (actually only one level below) and from those subordinates the managers (which means there is more than one manager for some subordinates) and you want to insure the given user is in the list of the managers.

In cypher, you will query like this:

MATCH (u:user)<-[:has_manager]-(s:subordinate)
WHERE ID(u)=111 
with s
MATCH (s)-[:has_manager]->(m:manager)
RETURN m.name 

Pay attention that user, manager and subordinate are labels. has_manager is a relationship type. You read the whole according to the arrow direction. Therefore I change the relationship from "manager" to a verb to have it like a sentence:
(some:subordinate)-[:has_manager]->(one:manager)
and
(one:manager)<-[:has_manager]-(some:subordinate)
are exactly the same.