我正在寻找可以创建完整 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 字符串中重新水合图实例?
相关分类