【发布时间】:2019-08-31 13:07:44
【问题描述】:
我正在寻找可以创建完整 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 字符串中重新水合一个图实例?
【问题讨论】:
-
您可以访问服务器吗?您使用的是哪个图形服务器?
-
感谢您的回复 - 我正在使用带有 TinkerGraph 的 gremlin 服务器,它在可通过上面的 localhost 连接字符串访问的虚拟机上运行。为了清楚起见,我已经编辑了问题
标签: javascript gremlin tinkerpop tinkerpop3 gremlin-server