anirban chowdhury anirban chowdhury - 2 months ago 27
JSON Question

Titan DB graph to JSON

Is there a way to create JSON out of TitanDB graph?

I can load a Titangraph to graphml , and then load it on Gephi and output as gexf/json
using some plugins.
I was wondering if its possible to do this without involving Gephi at all, or as an alternative just use Gephi Java API to create the gexf/json.
I am partial to JSON since its of a smaller size.

Answer

You can use GraphSON as a JSON option. From the Titan Gremlin Console you should be able to do:

gremlin> g.saveGraphSON("/tmp/my-graph.json")

UPDATE: For Titan 1.0 and TinkerPop 3.x, the syntax changes given changes to the TinkerPop 3.x API:

gremlin> graph.io(graphson()).writeGraph("/tmp/graph.json")

Where "graph" above refers to a TitanGraph instance. There is more information about GraphSON in the TinkerPop 3 documentation found here