繁体   English   中英

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

[英]Getting the IDs and the attributes of two adjacent nodes in OrientDB

我正在尝试在Test1类的顶点和与之相邻的顶点之间执行联接,但是由于不允许使用关键字join因此出现了解析错误。 我试图显示沿关系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

更新:

我尝试了以下解决方案,但是所有元素都打包在一个集合中,而在我的情况下,我想执行笛卡尔积:

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

我有这个简单的数据集:

在此处输入图片说明

检索两个相邻节点的所有元素的简单方法是使用bothV()函数。

查询:

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

输出:

在此处输入图片说明

希望能帮助到你

暂无
暂无

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

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