简体   繁体   中英

Getting the IDs and the attributes of two adjacent nodes in OrientDB

I am trying to perform a join between the vertices in the Test1 class and the ones that are adjacent to them, but I'm getting a parsing error since the keyword join is not allowed. I am trying to show both IDs of the source and destination nodes along the relation Path , and to get the names of the two vertices

select @rid as P, name as N from Test1 join 
   (select @rid as R, name as M from (select expand(out('Path')) from Test1)) 
   on t.P=u.R

Update:

I tried the following solution, but all the elements are packed in a collection, while in my case I would like to perform a cartesian product:

select @rid, out('Path').@rid as rid2, name, out('Path').name as name2 from Test1
select in.name as name1, out.name as name2, in.@rid as id1, out.@rid as id2 from Path

I have this simple dataset:

在此处输入图片说明

a simple way to retrieve all the elements of two adjacent nodes could be the usage of the bothV() function.

Query:

SELECT expand(bothV('TestClassEdge')) FROM TestClassEdge

Output:

在此处输入图片说明

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM