I'm beginning to work with orientDB, have hit a roadblock, and by this point, the docs are just blowing my mind.
I am trying to query an orientDB instance, and return the response as graphJSON, in order to visualise that in a d3.js based UI. I have tried various things from my java app, and can retrieve json for individual edges & vertices returned:
List<ODocument> result = graph.getRawGraph().query(
new OSQLSynchQuery("traverse * from 12:0 while $depth<=6"));
...
System.out.println("json doc = " + doc.toJSON());
or I can retrieve graphJSON for the entire graph:
GraphSONWriter writer = new GraphSONWriter(graph);
writer.outputGraph(outputStream, vertexPropertyKeys, edgePropertyKeys, EXTENDED);
as well as various other efforts.
Is there a way to subset the graph in the 2nd example? Should I try to combine all of the indivdual JSON results into a single graphJSON file? Should I attempt to create a new, temporary, graph from the result of my query & feed that into GraphSONWriter?
Thanks for your help.
Update
to get started, I went with the 1st approach, then iterated over the resulting list, building up my own graphJSON. Seems like a pretty nasty solution, but it has unblocked a couple of other stories & got us going (introducing tech debt on the way). I did try the 2nd option, but even returning the full graph, the 'graphJSON' that it output didn't seem to be standard (or at least didn't match our d3 library's interpretation). Seems like a non starter.
Any suggestions would be very welcome - gremlin?