使用 gremlin-javascript 将完整图形序列化为 GraphSON 的最佳方法是什么?

我正在寻找可以创建完整 TinkerGraph 图的 GraphSON 序列化的单个查询。


// setup


const gremlin = require('gremlin')


const connection = new gremlin.driver.DriverRemoteConnection('ws://localhost:8182/gremlin')


const g = (new gremlin.structure.Graph()).traversal().withRemote(connection)

我能够像 GraphSON 一样分别序列化顶点、边和属性。以下语句仅创建所有顶点的 GraphSON 序列化。可以使用 查询边,使用 查询E()属性V().properties()。


// placed within an async function


const writer = new gremlin.structure.io.GraphSONWriter()


const serialisedVertices = writer.write(await g.V().toList())

是否有一个 gremlin-javascript 方法可以在一个步骤中将所有顶点、边和属性一起(而不是像上面那样分开)序列化为一个 GraphSON 字符串?


此外,如果完整图可以序列化为单个 GraphSON 字符串,是否还有匹配的调用可以从 GraphSON 字符串中重新水合图实例?


PIPIONE
浏览 182回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript