public class GraphSONReader extends java.lang.Object implements GraphReader
Edge and Vertex objects are serialized to Map instances. If an
Element is used as a key, it is coerced to its identifier. Other complex
objects are converted via Object.toString() unless there is a mapper serializer supplied.| Modifier and Type | Class and Description |
|---|---|
static class |
GraphSONReader.Builder |
| Constructor and Description |
|---|
GraphSONReader(GraphSONMapper mapper,
long batchSize,
java.lang.String vertexIdKey,
java.lang.String edgeIdKey) |
| Modifier and Type | Method and Description |
|---|---|
static GraphSONReader.Builder |
build() |
Edge |
readEdge(java.io.InputStream inputStream,
java.util.function.Function<DetachedEdge,Edge> edgeMaker)
Reads a single edge from an
InputStream. |
void |
readGraph(java.io.InputStream inputStream,
Graph graphToWriteTo)
Reads an entire graph from an
InputStream. |
Vertex |
readVertex(java.io.InputStream inputStream,
Direction direction,
java.util.function.Function<DetachedVertex,Vertex> vertexMaker,
java.util.function.Function<DetachedEdge,Edge> edgeMaker)
Reads a single vertex from an
InputStream. |
Vertex |
readVertex(java.io.InputStream inputStream,
java.util.function.Function<DetachedVertex,Vertex> vertexMaker)
Reads a single vertex from an
InputStream. |
java.util.Iterator<Vertex> |
readVertices(java.io.InputStream inputStream,
Direction direction,
java.util.function.Function<DetachedVertex,Vertex> vertexMaker,
java.util.function.Function<DetachedEdge,Edge> edgeMaker)
Reads a set of vertices from an
InputStream which were written by
GraphWriter.writeVertices(java.io.OutputStream, com.tinkerpop.gremlin.process.Traversal). |
public GraphSONReader(GraphSONMapper mapper, long batchSize, java.lang.String vertexIdKey, java.lang.String edgeIdKey)
public void readGraph(java.io.InputStream inputStream,
Graph graphToWriteTo)
throws java.io.IOException
GraphReaderInputStream.readGraph in interface GraphReaderinputStream - a stream containing a single vertex as defined by the accompanying GraphWriterjava.io.IOExceptionpublic java.util.Iterator<Vertex> readVertices(java.io.InputStream inputStream, Direction direction, java.util.function.Function<DetachedVertex,Vertex> vertexMaker, java.util.function.Function<DetachedEdge,Edge> edgeMaker) throws java.io.IOException
GraphReaderInputStream which were written by
GraphWriter.writeVertices(java.io.OutputStream, com.tinkerpop.gremlin.process.Traversal). This method
will read vertex properties as well as edges given the direction supplied as an argument.readVertices in interface GraphReaderinputStream - a stream containing a single vertex as defined by the accompanying GraphWriterdirection - the direction of edges to read.vertexMaker - a function to create a vertex where the first argument is the vertex identifier, the
second argument is vertex label and the last is the list of properties for itedgeMaker - a function that creates an edge from the stream where the first argument is the edge
identifier, the second argument is the out vertex id, the third is the in vertex id,
the fourth is the label, and the fifth is the list of properties as key/value pairs.java.io.IOExceptionpublic Edge readEdge(java.io.InputStream inputStream, java.util.function.Function<DetachedEdge,Edge> edgeMaker) throws java.io.IOException
GraphReaderInputStream.readEdge in interface GraphReaderinputStream - a stream containing a single vertex as defined by the accompanying GraphWriteredgeMaker - a function that creates an edge from the stream where the first argument is the edge
identifier, the second argument is the out vertex id, the third is the in vertex id,
the fourth is the label, and the fifth is the list of properties as key/value pairs.java.io.IOExceptionpublic Vertex readVertex(java.io.InputStream inputStream, java.util.function.Function<DetachedVertex,Vertex> vertexMaker) throws java.io.IOException
GraphReaderInputStream. This method will read vertex properties but not edges.readVertex in interface GraphReaderinputStream - a stream containing a single vertex as defined by the accompanying GraphWritervertexMaker - a function to create a vertex where the first argument is the vertex identifier, the
second argument is vertex label and the last is the list of properties for itjava.io.IOExceptionpublic Vertex readVertex(java.io.InputStream inputStream, Direction direction, java.util.function.Function<DetachedVertex,Vertex> vertexMaker, java.util.function.Function<DetachedEdge,Edge> edgeMaker) throws java.io.IOException
GraphReaderInputStream. This method will read vertex properties as well as edges
given the direction supplied as an argument.readVertex in interface GraphReaderinputStream - a stream containing a single vertex as defined by the accompanying GraphWriterdirection - the direction of edges to read.vertexMaker - a function to create a vertex where the first argument is the vertex identifier, the
second argument is vertex label and the last is the list of properties for itedgeMaker - a function that creates an edge from the stream where the first argument is the edge
identifier, the second argument is the out vertex id, the third is the in vertex id,
the fourth is the label, and the fifth is the list of properties as key/value pairs.java.io.IOExceptionpublic static GraphSONReader.Builder build()
Copyright © 2013-2015 TinkerPop. All Rights Reserved.