2015-11-04 45 views
0

我试图编写一个OSQL查询来计算所有节点对之间的最短路径的长度,但由于在FROM子句中有多个类是不允许的,所以我想知道我如何循环遍历所有不同的节点对。OrientDB:所有对最短路径

我试图与此查询:

SELECT shortestPath($current, $e0, 'BOTH', 'Meets') 
FROM Employee 
LET $e0 = (SELECT FROM Employee where $current.nt_account > $parent.nt_account) 

nt_account是雇员ID)。

当我尝试执行查询,我得到了以下错误:

java.lang.IllegalArgumentException: Vertex id can not be null 

任何人可以帮助我吗?

干杯!

回答

0

尝试此查询

select from (select $b.shortestPath from Employee let $b= (SELECT shortestPath($parent.current,@this, 'BOTH', 'Meets') from Employee)) unwind $b 
+0

它的运行,我的数据集是相当大的,因此会需要一些时间。如果我可能会问:'$ parent'和'$ parent.current'之间有什么不同?并从'$ current'和'@ this'?在此先感谢:) – Alberto

+0

在这种情况下,我认为使用$ current或@this没有区别。 关于$ parent和$ parent。$ current你可以看看这个链接http://orientdb.com/docs/2.1/SQL-Traverse.html#context –

+0

完美!非常感谢。 – Alberto