Class CSVParser

java.lang.Object
fr.inria.rules.integraal.io.csv.CSVParser
All Implemented Interfaces:
Parser<Atom>, CloseableIterator<Atom>, Closeable, AutoCloseable

public class CSVParser extends Object implements Parser<Atom>, AutoCloseable
This class parses a single CSV file into atoms. Each line of the file represents an atom and every atom of the file has the same predicate, either given to the constructor or deduced from the file name. Please note that all the terms are seen as constants.
Author:
Florent Tornil
  • Constructor Summary

    Constructors
    Constructor
    Description
    CSVParser(File file, char separator, String prefix, int headerSize)
    Parses the given CSV file using the given parsing arguments Uses the filename as predicate label
    CSVParser(String filePath)
    Parses the given CSV file using default values
    CSVParser(String predicateName, int arity, File file)
    Parses the given CSV file using the given predicate to create atoms
    CSVParser(String predicateName, int arity, File file, char separator, String prefix, int headerSize)
    Parses the given CSV file using the given predicate to create atoms
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the iterator and releases its resources.
    boolean
    Indicates whether another element can be read from the iterator.
    Returns the next element from the iterator.
    Parses every remaining object and groups them by output category.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface Parser

    streamParsedObjects
  • Constructor Details

    • CSVParser

      public CSVParser(String filePath)
      Parses the given CSV file using default values
      Parameters:
      filePath - path of the csv file to parseAll
    • CSVParser

      public CSVParser(File file, char separator, String prefix, int headerSize)
      Parses the given CSV file using the given parsing arguments Uses the filename as predicate label
      Parameters:
      file - csv file to parseAll
      separator - csv separator
      prefix - (rdf) prefix
      headerSize - size of the csv header
    • CSVParser

      public CSVParser(String predicateName, int arity, File file, char separator, String prefix, int headerSize)
      Parses the given CSV file using the given predicate to create atoms
      Parameters:
      predicateName - label of the predicate
      arity - arity of the predicate
      file - csv file to parseAll
      separator - csv separator
      prefix - (rdf) prefix
      headerSize - size of the csv header
    • CSVParser

      public CSVParser(String predicateName, int arity, File file)
      Parses the given CSV file using the given predicate to create atoms
      Parameters:
      predicateName - label of the predicate
      arity - arity of the predicate
      file - csv file to parseAll
  • Method Details