Riccardo, Maybe you had in mind something like this:
TRAVERSE out() FROM #9:0 UNTIL name ='2.3' where the *hypothetical* command UNTIL would mean "continue the traversal until some condition is met, and then stop" (including the vertices that match the UNTIL condition) ? For some use cases this would greatly simplify traversal operations I think, especially when the depth of the end-points cannot be known in advance. Cheers François On Friday, 18 September 2015 10:05:23 UTC+2, Riccardo Tasso wrote: > > Yeah, you right: now I see the point! > > Cheers, > Riccardo > > 2015-09-18 9:24 GMT+02:00 Luigi Dell'Aquila <[email protected] > <javascript:>>: > >> Hi Riccardo, >> >> your root node name is 'root', so it does not match your traversal >> condition ;-) >> Try with this: >> >> TRAVERSE out() FROM (SELECT FROM V WHERE name = 'root') WHILE name = '2.3' >> or $depth = 0 >> >> I hope I understood correctly your problem... the result will be the >> following: >> suppose you have this chain: >> >> A:'root' -> B:'2.3' -> C:'2.3' -> D:'something else' >> >> you will obtain >> A >> B >> C >> >> Luigi >> >> >> >> >> 2015-09-18 9:20 GMT+02:00 Riccardo Tasso <[email protected] >> <javascript:>>: >> >>> Hi, I am trying to understand the potential of TRAVERSE command ( >>> http://orientdb.com/docs/2.1/SQL-Traverse.html ). >>> >>> The documented examples, which all use the $depth context variable are >>> clear. >>> >>> I can't figure out how to use other variables, first of all $current. >>> Consider this toy-dataset: >>> >>> create database memory:tmp admin admin >>> insert into V set name = 'root' >>> insert into V set name = '1' >>> insert into V set name = '2' >>> insert into V set name = '1.1' >>> insert into V set name = '1.2' >>> insert into V set name = '2.1' >>> insert into V set name = '2.2' >>> insert into V set name = '2.3' >>> create edge from #9:0 to #9:1 >>> create edge from #9:0 to #9:2 >>> create edge from #9:1 to #9:3 >>> create edge from #9:1 to #9:4 >>> >>> I would expect to find something with those query, but no result is >>> returned: >>> TRAVERSE out() FROM (SELECT FROM V WHERE name = 'root') WHILE name = >>> '2.3' >>> TRAVERSE out() FROM (SELECT FROM V WHERE name = 'root') WHILE $current.name >>> = '2.3' >>> >>> Is there any possibility to stop the TRAVERSE with some condition on the >>> current vertex? >>> >>> Thanks, >>> Riccardo >>> >>> >>> -- >>> >>> --- >>> 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 [email protected] <javascript:>. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> >> --- >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
