Class CSVEventDrivenImporter

All Implemented Interfaces:

public class CSVEventDrivenImporter extends BaseEventDrivenImporter<String,Triple<String,String,Double>> implements EventDrivenImporter<String,Triple<String,String,Double>>
Imports a graph from a CSV Format or any other Delimiter-separated value format.

The importer supports various different formats which can be adjusted using the setFormat method. The supported formats are the same CSV formats used by Gephi. For some of the formats, the behavior of the importer can be adjusted using the setParameter method. See CSVFormat for a description of the formats.

The importer respects rfc4180. The caller can also adjust the separator to something like semicolon or pipe instead of comma. In such a case, all fields are unescaped using the new separator. See Delimiter-separated values for more information.

This importer does not distinguish between CSVFormat.EDGE_LIST and CSVFormat.ADJACENCY_LIST. In both cases it assumes the format is CSVFormat.ADJACENCY_LIST.

Dimitrios Michail
See Also:
  • Constructor Details

    • CSVEventDrivenImporter

      public CSVEventDrivenImporter()
      Constructs a new importer using the CSVFormat.ADJACENCY_LIST format as default.
    • CSVEventDrivenImporter

      public CSVEventDrivenImporter(CSVFormat format)
      Constructs a new importer.
      format - format to use out of the supported ones
    • CSVEventDrivenImporter

      public CSVEventDrivenImporter(CSVFormat format, char delimiter)
      Constructs a new importer.
      format - format to use out of the supported ones
      delimiter - delimiter to use (comma, semicolon, pipe, etc.)
  • Method Details

    • getFormat

      public CSVFormat getFormat()
      Get the format that the importer is using.
      the input format
    • setFormat

      public void setFormat(CSVFormat format)
      Set the format of the importer
      format - the format to use
    • getDelimiter

      public char getDelimiter()
      Get the delimiter (comma, semicolon, pipe, etc).
      the delimiter
    • setDelimiter

      public void setDelimiter(char delimiter)
      Set the delimiter (comma, semicolon, pipe, etc).
      delimiter - the delimiter to use
    • isParameter

      public boolean isParameter(CSVFormat.Parameter p)
      Return if a particular parameter of the exporter is enabled
      p - the parameter
      true if the parameter is set, false otherwise
    • setParameter

      public void setParameter(CSVFormat.Parameter p, boolean value)
      Set the value of a parameter of the exporter
      p - the parameter
      value - the value to set
    • importInput

      public void importInput(Reader input) throws ImportException
      Description copied from interface: EventDrivenImporter
      Import a graph
      Specified by:
      importInput in interface EventDrivenImporter<String,Triple<String,String,Double>>
      input - the input reader
      ImportException - in case any error occurs, such as I/O or parse error