Hello everybody, I've built a litte social network based on some characters from the Simpsons. There's Lisa, Bart, Maggie, Homer, Marge and their grandparents Abe and Jackie. I set up the characters as nodes in the graph, they have tha class "figure", there a differnt types of edges for each kind of relationship, in thes example it is the edge class "parent". Marge and Homer are parents of Lisa, Bart and Maggie. Abe is the parent of Homer and Jackie the parent of Marge. So all together we get a little family tree.
Now I want to find out who Lisa's grandparents are. So I'm matching Lisa and two traversals of the parent type in reverse direction or if you want so I'm looking for the parents of Lisa's parents. Works fine using this syntax: MATCH {class:figure, as: lisa, where: (name= "Lisa Simpson")} .in("parent"){class: figure} .in("parent"){class: figure, as: person} RETURN person.name But now if I try with just one Edge definded and using the while condition to loop traversals I get: MATCH {class:figure, as: lisa, where: (name= "Lisa Simpson")} .in("parent"){class: figure, as: person, while: ($matched.depth < 2), where:(matched.depth != 0 AND $matched.depth != 1) } RETURN person.name If I get it right how this works, Lisa is at depth level 0 as initial node, her parents have to be at level 1 and her grandparents at level 2. The while condition seems to work like a do while loop. I figured this out by quering Lisas parents using "$matched.depth < 1" and it still return Lisa and her parents and not just Lisa. So $matched.depth < 2 should be fine. In the where clause I have to write "matched.depth != 0 AND $matched.depth != 1" because it doesn't return anything if I write "$matched.depth == 2" or "$matched.depth > 1" and I don't get why. Does anyone know why? Also returning the depth of each ancestor using $depth in the return statement doesn't work. It gets me a depth of 2 for all. Am I missing anything or what is this behaviour? Another thing I still don't clearly get is the difference between matched and currentMatch. Using matched.depth, currentMatch.depth or depth gets me the same results. Thank you! -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.