netkit.graph.io
Class SchemaWriter

java.lang.Object
  extended by netkit.graph.io.SchemaWriter

public final class SchemaWriter
extends java.lang.Object

This class outputs schema information for a Graph. The file format for the schema is an extended ARFF format. The extended ARFF file format is further described in the SchemaReader class.

Author:
Kaveh R. Ghazi
See Also:
SchemaReader, NodeWriter, EdgeWriterRN, Graph

Constructor Summary
SchemaWriter()
           
 
Method Summary
static void main(java.lang.String[] args)
          A test driver for the class.
static void writeSchema(Graph graph, java.io.Writer writer, java.util.Map<java.lang.String,java.lang.String> nodeTypeFiles, java.util.Map<java.lang.String,java.lang.String> edgeTypeFiles)
          Writes the Graph information in an extended ARFF format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaWriter

public SchemaWriter()
Method Detail

writeSchema

public static void writeSchema(Graph graph,
                               java.io.Writer writer,
                               java.util.Map<java.lang.String,java.lang.String> nodeTypeFiles,
                               java.util.Map<java.lang.String,java.lang.String> edgeTypeFiles)
Writes the Graph information in an extended ARFF format. Note the supplied Maps of filenames are simply output in the resulting schema. It is the responsibility of the caller to ensure these files are actually created with the appropriate names and data via other the Writer classes.

Parameters:
graph - a Graph to be written.
writer - a Writer into which to output the schema. The Writer is flushed but not closed.
nodeTypeFiles - a Map of NodeType names to output filenames.
edgeTypeFiles - a Map of EdgeType names to output filenames.
Throws:
java.lang.RuntimeException - if an I/O error occurs.
java.lang.NullPointerException - if nodeTypeFiles does not have an entry for every node type (AKA Attributes object) in the supplied Graph. Likewise for edgeTypeFiles and EdgeTypes in the Graph.

main

public static final void main(java.lang.String[] args)
A test driver for the class.

Parameters:
args - An array of Strings as the arguments for the test driver. Extactly one argument must be supplied, it contains the name of the schema file to use in the test which is passed to SchemaReader.readSchema() and then written back to System.out via this class.