Class GraphMLReader
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader
-
- All Implemented Interfaces:
GraphReader
public final class GraphMLReader extends Object implements GraphReader
GraphMLReaderwrites the data from a GraphML stream to a graph. Note that this format is lossy, in the sense that data types and features of Gremlin Structure not supported by GraphML are not serialized. This format is meant for external export of a graph to tools outside of Gremlin Structure graphs. Note that GraphML does not support the notion of multi-properties or properties on properties.- Author:
- Marko A. Rodriguez (http://markorodriguez.com), Alex Averbuch (alex.averbuch@gmail.com), Joshua Shinavier (http://fortytwo.net), Stephen Mallette (http://stephen.genoprime.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGraphMLReader.BuilderAllows configuration and construction of the GraphMLReader instance.-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.io.GraphReader
GraphReader.ReaderBuilder<T extends GraphReader>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GraphMLReader.Builderbuild()EdgereadEdge(InputStream inputStream, Function<Attachable<Edge>,Edge> edgeAttachMethod)This method is not supported for this reader.voidreadGraph(InputStream graphInputStream, Graph graphToWriteTo)Reads an entire graph from anInputStream.<C> CreadObject(InputStream inputStream, Class<? extends C> clazz)This method is not supported for this reader.PropertyreadProperty(InputStream inputStream, Function<Attachable<Property>,Property> propertyAttachMethod)This method is not supported for this reader.VertexreadVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod)This method is not supported for this reader.VertexreadVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection)This method is not supported for this reader.VertexPropertyreadVertexProperty(InputStream inputStream, Function<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod)This method is not supported for this reader.Iterator<Vertex>readVertices(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection)This method is not supported for this reader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.tinkerpop.gremlin.structure.io.GraphReader
readVertex
-
-
-
-
Method Detail
-
readGraph
public void readGraph(InputStream graphInputStream, Graph graphToWriteTo) throws IOException
Description copied from interface:GraphReaderReads an entire graph from anInputStream. This method is mean to load an emptyGraph. It is up to individual implementations to manage transactions, but it is not required or enforced. Consult the documentation of an implementation to understand the approach it takes.- Specified by:
readGraphin interfaceGraphReader- Parameters:
graphInputStream- a stream containing an entire graph of vertices and edges as defined by the accompanyingGraphWriter.writeGraph(OutputStream, Graph).graphToWriteTo- the graph to write to when reading from the stream.- Throws:
IOException
-
readVertices
public Iterator<Vertex> readVertices(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
This method is not supported for this reader.- Specified by:
readVerticesin interfaceGraphReader- Parameters:
inputStream- a stream containing at least oneVertexas defined by the accompanyingGraphWriter.writeVertices(OutputStream, Iterator, Direction)orGraphWriter.writeVertices(OutputStream, Iterator)methods.vertexAttachMethod- a function that creates re-attaches aVertexto aHostobject.edgeAttachMethod- a function that creates re-attaches aEdgeto aHostobject.attachEdgesOfThisDirection- only edges of this direction are passed to theedgeMaker.- Throws:
UnsupportedOperationException- when called.IOException
-
readVertex
public Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod) throws IOException
This method is not supported for this reader.- Specified by:
readVertexin interfaceGraphReader- Parameters:
inputStream- a stream containing at least a single vertex as defined by the accompanyingGraphWriter.writeVertex(OutputStream, Vertex).vertexAttachMethod- a function that creates re-attaches aVertexto aHostobject.- Throws:
UnsupportedOperationException- when called.IOException
-
readVertex
public Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
This method is not supported for this reader.- Specified by:
readVertexin interfaceGraphReader- Parameters:
inputStream- a stream containing at least oneVertexas defined by the accompanyingGraphWriter.writeVertices(OutputStream, Iterator, Direction)method.vertexAttachMethod- a function that creates re-attaches aVertexto aHostobject.edgeAttachMethod- a function that creates re-attaches aEdgeto aHostobject.attachEdgesOfThisDirection- only edges of this direction are passed to theedgeMaker.- Throws:
UnsupportedOperationException- when called.IOException
-
readEdge
public Edge readEdge(InputStream inputStream, Function<Attachable<Edge>,Edge> edgeAttachMethod) throws IOException
This method is not supported for this reader.- Specified by:
readEdgein interfaceGraphReader- Parameters:
inputStream- a stream containing at least oneEdgeas defined by the accompanyingGraphWriter.writeEdge(OutputStream, Edge)method.edgeAttachMethod- a function that creates re-attaches aEdgeto aHostobject.- Throws:
UnsupportedOperationException- when called.IOException
-
readVertexProperty
public VertexProperty readVertexProperty(InputStream inputStream, Function<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod) throws IOException
This method is not supported for this reader.- Specified by:
readVertexPropertyin interfaceGraphReader- Parameters:
inputStream- a stream containing at least oneVertexPropertyas written by the accompanyingGraphWriter.writeVertexProperty(OutputStream, VertexProperty)method.vertexPropertyAttachMethod- a function that creates re-attaches aVertexPropertyto aHostobject.- Returns:
- the value returned by the attach method.
- Throws:
UnsupportedOperationException- when called.IOException
-
readProperty
public Property readProperty(InputStream inputStream, Function<Attachable<Property>,Property> propertyAttachMethod) throws IOException
This method is not supported for this reader.- Specified by:
readPropertyin interfaceGraphReader- Parameters:
inputStream- a stream containing at least onePropertyas written by the accompanyingGraphWriter.writeProperty(OutputStream, Property)method.propertyAttachMethod- a function that creates re-attaches aPropertyto aHostobject.- Returns:
- the value returned by the attach method.
- Throws:
UnsupportedOperationException- when called.IOException
-
readObject
public <C> C readObject(InputStream inputStream, Class<? extends C> clazz) throws IOException
This method is not supported for this reader.- Specified by:
readObjectin interfaceGraphReader- Parameters:
inputStream- a stream containing an object.clazz- the class expected to be in the stream - may or may not be used by the underlying implementation.- Throws:
UnsupportedOperationException- when called.IOException
-
build
public static GraphMLReader.Builder build()
-
-