Have you tried: select from ( traverse out_HAS from #12:0 while $depth < 2 and name<http://current.name/> <> 'gmail_with_attachments.pcap')
Lvc@ On 19 February 2014 19:12, Andrey Yesyev <[email protected]> wrote: > Hi there, > > I was playing with traverse and couldn't figure out the logic of WHILE. > This is what I found in docs: > > *while <https://github.com/orientechnologies/orientdb/wiki/SQL-Where>* > condition > to continue the traversing while it's true. Usually it's used to limit the > traversing depth by using $depth < <x> where x is the maximum level of > depth you want to reach. *$depth* is the first context variable that > reports the depth level during traversal. > Pretty straight forward, but then I tried to query DB > > select from ( traverse out_HAS from #12:0 while $depth < 2) > > Got the result > > > @rid @version @class name in_HAS out_HAS > #12:0<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/12:0>7Casedemo[1][5] > #13:0<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/13:0>2Collectiongmail_with_attachments.pcap[1] > #13:1<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/13:1>2Collectionmysql_import_cc.pcap[1] > #13:2<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/13:2>2Collectionmysql_import_emails.pcap[1] > #13:3<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/13:3>2Collectiontelnet_cat_emial_list.pcap[1] > #13:4<http://localhost:2480/studio/index.html#/database/ePersona/browse/edit/13:4>2Collectiondemo_stream[1] > Which is perfectly correct. > Now I want to stop traversing, as soon as I reach vertex with the > name=gmail_with_attachments.pcap. > I assume it should look like this > > select from ( traverse out_HAS from #12:0 while $depth < 2 and $ > current.name <> 'gmail_with_attachments.pcap') > > But no, it doesn't work. I'm getting > > No records found. > > What's the problem? > > -Andrey > > > > -- > > --- > 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/groups/opt_out. > -- --- 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/groups/opt_out.
