Base TypeLoader class.
More...
Base TypeLoader class.
Base class to load a node or edge type from a graph using a RowReader.
TypeLoaderListener can be registered to receive information about the progress of the load process by means of TypeLoaderEvent. The default frequency of notification to listeners is 100000.
Check out the 'Data import' section in the SPARKSEE User Manual for more details on this.
- Author
- Sparsity Technologies http://www.sparsity-technologies.com
Load can work in different ways.
Enumerator |
---|
ONE_PHASE |
Performs the load in a phases.
Load all objects an attributes at the same time.
|
TWO_PHASES |
Performs the load in two phases.
Firstly load all objects (and create them if necessary) and secondly loads all the attributes.
Working on this mode it is necessary to build a temporary file.
|
N_PHASES |
Performs the load in N phases.
Firstly load all objects (and create them if necessary) and secondly loads all the attributes. But in this case, attributes are loaded one by one. This way, if there are three attributes, then 4 traverses to the RowReader are necessary.
Working on this mode it is necessary to build a temporary file.
|
TypeLoader::TypeLoader |
( |
RowReader & |
rr, |
|
|
sparksee::gdb::Graph & |
g, |
|
|
sparksee::gdb::type_t |
t, |
|
|
sparksee::gdb::AttributeList & |
attrs, |
|
|
sparksee::gdb::Int32List & |
attrsPos |
|
) |
| |
|
protected |
Creates a new instance with the minimum common required arguments.
- Parameters
-
Checks that all the required settings are ready to run.
- Returns
- Returns true if all the settings are ready.
Notifies progress to all registered listeners.
- Parameters
-
ev | [in] Progress event to be notified. |
Registers a new listener.
- Parameters
-
Runs load process.
- Exceptions
-
- Parameters
-
ph | [in] The load mode. |
par | [in] Number of horizontal partitions to perform the load. |
virtual void TypeLoader::RunNPhases |
( |
sparksee::gdb::int32_t |
partitions | ) |
|
throw | ( | sparksee::gdb::IOException, |
| | sparksee::gdb::Error |
| ) | | |
|
pure virtual |
Run the loader for N phases loading.
Firstly load all objects (and create them if necessary) and secondly loads all the attributes. But in this case, attributes are loaded one by one. This way, if there are three attributes, then 4 traverses are necessary.
Working on this mode it is necessary to build a temporary file.
- Parameters
-
partitions | [in] Number of horizontal partitions to perform the load. |
Implemented in EdgeTypeLoader, and NodeTypeLoader.
virtual void TypeLoader::RunTwoPhases |
( |
| ) |
|
throw | ( | sparksee::gdb::IOException, |
| | sparksee::gdb::Error |
| ) | | |
|
pure virtual |
Run the loader for two phases loading.
Firstly load all objects (and create them if necessary) and secondly loads all the attributes.
Working on this mode it is necessary to build a temporary file.
Implemented in EdgeTypeLoader, and NodeTypeLoader.
void TypeLoader::SetAttributePositions |
( |
sparksee::gdb::Int32List & |
attrsPos | ) |
|
Sets the list of attribute positions.
- Parameters
-
attrsPos | [in] Attribute positions (column index >=0). |
void TypeLoader::SetAttributes |
( |
sparksee::gdb::AttributeList & |
attrs | ) |
|
Sets the list of Attributes.
- Parameters
-
Sets the frequency of listener notification.
- Parameters
-
freq | [in] Frequency in number of rows managed to notify progress to all listeners |
void TypeLoader::SetGraph |
( |
sparksee::gdb::Graph & |
graph | ) |
|
Sets the graph where the data will be loaded.
- Parameters
-
void TypeLoader::SetLocale |
( |
const std::wstring & |
localeStr | ) |
|
Sets the locale that will be used to read the data.
It should match the locale used in the rowreader.
- Parameters
-
localeStr | [in] The locale string for the read data. See CSVReader. |
void TypeLoader::SetLogError |
( |
const std::wstring & |
path | ) |
|
throw | ( | sparksee::gdb::IOException |
| ) | | |
Sets a log error file.
By default errors are thrown as a exception and the load process ends. If a log file is set, errors are logged there and the load process does not stop.
- Parameters
-
path | [in] The path to the error log file. |
- Exceptions
-
void TypeLoader::SetLogOff |
( |
| ) |
|
Truns off all the error reporting.
The log file will not be created and no exceptions for invalid data will be thrown. If you just want to turn off the logs, but abort at the first error what you should do is not call this method and not set a logError file.
void TypeLoader::SetRowReader |
( |
RowReader & |
rr | ) |
|
Sets the input data source.
- Parameters
-
void TypeLoader::SetTimestampFormat |
( |
const std::wstring & |
timestampFormat | ) |
|
Sets a specific timestamp format.
- Parameters
-
timestampFormat | [in] A string with the timestamp format definition. |
Sets the type to be loaded.
- Parameters
-
type | [in] Type identifier. |
The documentation for this class was generated from the following file: