Advertisement
Guest User

Untitled

a guest
May 1st, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 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,
  4. COLLECT(DISTINCT friend) AS friends,
  5. COLLECT(i) as interests
  6.  
  7. UNWIND potentialFriends AS potential
  8.  
  9. /*
  10. @HANDLING_FINDINGS
  11. Here I count common friends, interests and try to find relationships between
  12. potential friends too -- hence the collect/unwind
  13. */
  14.  
  15. RETURN potential,
  16. commonFriends,
  17. commonInterests,
  18. (commonFriends+commonInterests) as totalPotential
  19. ORDER BY totalPotential DESC
  20. LIMIT 10
  21.  
  22. ...
  23. UNWIND potentialFriends AS potential
  24. CASE
  25. WHEN (count(potential) < 10 )
  26. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement