filtering edge by property during traverse

149 views
Skip to first unread message

john davids

unread,
Jan 22, 2015, 7:34:07 AM1/22/15
to orient-...@googlegroups.com
Hello,

I'm new to OrientDB. 
I have a simple OrientDB database with Classes and one type of relationship between them. 
Even if is one type of Edge we decided to use a 'type' attribute for the Edge that differentiates between them.

Class0 --has a--> Class1
Class1 --has a--> Class2
Class1 --is a--> Class3


I'm interested to start traversing the graph from Class0 vertex (with id #12:7), but only following the relations that have the 'type' attribute 'has a'.
So the result should be Class0, Class1, Class2

I'm not managing to find a correct 'while' clause...

Something like this is obviously not ok
traverse outE(), out() from #12:7 while (@class = 'Class' or (@class = 'Relation' and outE().type = 'has a'))

Any hints for me pls?
Thank you!

john davids

unread,
Jan 22, 2015, 9:31:52 AM1/22/15
to orient-...@googlegroups.com
I found a solution and seems to be working. Could you please validate it? I'm afraid not to fool myself with the solution

select from (traverse * from #12:7 while (type= 'type of' or type is null))

The type is null clause is put because the vertices don't have the type property.
Reply all
Reply to author
Forward
0 new messages