Loading and writing data using GraphSON
The Tinkerpop GraphSON Reader can be used to load and write data.
-
Use the DSE Graph Loader to load the GraphSON file.
-
Writing data out of the graph into a GraphSON file while capturing the original data types of the inserted data can be accomplished with a short script:
gremlin> f = new FileOutputStream("/tmp/recipe_lossless.json"); mapper = graph.io(graphson()).mapper().embedTypes(true).create(); graph.io(graphson()).writer().mapper(mapper).create().writeVertex(f,g.V().next(),BOTH)
==>null
A sample of the output shows the class information and data types:
{ "@class":"java.util.HashMap", "id":{ "@class":"java.util.HashMap", "~label":"meal", "member_id":["java.lang.Long",25], "community_id":1989847424 }, "label":"meal",