简体   繁体   English

获取OrientDB中两个相邻节点的ID和属性

[英]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. 我正在尝试在Test1类的顶点和与之相邻的顶点之间执行联接,但是由于不允许使用关键字join因此出现了解析错误。 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 我试图显示沿关系Path的源节点和目标节点的ID,并获取两个顶点的名称

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. 检索两个相邻节点的所有元素的简单方法是使用bothV()函数。

Query: 查询:

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

Output: 输出:

在此处输入图片说明

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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