How do I traverse this graph?

Skip to first unread message

Feb 5, 2015, 8:00:36 PM2/5/15
Hi group,

Been messing around with OrientDB for a while now, and I've done quite a number of queries in their SQL, but I cannot get real graph traversal to work. In the attachment is a graph structure that I have in my database, and I'm trying to traverse the yellow line.

My thinking is, I could start with a project (_id = 14) then traverse my way to the connected items?

I have been doing things like the below, but I either get only one item, none, or projects – I don’t want projects, as I was trying to get items.

traverse TYPE_Project.RELATIONSHIP_scopes, TYPE_PermissionNode.RELATIONSHIP_observedBy from (select * from type_project where _id) LIMIT 10 // returns project 14

SELECT expand(out('RELATIONSHIP_observedBy')) FROM (
  SELECT expand(out('RELATIONSHIP_scopes')) from TYPE_Project WHERE TYPE_Project._id = 14
)  limit 10 // returns nothing

select * from (
  traverse TYPE_Project.RELATIONSHIP_scopes, TYPE_PermissionNode.RELATIONSHIP_observedBy from (
    select from TYPE_Project WHERE _id = 14
  ) while $depth <= 3 and (@class = 'TYPE_Item')
) where @class = 'TYPE_Item' // returns nothing

(and so on and so forth, I’ve tried many things, I must just not be getting it)

So: how do I traverse this graph?

Your help much appreciated!

Thank you! Sander.


Feb 5, 2015, 8:32:49 PM2/5/15

Did you try:

SELECT expand( out('scopes').out('ObservedBy') ) FROM Project WHERE projectID=14


I think it will give you the Item ... However I don t know how to get all the info from all the traversed nodes (Project + PermissionNode + Item) but if someone can give the answer I need it :)


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
For more options, visit

Reply all
Reply to author
0 new messages