tlp::AbstractCSVToGraphDataMapping Class Reference
Abstract class handling node or edge mapping between a CSV column and a graph property.
More...
#include <CSVGraphImport.h>
List of all members.
Public Member Functions
- AbstractCSVToGraphDataMapping (tlp::Graph *graph, tlp::ElementType type, unsigned int columnIndex, const std::string &propertyName, unsigned int firstRow=0, unsigned int lastRow=UINT_MAX)
- virtual ~AbstractCSVToGraphDataMapping ()
- void begin ()
- void token (unsigned int row, unsigned int column, const std::string &token)
- void end (unsigned int rowNumber, unsigned int columnNumber)
- std::pair< tlp::ElementType,
unsigned int > getElementForRow (unsigned int row)
- Return the graph element corresponding to the row.
Protected Member Functions
- virtual unsigned int buildIndexForRow (unsigned int row, const std::string &indexKey, tlp::Graph *graph, tlp::PropertyInterface *keyProperty)=0
- Create a new element if no elements for the given row was found.
- virtual void fillValuesMap (tlp::ElementType type, tlp::Graph *graph, tlp::PropertyInterface *keyProperty, std::map< std::string, unsigned int > &valuesToId)
- Fill the value map to speed up the research in graph.
- bool importRow (unsigned int row) const
Detailed Description
Abstract class handling node or edge mapping between a CSV column and a graph property.
Be sure there is a property with the given name in the graph or an error will occur. Automatically handle CSV file parsing just implements the buildIndexForRow function to fill the rowToGraphId map with the right graph element.
Constructor & Destructor Documentation
tlp::AbstractCSVToGraphDataMapping::AbstractCSVToGraphDataMapping |
( |
tlp::Graph * |
graph, |
|
|
tlp::ElementType |
type, |
|
|
unsigned int |
columnIndex, |
|
|
const std::string & |
propertyName, |
|
|
unsigned int |
firstRow = 0 , |
|
|
unsigned int |
lastRow = UINT_MAX | |
|
) |
| | |
virtual tlp::AbstractCSVToGraphDataMapping::~AbstractCSVToGraphDataMapping |
( |
|
) |
[inline, virtual] |
Member Function Documentation
void tlp::AbstractCSVToGraphDataMapping::begin |
( |
|
) |
[virtual] |
virtual unsigned int tlp::AbstractCSVToGraphDataMapping::buildIndexForRow |
( |
unsigned int |
row, |
|
|
const std::string & |
indexKey, |
|
|
tlp::Graph * |
graph, |
|
|
tlp::PropertyInterface * |
keyProperty | |
|
) |
| | [protected, pure virtual] |
void tlp::AbstractCSVToGraphDataMapping::end |
( |
unsigned int |
rowNumber, |
|
|
unsigned int |
columnNumber | |
|
) |
| | [virtual] |
Function called at the end of the parsing.
- Parameters:
-
| rowNumber | the number of row read in the file. |
| columnNumber | The column number for the line with the greatest column number. |
Implements tlp::CSVContentHandler.
virtual void tlp::AbstractCSVToGraphDataMapping::fillValuesMap |
( |
tlp::ElementType |
type, |
|
|
tlp::Graph * |
graph, |
|
|
tlp::PropertyInterface * |
keyProperty, |
|
|
std::map< std::string, unsigned int > & |
valuesToId | |
|
) |
| | [protected, virtual] |
Fill the value map to speed up the research in graph.
std::pair<tlp::ElementType,unsigned int> tlp::AbstractCSVToGraphDataMapping::getElementForRow |
( |
unsigned int |
row |
) |
[virtual] |
bool tlp::AbstractCSVToGraphDataMapping::importRow |
( |
unsigned int |
row |
) |
const [protected] |
void tlp::AbstractCSVToGraphDataMapping::token |
( |
unsigned int |
row, |
|
|
unsigned int |
column, |
|
|
const std::string & |
token | |
|
) |
| | [virtual] |
Function called for each tokens found in the file.
- Parameters:
-
| row | The row position of the token. |
| column | The column position of the token. |
| token | The token. |
Implements tlp::CSVContentHandler.