SQL SELECT that returns specific properties from linked classes

Skip to first unread message


Oct 29, 2017, 1:01:31 PM10/29/17
to OrientDB
I'm looking for a suggestion on how to construct a SELECT statement that returns specific properties from linked classes.

I have a V class that can have one or more identical V classes linked via standard E edges. What I'm trying to do is select the "root" V class and have the query return properties from the first level of linked V classes. Selecting the "root" V class is simple, and that query does include the "out_" object that contains the RIDs for the linked V classes, but I can't figure out how to actually get data from the linked V classes (without doing a second query, which I what I'm trying to avoid). I feel like this is dirt-simple, but I'm missing some detail.

As a "bonus", it would go nice to optionally include specific properties from the link E edges, too.

Luigi Dell'Aquila

Oct 30, 2017, 3:59:13 AM10/30/17
to orient-...@googlegroups.com
Hi Eric,

With plain SELECT:

SELECT inV().vertexProp1, inV().vertexProp2, edgeProp1, edgeProp2 from (
    select expand(outE("TheEdgeClass")) FROM V WHERE foo = ?


   {class:V, as: theRootNode, where:(foo = ?)} .outE("TheEdgeClass"){as:theEdge} .inV() {as:firstLevel}
RETURN theEdge.prop1 as p1, theEdge.prop2 as p2, firstLevel.prop1, as p3, firstLevel.prop2 as p4




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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Oct 30, 2017, 11:02:23 AM10/30/17
to OrientDB
Works perfectly. Thanks!
Reply all
Reply to author
0 new messages