Package com.gengoai.graph.io
Class GraphJson<V>
- java.lang.Object
-
- com.gengoai.graph.io.GraphJson<V>
-
- All Implemented Interfaces:
GraphReader<V>
,GraphWriter<V>
public class GraphJson<V> extends Object implements GraphReader<V>, GraphWriter<V>
- Author:
- David B. Bracewell
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Graph<V>
read(Resource location)
Reads a graph in from a resourcevoid
setEdgeDecoder(EdgeDecoder<V> edgeDecoder)
Sets the edge decoder.void
setEdgeEncoder(EdgeEncoder<V> encoder)
Sets the edge encoder.void
setVertexDecoder(VertexDecoder<V> vertexDecoder)
Sets the vertex decoder.void
setVertexEncoder(VertexEncoder<V> encoder)
Sets the vertex encodervoid
write(Graph<V> graph, Resource location, Multimap<String,String> parameters)
Writes the given graph to the give location in this format, using the defined vertex and edge encoders.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.gengoai.graph.io.GraphWriter
write
-
-
-
-
Constructor Detail
-
GraphJson
public GraphJson(Type vertexClass)
-
-
Method Detail
-
setVertexDecoder
public void setVertexDecoder(VertexDecoder<V> vertexDecoder)
Description copied from interface:GraphReader
Sets the vertex decoder.- Specified by:
setVertexDecoder
in interfaceGraphReader<V>
- Parameters:
vertexDecoder
- the vertex decoder
-
setEdgeDecoder
public void setEdgeDecoder(EdgeDecoder<V> edgeDecoder)
Description copied from interface:GraphReader
Sets the edge decoder.- Specified by:
setEdgeDecoder
in interfaceGraphReader<V>
- Parameters:
edgeDecoder
- the edge decoder
-
read
public Graph<V> read(Resource location) throws IOException
Description copied from interface:GraphReader
Reads a graph in from a resource- Specified by:
read
in interfaceGraphReader<V>
- Parameters:
location
- the location of the graph- Returns:
- A Graph constructed based on the resource
- Throws:
IOException
- Something went wrong reading
-
setVertexEncoder
public void setVertexEncoder(VertexEncoder<V> encoder)
Description copied from interface:GraphWriter
Sets the vertex encoder- Specified by:
setVertexEncoder
in interfaceGraphWriter<V>
- Parameters:
encoder
- the encoder
-
setEdgeEncoder
public void setEdgeEncoder(EdgeEncoder<V> encoder)
Description copied from interface:GraphWriter
Sets the edge encoder.- Specified by:
setEdgeEncoder
in interfaceGraphWriter<V>
- Parameters:
encoder
- the encoder
-
write
public void write(Graph<V> graph, Resource location, Multimap<String,String> parameters) throws IOException
Description copied from interface:GraphWriter
Writes the given graph to the give location in this format, using the defined vertex and edge encoders.- Specified by:
write
in interfaceGraphWriter<V>
- Parameters:
graph
- the graph to writelocation
- the location to write toparameters
- multimap of parameters used by the underling writer- Throws:
IOException
- Something went wrong writing the graph
-
-