如何提取和导入 OrientDB 图的一部分

How to extract and import a subsection of an OrientDB graph

我想做什么

我希望能够运行像

这样的查询
traverse * from Location while $depth < 5 limit 100

然后将生成的顶点和边导入到与第一个具有相同架构的新数据库中。

我的成就

我有一种方法可以通过 运行ning

复制架构
database export TestDB -includeClusterDefinitions=false -includeSecurity=false -includeRecords=false -includeIndexDefinitions=false -includeManualIndexes=false

然后将其导入新数据库。

想法

我查看了 OETL,但无法弄清楚如何让它执行我需要的操作。

所以我的方法是删除数据库中不在我的遍历查询中的所有内容。

delete vertex V where @rid not in (
    select @rid from (
        traverse * from Location while $depth < 5 limit 100
    )
) 

这意味着剩下的就是我想要的架构和我想要导出的数据库的子集。

所以完全导出

export database TestDB

给了我想要的。