Class CSVLoader

java.lang.Object
fr.inria.rules.integraal.io.csv.CSVLoader

public class CSVLoader extends Object
Loader for CSV files.

CSV files are expected to contain no duplicate data rows. The loader preserves rows as provided by the files and does not deduplicate atoms.

  • Constructor Details

    • CSVLoader

      public CSVLoader(IntegraalEnvironment env)
      Creates a CSVLoader backed by the given environment.
      Parameters:
      env - the environment used to load data
  • Method Details

    • parseAndLoad

      public static FactBase parseAndLoad(IntegraalEnvironment env, FactBase f, File rlsFile, boolean encode)
      Loads atoms from CSV files into a given factbase.
      Parameters:
      env - the environment used for parsing
      f - factbase
      rlsFile - RLS configuration file to parseAll
      encode - a boolean true iff the CSV has to be encoded first
      Returns:
      the factbase with loaded atoms
    • load

      public FactBase load(FactBase f, File rlsFile, boolean encode)
      Loads atoms from CSV files into a given factbase using the default parsing parameters.
      Parameters:
      f - factbase to load with parsed files
      rlsFile - input RLS file
      encode - true iff the data must be encoded
      Returns:
      the factbase with loaded atoms
    • parseAndLoad

      @Deprecated public static FactBase parseAndLoad(FactBase factbase, File rlsFile, char separator, String prefix, int headerSize, Boolean encode_flag)
      Deprecated.
      Use parseAndLoad(IntegraalEnvironment, FactBase, File, char, String, int, Boolean) to avoid a throwaway environment that breaks predicate-instance deduplication.
      Loads atoms from CSV files into a given factbase.
      Parameters:
      factbase - factbase to load with parsed files
      rlsFile - input RLS file
      separator - for CSV
      prefix - for CSV
      headerSize - for CSV
      encode_flag - true iff the data must be encoded
      Returns:
      the factbase with loaded atoms
    • parseAndLoad

      public static FactBase parseAndLoad(IntegraalEnvironment env, FactBase factbase, File rlsFile, char separator, String prefix, int headerSize, Boolean encode_flag)
      Loads atoms from CSV files into a given factbase.
      Parameters:
      env - the environment
      factbase - factbase to load with parsed files
      rlsFile - input RLS file
      separator - for CSV
      prefix - for CSV
      headerSize - for CSV
      encode_flag - true iff the data must be encoded
      Returns:
      the factbase with loaded atoms
    • load

      public FactBase load(FactBase factbase, File rlsFile, char separator, String prefix, int headerSize, Boolean encode_flag)
      Loads atoms from CSV files into a given factbase.
      Parameters:
      factbase - factbase to load with parsed files
      rlsFile - input RLS file
      separator - for CSV
      prefix - for CSV
      headerSize - for CSV
      encode_flag - true iff the data must be encoded
      Returns:
      the factbase with loaded atoms