Advertisement
Guest User

Untitled

a guest
May 1st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. MATCH (me:User {firstname: "Name"}), (me)-[:FRIEND]->(friend:User)<-[:FRIEND]-(potential:User), (me)-[:MEMBER]->(i:Interest)
  2. WHERE NOT (potential)-[:FRIEND]->(me)
  3. WITH COLLECT(DISTINCT potential) AS potentialFriends, COLLECT(DISTINCT friend) AS friends,
  4. COLLECT(i) as interests
  5.  
  6. UNWIND potentialFriends AS potential
  7.  
  8. /*
  9. @HANDLING_FINDINGS
  10. Here I count common friends, interests and try to find relationships between
  11. potential friends too -- hence the collect/unwind
  12. */
  13.  
  14. RETURN potential, commonFriends, commonInterests, (commonFriends+commonInterests) as
  15. totalPotential ORDER BY totalPotential DESC LIMIT 10
  16.  
  17. ...
  18. UNWIND potentialFriends AS potential
  19. CASE
  20. WHEN (count(potential) < 10 )
  21. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement