Class CSVParser
java.lang.Object
fr.inria.rules.integraal.io.csv.CSVParser
- All Implemented Interfaces:
Parser<Atom>, CloseableIterator<Atom>, Closeable, 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
ConstructorsConstructorDescriptionParses the given CSV file using the given parsing arguments Uses the filename as predicate labelParses the given CSV file using default valuesParses the given CSV file using the given predicate to create atomsCSVParser(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 TypeMethodDescriptionvoidclose()Closes the iterator and releases its resources.booleanhasNext()Indicates whether another element can be read from the iterator.next()Returns the next element from the iterator.parse()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, waitMethods inherited from interface Parser
streamParsedObjects
-
Constructor Details
-
CSVParser
Parses the given CSV file using default values- Parameters:
filePath- path of the csv file to parseAll
-
CSVParser
-
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 predicatearity- arity of the predicatefile- csv file to parseAllseparator- csv separatorprefix- (rdf) prefixheaderSize- size of the csv header
-
CSVParser
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from interface:CloseableIteratorIndicates whether another element can be read from the iterator. -
next
Description copied from interface:CloseableIteratorReturns the next element from the iterator.- Specified by:
nextin interfaceCloseableIterator<Atom>- Specified by:
nextin interfaceParser<Atom>- Returns:
- the next element
- Throws:
ParseException
-
close
public void close()Description copied from interface:CloseableIteratorCloses the iterator and releases its resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<Atom>
-
parse
Description copied from interface:ParserParses every remaining object and groups them by output category.
-