I have a cypher code that goes like this :
start n=node(*)
match p=n-[r:OWES*1..200]->n
return extract(s in relationships(p) : s.amount),
extract(t in nodes(p) : t.name),
length(p)
The query gives back nodes in a closed circle connected with relation OWES up to 200 level deep . The results given are :
2
[155.55, 100641359]
[LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ ]
2
[100641359, 155.55]
[SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , SASA ]
3
[100641359, 100641367, 550111.55]
[SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , ADVOKAT KOSTIC JEVREM VRBAS , SASA ]
3
[100641367, 550111.55, 100641359]
[LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , ADVOKAT KOSTIC JEVREM VRBAS , SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ ]
3
[550111.55, 100641359, 100641367]
[ADVOKAT KOSTIC JEVREM VRBAS , SASA , LJUBOJEVIC STR I PRZIONA KAFE VL.LJ , ADVOKAT KOSTIC JEVREM VRBAS ]
So I get my results returning more times , if it is 3 relations level I get 3 results , 2 I get 2 same results in diferent order .How to change my cypher to get result only once for one path by not giving up from * in a cypher . If not in cypher can I handle this some way in Java .
This is using Cypher 2.0 because I'm making use of the STARTNODE function.
It is a bit of a monstrosity, but it works. I wouldn't use it without adding some serious constraints to keep the overall collection size down.
Results: Detailed Query Results Query Results