Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- R={"1","9","7"}
- C={
- "1.1","1.5","1.2"--------BELONGS TO "1"
- "7.1","7.4","7.3"--------BELONGS TO "7"
- "9.7","9.2","9.4"--------BELONGS TO "9"
- }
- S={
- "1.1.1","1.1.4","1.1.3" --------BELONGS TO "1.1"
- "1.5.7","1.5.3","1.5.6" --------BELONGS TO "1.5"
- "1.2.7","1.2.4","1.2.8" --------BELONGS TO "1.2"
- .................................etc
- }
- MATCH (c:C)
- MATCH (r:R)
- WHERE
- (c)-[:IS_A_C_BELONGING_TO*]->(r)
- WITH r
- MATCH (c:C)-[:IS_A_C_BELONGING_TO*]->(r)-[*0..1]-(s:S)
- WITH r,collect(DISTINCT c) as cList, collect(DISTINCT s) as sList
- WITH r.name as rName,[c in cList | c.cName] as cNameList, [s in sList | s.sName] as sNameList
- ORDER BY rName
- UNWIND cNameList as x
- WITH sNameList,rName,x ORDER BY x
- UNWIND sNameList as y
- WITH x,rName,y ORDER BY y
- return rName as rNames,collect(DISTINCT x) as cNames,collect(DISTINCT y) as sNames ORDER BY rName
- "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"}
- "7"-----------------{"7.1","7.3","7.4"}--------------{.........................................................................}
- "9"-----------------{"9.2","9.4","9.7"}--------------{.........................................................................}
- What I want is a List of sorted List with sorted elements
- ========================================================
- "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"]}
- "7"-----------------{["7.1"],["7.3"],["7.4"]}--------------{.........................................................................}
- "9"-----------------{["9.2"],["9.4"],["9.7"]}--------------{.........................................................................}
- WITH r,collect(DISTINCT c) as cList, collect(DISTINCT s) as sList
- WITH r,collect(DISTINCT c) as cList, collect(DISTINCT [s]) as sList
- [s in sList | s.sName] as sNameList
- [[s] in sList | xxxxxxxxxxxxxxxxx] as sNameList
Add Comment
Please, Sign In to add comment