Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-05-2020 05:50 PM
Hello
I am working through the training dataset at https://guides.neo4j.com/sandbox/pole/index.html
I came across a query that I am not sure what it does and it isn't really explained. What does (friend) do on the first line of this query?
MATCH (p:Person)-[:KNOWS]-(friend)-[:PARTY_TO]->(:Crime)
WHERE NOT (p:Person)-[:PARTY_TO]->(:Crime)
RETURN p.name AS name, p.surname AS surname, p.nhs_no AS id, count(distinct friend) AS dangerousFriends
ORDER BY dangerousFriends DESC
LIMIT 5
05-05-2020 06:16 PM
I think figured it out. (friend) just appears to be an alias to whatever node the relationship between the person and knows points to.
05-06-2020 12:02 AM
Basically it is a dynamic variable name which you have given in the pattern to the node which are joined with a node have Label as Person with relationship as KNOWS and also the node is joined with Node having Label Crime relationship PARTY_TO
All the sessions of the conference are now available online