获取OrientDB中相邻两个节点的ID和属性
Getting the IDs and the attributes of two adjacent nodes in OrientDB
我正在尝试在 Test1 class 中的顶点和与它们相邻的顶点之间执行连接,但我遇到了解析错误,因为关键字 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
输出:
希望对您有所帮助
我正在尝试在 Test1 class 中的顶点和与它们相邻的顶点之间执行连接,但我遇到了解析错误,因为关键字 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
输出:
希望对您有所帮助