导出 Gremlin 数据库

Export of a Gremlin database

我想知道是否有任何方法可以导出 Gremlin 数据库及其所有 vertices/edges。最好输出是一个 Gremlin 遍历列表,如果需要可以再次完全(甚至部分)导入。

它是作为工具存在的还是存在于 TinkerPop 控制台客户端中?

自从我使用 CosmosDB 以来,我一直在尝试 Azure 的数据迁移工具,但它对我不起作用。使用 graphson() 对我也不起作用,但我可能一直在错误地使用它。

gremlin> graph.io(graphson()).writeGraph("/tmp/output.json");
No such property: graph for class: groovysh_evaluate

我不知道有任何工具可以执行此操作:

Preferably the output would be a list of Gremlin traversals that can be imported again completely (even partly) if needed.

我所知道的所有导出工具都可以导出为某种外部格式的文本或二进制格式。您必须通过编写一些 Gremlin 自己创建这样的功能,这些 Gremlin 将 return 数据以一种允许您在客户端上生成 StringBytecode 遍历表示的方式边。我认为您可以将其导出为边缘列表:

gremlin> g.V().has('person','name','marko').
......1>   outE().
......2>   project('edgeLabel','weight','inV','outV').
......3>     by(label).
......4>     by('weight').
......5>     by(inV().valueMap(true)).
......6>     by(outV().valueMap(true))
==>[edgeLabel:created,weight:0.4,inV:[id:3,label:software,name:[lop],lang:[java]],outV:[id:1,label:person,name:[marko],age:[29]]]
==>[edgeLabel:knows,weight:0.5,inV:[id:2,label:person,name:[vadas],age:[27]],outV:[id:1,label:person,name:[marko],age:[29]]]
==>[edgeLabel:knows,weight:1.0,inV:[id:4,label:person,name:[josh],age:[32]],outV:[id:1,label:person,name:[marko],age:[29]]]

或星图样式:

gremlin> g.V().has('person','name','marko').
......1>   project('v','edges').
......2>     by(valueMap(true)).
......3>     by(bothE().
......4>        project('e','inV','outV').
......5>          by(valueMap(true)).
......6>          by(valueMap(true)).
......7>          by(valueMap(true)))
==>[v:[id:1,label:person,name:[marko],age:[29]],edges:[e:[id:9,label:created,weight:0.4],inV:[id:9,label:created,weight:0.4],outV:[id:9,label:created,weight:0.4]]]

以上查询仅提供基本结构。您可以提出更好的形式、更有效的表示等,但所提供的数据提供了在客户端构建遍历所需的所有数据。