簡體   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