Guest User

Untitled

a guest
Jul 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. R={"1","9","7"}
  2.  
  3. C={
  4. "1.1","1.5","1.2"--------BELONGS TO "1"
  5. "7.1","7.4","7.3"--------BELONGS TO "7"
  6. "9.7","9.2","9.4"--------BELONGS TO "9"
  7. }
  8.  
  9. S={
  10. "1.1.1","1.1.4","1.1.3" --------BELONGS TO "1.1"
  11. "1.5.7","1.5.3","1.5.6" --------BELONGS TO "1.5"
  12. "1.2.7","1.2.4","1.2.8" --------BELONGS TO "1.2"
  13. .................................etc
  14. }
  15.  
  16. MATCH (c:C)
  17. MATCH (r:R)
  18. WHERE
  19. (c)-[:IS_A_C_BELONGING_TO*]->(r)
  20. WITH r
  21. MATCH (c:C)-[:IS_A_C_BELONGING_TO*]->(r)-[*0..1]-(s:S)
  22.  
  23. WITH r,collect(DISTINCT c) as cList, collect(DISTINCT s) as sList
  24.  
  25. WITH r.name as rName,[c in cList | c.cName] as cNameList, [s in sList | s.sName] as sNameList
  26. ORDER BY rName
  27.  
  28. UNWIND cNameList as x
  29. WITH sNameList,rName,x ORDER BY x
  30. UNWIND sNameList as y
  31. WITH x,rName,y ORDER BY y
  32. return rName as rNames,collect(DISTINCT x) as cNames,collect(DISTINCT y) as sNames ORDER BY rName
  33.  
  34. "1"---------------- {"1.1","1.2","1.5"}--------------{"1.1.1","1.1.3","1.1.4", "1.2.4","1.2.7","1.2.8","1.5.3","1.5.6","1.5.7"}
  35.  
  36.  
  37. "7"-----------------{"7.1","7.3","7.4"}--------------{.........................................................................}
  38.  
  39. "9"-----------------{"9.2","9.4","9.7"}--------------{.........................................................................}
  40.  
  41.  
  42. What I want is a List of sorted List with sorted elements
  43. ========================================================
  44.  
  45. "1"---------------- {["1.1"],["1.2"],["1.5"]}--------------{["1.1.1","1.1.3","1.1.4"], ["1.2.4","1.2.7","1.2.8"],["1.5.3","1.5.6","1.5.7"]}
  46.  
  47.  
  48. "7"-----------------{["7.1"],["7.3"],["7.4"]}--------------{.........................................................................}
  49.  
  50. "9"-----------------{["9.2"],["9.4"],["9.7"]}--------------{.........................................................................}
  51.  
  52. WITH r,collect(DISTINCT c) as cList, collect(DISTINCT s) as sList
  53.  
  54. WITH r,collect(DISTINCT c) as cList, collect(DISTINCT [s]) as sList
  55.  
  56. [s in sList | s.sName] as sNameList
  57.  
  58. [[s] in sList | xxxxxxxxxxxxxxxxx] as sNameList
Add Comment
Please, Sign In to add comment