I'm looking for a single query that can create a GraphSON serialisation of a full TinkerGraph graph.
// setup
const gremlin = require('gremlin')
const connection = new gremlin.driver.DriverRemoteConnection('ws://localhost:8182/gremlin')
const g = (new gremlin.structure.Graph()).traversal().withRemote(connection)
I'm able to serialise vertices, edges and properties separately as GraphSON. The following statements create a GraphSON serialisation of all vertices only. Edges can be queried with E()
, and properties with V().properties()
.
// placed within an async function
const writer = new gremlin.structure.io.GraphSONWriter()
const serialisedVertices = writer.write(await g.V().toList())
Is there a gremlin-javascript method that will serialise all vertices, edges and properties together (rather than separately as above) into a GraphSON string in a single step?
Additionally if a full graph can be serialised as a single GraphSON string, is there also a matching invokation that will re-hydrate a graph instance from the GraphSON string?