You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/08/13 22:03:34 UTC
[17/22] incubator-tinkerpop git commit: Added FaunusGraphSONUtility -
based loosely on same from Aurelius Faunus project - to be merged into
TP2GraphSONUtility as the adjacency list functionality provider
Added FaunusGraphSONUtility - based loosely on same from Aurelius Faunus project - to be merged into TP2GraphSONUtility as the adjacency list functionality provider
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/b92cd799
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/b92cd799
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/b92cd799
Branch: refs/heads/tp30-legson
Commit: b92cd799ea9eb2502bbd46906f1796bddf9b21cd
Parents: 8119bc8
Author: ebice <eb...@behaviormatrix.com>
Authored: Tue Jul 7 17:17:23 2015 -0400
Committer: ebice <eb...@behaviormatrix.com>
Committed: Tue Jul 7 17:17:23 2015 -0400
----------------------------------------------------------------------
.../io/graphson/FaunusGraphSONUtility.java | 172 +++++++++++++++++++
.../io/graphson/GraphSONLegacyWriter.java | 82 +++++++--
.../structure/IoDataGenerationTest.java | 43 ++++-
3 files changed, 274 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b92cd799/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/FaunusGraphSONUtility.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/FaunusGraphSONUtility.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/FaunusGraphSONUtility.java
new file mode 100644
index 0000000..e40a77f
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/FaunusGraphSONUtility.java
@@ -0,0 +1,172 @@
+package org.apache.tinkerpop.gremlin.structure.io.graphson;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.TP2GraphSONUtility.ElementFactory;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.TP2GraphSONUtility.GraphSONMode;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.codehaus.jettison.json.JSONTokener;
+import org.javatuples.Pair;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.*;
+
+import static org.apache.tinkerpop.gremlin.structure.Direction.IN;
+import static org.apache.tinkerpop.gremlin.structure.Direction.OUT;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Edi Bice
+ */
+public class FaunusGraphSONUtility {
+
+ //private static final String _OUT_E = "_outE";
+ //private static final String _IN_E = "_inE";
+ private static final String EMPTY_STRING = "";
+
+ private static final Set<String> VERTEX_IGNORE = new HashSet<String>(Arrays.asList(GraphSONTokensTP2._TYPE, GraphSONTokensTP2._OUT_E, GraphSONTokensTP2._IN_E));
+ private static final Set<String> EDGE_IGNORE = new HashSet<String>(Arrays.asList(GraphSONTokensTP2._TYPE, GraphSONTokensTP2._OUT_V, GraphSONTokensTP2._IN_V));
+
+ private static final ElementFactory elementFactory = new MyElementFactory();
+
+ private static final TP2GraphSONUtility graphson = new TP2GraphSONUtility(GraphSONMode.COMPACT, elementFactory,
+ ElementPropertyConfig.excludeProperties(VERTEX_IGNORE, EDGE_IGNORE));
+
+ public static List<Vertex> fromJSON(final InputStream in) throws IOException {
+ final List<Vertex> vertices = new LinkedList<Vertex>();
+ final BufferedReader bfs = new BufferedReader(new InputStreamReader(in));
+ String line = "";
+ while ((line = bfs.readLine()) != null) {
+ vertices.add(FaunusGraphSONUtility.fromJSON(line));
+ }
+ bfs.close();
+ return vertices;
+
+ }
+
+ public static Vertex fromJSON(String line) throws IOException {
+ try {
+ final JSONObject json = new JSONObject(new JSONTokener(line));
+ line = EMPTY_STRING; // clear up some memory
+
+ final Vertex vertex = graphson.vertexFromJson(json);
+
+ fromJSONEdges(vertex, json.optJSONArray(GraphSONTokensTP2._OUT_E), OUT);
+ json.remove(GraphSONTokensTP2._OUT_E); // clear up some memory
+ fromJSONEdges(vertex, json.optJSONArray(GraphSONTokensTP2._IN_E), IN);
+ json.remove(GraphSONTokensTP2._IN_E); // clear up some memory
+
+ return vertex;
+ } catch (Exception e) {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ private static void fromJSONEdges(final Vertex vertex, final JSONArray edges, final Direction direction) throws JSONException, IOException {
+ if (null != edges) {
+ for (int i = 0; i < edges.length(); i++) {
+ final JSONObject jsonEdge = edges.optJSONObject(i);
+ Edge edge = null;
+ if (direction.equals(Direction.IN)) {
+ DetachedVertex outVertex = new DetachedVertex(jsonEdge.optLong(GraphSONTokensTP2._OUT_V),null,new HashMap<>());
+ edge = graphson.edgeFromJson(jsonEdge, outVertex, vertex);
+ outVertex.addEdge(jsonEdge.optString(GraphSONTokensTP2._LABEL), vertex);
+ } else if (direction.equals(Direction.OUT)) {
+ DetachedVertex inVertex = new DetachedVertex(jsonEdge.optLong(GraphSONTokensTP2._IN_V),null,new HashMap<>());
+ edge = graphson.edgeFromJson(jsonEdge, vertex, inVertex);
+ vertex.addEdge(jsonEdge.optString(GraphSONTokensTP2._LABEL), inVertex);
+ }
+ }
+ }
+ }
+
+ public static JSONObject toJSON(final Vertex vertex) throws IOException {
+ try {
+ final JSONObject object = TP2GraphSONUtility.jsonFromElement(vertex, getElementPropertyKeys(vertex, false), GraphSONMode.COMPACT);
+
+ // force the ID to long. with blueprints, most implementations will send back a long, but
+ // some like TinkerGraph will return a string. the same is done for edges below
+ object.put(GraphSONTokensTP2._ID, Long.valueOf(object.remove(GraphSONTokensTP2._ID).toString()));
+
+ List<Edge> edges = (List<Edge>) vertex.edges(OUT);
+ if (!edges.isEmpty()) {
+ final JSONArray outEdgesArray = new JSONArray();
+ for (final Edge outEdge : edges) {
+ final JSONObject edgeObject = TP2GraphSONUtility.jsonFromElement(outEdge, getElementPropertyKeys(outEdge, true), GraphSONMode.COMPACT);
+ outEdgesArray.put(edgeObject);
+ }
+ object.put(GraphSONTokensTP2._OUT_E, outEdgesArray);
+ }
+
+ edges = (List<Edge>) vertex.edges(IN);
+ if (!edges.isEmpty()) {
+ final JSONArray inEdgesArray = new JSONArray();
+ for (final Edge inEdge : edges) {
+ final JSONObject edgeObject = TP2GraphSONUtility.jsonFromElement(inEdge, getElementPropertyKeys(inEdge, false), GraphSONMode.COMPACT);
+ inEdgesArray.put(edgeObject);
+ }
+ object.put(GraphSONTokensTP2._IN_E, inEdgesArray);
+ }
+
+ return object;
+ } catch (JSONException e) {
+ throw new IOException(e);
+ }
+ }
+
+ private static Set<String> getElementPropertyKeys(final Element element, final boolean edgeIn) {
+ final Set<String> elementPropertyKeys = new HashSet<String>(element.keys()); // .getPropertyKeys());
+ elementPropertyKeys.add(GraphSONTokensTP2._ID);
+ if (element instanceof Edge) {
+ if (edgeIn) {
+ elementPropertyKeys.add(GraphSONTokensTP2._IN_V);
+ } else {
+ elementPropertyKeys.add(GraphSONTokensTP2._OUT_V);
+ }
+
+ elementPropertyKeys.add(GraphSONTokensTP2._LABEL);
+ }
+
+ return elementPropertyKeys;
+ }
+
+ private static class MyElementFactory implements ElementFactory<Vertex, Edge> {
+
+ @Override
+ public Edge createEdge(final Object id, final Vertex out, final Vertex in, final String label) {
+ Pair<Object, String> outPair = new Pair<Object, String>(out.id(), out.label());
+ Pair<Object, String> inPair = new Pair<Object, String>(in.id(), in.label());
+ return new DetachedEdge(id, label, Collections.EMPTY_MAP, outPair, inPair);
+ }
+
+ @Override
+ public DetachedVertex createVertex(final Object id) {
+ return new DetachedVertex(convertIdentifier(id), null, new HashMap<>());
+ }
+
+ private long convertIdentifier(final Object id) {
+ if (id instanceof Long)
+ return (Long) id;
+
+ long identifier = -1l;
+ if (id != null) {
+ try {
+ identifier = Long.parseLong(id.toString());
+ } catch (final NumberFormatException e) {
+ identifier = -1l;
+ }
+ }
+ return identifier;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b92cd799/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONLegacyWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONLegacyWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONLegacyWriter.java
index c47c806..b032a85 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONLegacyWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONLegacyWriter.java
@@ -68,12 +68,14 @@ public class GraphSONLegacyWriter {
* @param vertexPropertyKeys the keys of the vertex elements to write to JSON
* @param edgePropertyKeys the keys of the edge elements to write to JSON
* @param mode determines the format of the GraphSON
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
public void outputGraph(final String filename, final Set<String> vertexPropertyKeys,
- final Set<String> edgePropertyKeys, final GraphSONMode mode) throws IOException {
+ final Set<String> edgePropertyKeys, final GraphSONMode mode,
+ final boolean adjacencyListFormat) throws IOException {
final FileOutputStream fos = new FileOutputStream(filename);
- outputGraph(fos, vertexPropertyKeys, edgePropertyKeys, mode);
+ outputGraph(fos, vertexPropertyKeys, edgePropertyKeys, mode, adjacencyListFormat);
fos.close();
}
@@ -84,16 +86,17 @@ public class GraphSONLegacyWriter {
* @param vertexPropertyKeys the keys of the vertex elements to write to JSON
* @param edgePropertyKeys the keys of the edge elements to write to JSON
* @param mode determines the format of the GraphSON
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
public void outputGraph(final OutputStream jsonOutputStream, final Set<String> vertexPropertyKeys,
- final Set<String> edgePropertyKeys, final GraphSONMode mode) throws IOException {
- outputGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode, false);
+ final Set<String> edgePropertyKeys, final GraphSONMode mode,
+ final boolean adjacencyListFormat) throws IOException {
+ outputGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode, false, adjacencyListFormat);
}
-
- public void outputGraph(final OutputStream jsonOutputStream, final Set<String> vertexPropertyKeys,
- final Set<String> edgePropertyKeys, final GraphSONMode mode, final boolean normalize) throws IOException {
+ private void outputVerticesEdgesGraph(final OutputStream jsonOutputStream, final Set<String> vertexPropertyKeys,
+ final Set<String> edgePropertyKeys, final GraphSONMode mode, final boolean normalize) throws IOException {
final JsonGenerator jg = jsonFactory.createGenerator(jsonOutputStream);
// don't let the JsonGenerator close the underlying stream...leave that to the client passing in the stream
@@ -127,6 +130,41 @@ public class GraphSONLegacyWriter {
jg.flush();
jg.close();
+
+ }
+
+ private void outputAdjListGraph(final OutputStream jsonOutputStream, final Set<String> vertexPropertyKeys,
+ final Set<String> edgePropertyKeys, final GraphSONMode mode, final boolean normalize) throws IOException {
+
+ final JsonGenerator jg = jsonFactory.createGenerator(jsonOutputStream);
+
+ // don't let the JsonGenerator close the underlying stream...leave that to the client passing in the stream
+ jg.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
+
+ final TP2GraphSONUtility graphson = new TP2GraphSONUtility(mode, null,
+ ElementPropertyConfig.includeProperties(vertexPropertyKeys, edgePropertyKeys, normalize));
+
+ //jg.writeStartObject();
+
+ final Iterable<Vertex> vertices = vertices(normalize);
+ for (Vertex v : vertices) {
+ jg.writeTree(graphson.objectNodeFromElement(v));
+ }
+
+ //jg.writeEndObject();
+
+ jg.flush();
+ jg.close();
+ }
+
+ public void outputGraph(final OutputStream jsonOutputStream, final Set<String> vertexPropertyKeys,
+ final Set<String> edgePropertyKeys, final GraphSONMode mode, final boolean normalize,
+ final boolean adjacencyListFormat) throws IOException {
+ if (adjacencyListFormat) {
+ outputAdjListGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode, normalize);
+ } else {
+ outputVerticesEdgesGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode, normalize);
+ }
}
private Iterable<Vertex> vertices(boolean normalize) {
@@ -175,11 +213,12 @@ public class GraphSONLegacyWriter {
*
* @param graph the graph to serialize to JSON
* @param jsonOutputStream the JSON OutputStream to write the Graph data to
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
- public static void outputGraph(final Graph graph, final OutputStream jsonOutputStream) throws IOException {
+ public static void outputGraph(final Graph graph, final OutputStream jsonOutputStream, final boolean adjacencyListFormat) throws IOException {
final GraphSONLegacyWriter writer = new GraphSONLegacyWriter(graph);
- writer.outputGraph(jsonOutputStream, null, null, GraphSONMode.NORMAL);
+ writer.outputGraph(jsonOutputStream, null, null, GraphSONMode.NORMAL, adjacencyListFormat);
}
/**
@@ -188,11 +227,12 @@ public class GraphSONLegacyWriter {
*
* @param graph the graph to serialize to JSON
* @param filename the JSON file to write the Graph data to
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
- public static void outputGraph(final Graph graph, final String filename) throws IOException {
+ public static void outputGraph(final Graph graph, final String filename, final boolean adjacencyListFormat) throws IOException {
final GraphSONLegacyWriter writer = new GraphSONLegacyWriter(graph);
- writer.outputGraph(filename, null, null, GraphSONMode.NORMAL);
+ writer.outputGraph(filename, null, null, GraphSONMode.NORMAL, adjacencyListFormat);
}
/**
@@ -201,12 +241,13 @@ public class GraphSONLegacyWriter {
* @param graph the graph to serialize to JSON
* @param jsonOutputStream the JSON OutputStream to write the Graph data to
* @param mode determines the format of the GraphSON
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
public static void outputGraph(final Graph graph, final OutputStream jsonOutputStream,
- final GraphSONMode mode) throws IOException {
+ final GraphSONMode mode, final boolean adjacencyListFormat) throws IOException {
final GraphSONLegacyWriter writer = new GraphSONLegacyWriter(graph);
- writer.outputGraph(jsonOutputStream, null, null, mode);
+ writer.outputGraph(jsonOutputStream, null, null, mode, adjacencyListFormat);
}
/**
@@ -215,12 +256,13 @@ public class GraphSONLegacyWriter {
* @param graph the graph to serialize to JSON
* @param filename the JSON file to write the Graph data to
* @param mode determines the format of the GraphSON
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
public static void outputGraph(final Graph graph, final String filename,
- final GraphSONMode mode) throws IOException {
+ final GraphSONMode mode, final boolean adjacencyListFormat) throws IOException {
final GraphSONLegacyWriter writer = new GraphSONLegacyWriter(graph);
- writer.outputGraph(filename, null, null, mode);
+ writer.outputGraph(filename, null, null, mode, adjacencyListFormat);
}
/**
@@ -231,13 +273,14 @@ public class GraphSONLegacyWriter {
* @param vertexPropertyKeys the keys of the vertex elements to write to JSON
* @param edgePropertyKeys the keys of the edge elements to write to JSON
* @param mode determines the format of the GraphSON
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
public static void outputGraph(final Graph graph, final OutputStream jsonOutputStream,
final Set<String> vertexPropertyKeys, final Set<String> edgePropertyKeys,
- final GraphSONMode mode) throws IOException {
+ final GraphSONMode mode, final boolean adjacencyListFormat) throws IOException {
final GraphSONLegacyWriter writer = new GraphSONLegacyWriter(graph);
- writer.outputGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode);
+ writer.outputGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode, adjacencyListFormat);
}
/**
@@ -248,13 +291,14 @@ public class GraphSONLegacyWriter {
* @param vertexPropertyKeys the keys of the vertex elements to write to JSON
* @param edgePropertyKeys the keys of the edge elements to write to JSON
* @param mode determines the format of the GraphSON
+ * @param adjacencyListFormat whether to output in adjacency list or vertices/edges format
* @throws IOException thrown if there is an error generating the JSON data
*/
public static void outputGraph(final Graph graph, final String filename,
final Set<String> vertexPropertyKeys, final Set<String> edgePropertyKeys,
- final GraphSONMode mode) throws IOException {
+ final GraphSONMode mode, final boolean adjacencyListFormat) throws IOException {
final GraphSONLegacyWriter writer = new GraphSONLegacyWriter(graph);
- writer.outputGraph(filename, vertexPropertyKeys, edgePropertyKeys, mode);
+ writer.outputGraph(filename, vertexPropertyKeys, edgePropertyKeys, mode, adjacencyListFormat);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b92cd799/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
index 9111b80..3ec7bf2 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
@@ -127,7 +127,17 @@ public class IoDataGenerationTest {
@Test
public void shouldWriteClassicGraphAsTP2GraphSONNoTypes() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop2-classic.json");
- GraphSONLegacyWriter.outputGraph(TinkerFactory.createClassic(), os);
+ GraphSONLegacyWriter.outputGraph(TinkerFactory.createClassic(), os, false);
+ os.close();
+ }
+
+ /**
+ * No assertions. Just write out the graph for convenience.
+ */
+ @Test
+ public void shouldWriteClassicGraphAsTP2AdjGraphSONNoTypes() throws IOException {
+ final OutputStream os = new FileOutputStream(tempPath + "tinkerpop2adj-classic.json");
+ GraphSONLegacyWriter.outputGraph(TinkerFactory.createClassic(), os, true);
os.close();
}
@@ -147,7 +157,17 @@ public class IoDataGenerationTest {
@Test
public void shouldWriteModernGraphAsTP2GraphSONNoTypes() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop2-modern.json");
- GraphSONLegacyWriter.outputGraph(TinkerFactory.createModern(), os);
+ GraphSONLegacyWriter.outputGraph(TinkerFactory.createModern(), os, false);
+ os.close();
+ }
+
+ /**
+ * No assertions. Just write out the graph for convenience.
+ */
+ @Test
+ public void shouldWriteModernGraphAsTP2AdjGraphSONNoTypes() throws IOException {
+ final OutputStream os = new FileOutputStream(tempPath + "tinkerpop2adj-modern.json");
+ GraphSONLegacyWriter.outputGraph(TinkerFactory.createModern(), os, true);
os.close();
}
@@ -168,7 +188,18 @@ public class IoDataGenerationTest {
@Test
public void shouldWriteCrewGraphAsTP2GraphSONNoTypes() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop2-crew.json");
- GraphSONLegacyWriter.outputGraph(TinkerFactory.createTheCrew(), os);
+ GraphSONLegacyWriter.outputGraph(TinkerFactory.createTheCrew(), os, false);
+ os.close();
+ }
+
+ /**
+ * No assertions. Just write out the graph for convenience.
+ */
+ @Ignore
+ @Test
+ public void shouldWriteCrewGraphAsTP2AdjGraphSONNoTypes() throws IOException {
+ final OutputStream os = new FileOutputStream(tempPath + "tinkerpop2adj-crew.json");
+ GraphSONLegacyWriter.outputGraph(TinkerFactory.createTheCrew(), os, true);
os.close();
}
@@ -306,7 +337,11 @@ public class IoDataGenerationTest {
os4.close();
final OutputStream os5 = new FileOutputStream(tempPath + "grateful-dead-tp2.json");
- GraphSONLegacyWriter.outputGraph(g, os5);
+ GraphSONLegacyWriter.outputGraph(g, os5, false);
os5.close();
+
+ final OutputStream os6 = new FileOutputStream(tempPath + "grateful-dead-tp2adj.json");
+ GraphSONLegacyWriter.outputGraph(g, os6, true);
+ os6.close();
}
}