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

时间:2016-04-12 13:23:03

标签: orientdb

我想做什么

我希望能够运行像

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

然后将生成的顶点和边缘导入到一个新的数据库中,该数据库具有与第一个相同的模式。

我取得的成就

我有办法通过运行

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

然后将其导入新数据库。

我看过OETL,但无法弄清楚如何让它做我需要的事情。

1 个答案:

答案 0 :(得分:0)

So my approach to do this instead was to delete everything in the DB that wasn't in my traverse query.

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

This meant what was left was the schema I wanted and subset of the DB I wanted to export.

So a full export

export database TestDB

gave me what I wanted.