facebookarchive / pfff

Tools for code analysis, visualizations, or style-preserving source transformation.
http://github.com/facebook/pfff/wiki/Main
Other
2.44k stars 204 forks source link

Serializes graph from pfff to JSON (GraphSON) format #129

Open krishnavaidy opened 9 years ago

krishnavaidy commented 9 years ago

This is to facilitate serializing the graph from OCaml specific marshall format to formats which other languages can understand, using the piqi library. This pull request provides an interface: Graph_code_gsoninterface, from which add_node/add_edge or add_nodeinfo/add_edgeinfo can be called (instead of from Graph_code). In addition to creating graph_code.marshall, it creates a GraphSON object (https://github.com/thinkaurelius/faunus/wiki/GraphSON-Format) fully compliant with the Tinkerpop stack. This has been tested to work with TitanDB and presumably will work with graph databases supporting the Tinkerpop stack.

Writing the graphson file is done incrementally, by appending to a file. This is to make sure that performance doesn't take a beating.

Since the piqi library is used, graph_code could also be serialized to Protocol Buffers/XML/piq (piqi's own serialization format).

krishnavaidy commented 9 years ago

I think the tests fail because I use ocamlfind (for dependencies of the piqi). Is there a way to include ocamlfind in the tests, or do we need to get it to work without ocamlfind?