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

时间:2016-05-07 14:06:59

标签: orientdb graph-traversal nosql

我正在尝试在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

2 个答案:

答案 0 :(得分:1)

select in.name as name1, out.name as name2, in.@rid as id1, out.@rid as id2 from Path

答案 1 :(得分:1)

我有这个简单的数据集:

enter image description here

检索两个相邻节点的所有元素的简单方法可能是使用 $('#file_input').on('click', function(e){ e.preventDefault(); navigator.camera.getPicture(onSuccess, onFail, { quality: 100, destinationType: Camera.DestinationType.FILE_URI, sourceType: 2, // 1 for camera, 2 for gallery allowEdit: true, // Can edit the pictures and lets the user pick gallery app mediaType: Camera.MediaType.PICTURE, encodingType: Camera.EncodingType.JPEG, popoverOptions: CameraPopoverOptions, // targetWidth: 500, // targetHeight: 500, saveToPhotoAlbum: false, correctOrientation: true // false: switches the height and width }); }); function onSuccess(imageData) { // here I can upload imageData to the server } function onFail(message) { alert('Failed because: ' + message); } });函数。

<强>查询:

bothV()

<强>输出:

enter image description here

希望有所帮助