|
Sparksee 6.1.0
|
Base TypeLoader class. More...
#include <TypeLoader.h>

Public Member Functions | |
| void | SetLogError (const std::wstring &path) throw (sparksee::gdb::IOException) |
| Sets a log error file. | |
| void | SetLogOff () |
| Truns off all the error reporting. | |
| virtual | ~TypeLoader () |
| Destructor. | |
| void | Register (TypeLoaderListener &tel) |
| Registers a new listener. | |
| virtual void | Run () throw (sparksee::gdb::IOException, sparksee::gdb::Error) =0 |
| Run the loader. | |
| virtual void | RunTwoPhases () throw (sparksee::gdb::IOException, sparksee::gdb::Error) =0 |
| Run the loader for two phases loading. | |
| virtual void | RunNPhases (sparksee::gdb::int32_t partitions) throw (sparksee::gdb::IOException, sparksee::gdb::Error) =0 |
| Run the loader for N phases loading. | |
| void | SetRowReader (RowReader &rr) |
| Sets the input data source. | |
| void | SetGraph (sparksee::gdb::Graph &graph) |
| Sets the graph where the data will be loaded. | |
| void | SetLocale (const std::wstring &localeStr) |
| Sets the locale that will be used to read the data. | |
| void | SetType (sparksee::gdb::type_t type) |
| Sets the type to be loaded. | |
| void | SetAttributes (sparksee::gdb::AttributeList &attrs) |
| Sets the list of Attributes. | |
| void | SetAttributePositions (sparksee::gdb::Int32List &attrsPos) |
| Sets the list of attribute positions. | |
| void | SetTimestampFormat (const std::wstring ×tampFormat) |
| Sets a specific timestamp format. | |
| void | SetFrequency (sparksee::gdb::int32_t freq) |
| Sets the frequency of listener notification. | |
Protected Types | |
| enum | Mode { ONE_PHASE , TWO_PHASES , N_PHASES } |
| Load can work in different ways. More... | |
Protected Member Functions | |
| sparksee::gdb::bool_t | CanRun () |
| Checks that all the required settings are ready to run. | |
| void | Run (Mode ph, sparksee::gdb::int32_t par) throw (sparksee::gdb::IOException, sparksee::gdb::Error) |
| Runs load process. | |
| TypeLoader (RowReader &rr, sparksee::gdb::Graph &g, sparksee::gdb::type_t t, sparksee::gdb::AttributeList &attrs, sparksee::gdb::Int32List &attrsPos) | |
| Creates a new instance with the minimum common required arguments. | |
| TypeLoader () | |
| Creates a new instance. | |
| void | NotifyListeners (const TypeLoaderEvent &ev) |
| Notifies progress to all registered listeners. | |
| void | SetHeadAttribute (sparksee::gdb::attr_t attr) |
| Sets the attribute that will be used to find the head of the edge. | |
| void | SetHeadPosition (sparksee::gdb::int32_t pos) |
| Sets the position of the head attribute in the source data. | |
| void | SetTailAttribute (sparksee::gdb::attr_t attr) |
| Sets the attribute that will be used to find the tail of the edge. | |
| void | SetTailPosition (sparksee::gdb::int32_t pos) |
| Sets the position of the tail attribute in the source data. | |
| void | SetTailMEP (sparksee::gdb::MissingEndpoint mep) |
| Sets the flag to create missing tail nodes when loading nodes or edges. | |
| void | SetHeadMEP (sparksee::gdb::MissingEndpoint mep) |
| Sets the flag to create missing head nodes when loading nodes or edges. | |
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.
|
protected |
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 Working on this mode it is necessary to build a temporary file. |
|
protected |
Creates a new instance with the minimum common required arguments.
| rr | [in] Input RowReader. |
| g | [in] Graph. |
| t | [in] Type identifier. |
| attrs | [in] Attribute identifiers to be loaded |
| attrsPos | [in] Attribute positions (column index >=0) |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), EdgeTypeLoader::EdgeTypeLoader(), NodeTypeLoader::NodeTypeLoader(), and NodeTypeLoader::NodeTypeLoader().
|
protected |
Checks that all the required settings are ready to run.
|
protected |
Notifies progress to all registered listeners.
| ev | [in] Progress event to be notified. |
| void TypeLoader::Register | ( | TypeLoaderListener & | tel | ) |
Registers a new listener.
| [in] | tel | TypeLoaderListener to be registered. |
|
pure virtual | ||||||||||||||||
Run the loader.
| IOException | If bad things happen using to the RowReader. |
| Error | For other issues |
Implemented in EdgeTypeLoader, and NodeTypeLoader.
|
protected | |||||||||||||||||||
Runs load process.
| ph | [in] The load mode. |
| par | [in] Number of horizontal partitions to perform the load. |
| IOException | If bad things happen using to the RowReader. |
| Error | For other issues |
|
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.
| partitions | [in] Number of horizontal partitions to perform the load. |
| IOException | If bad things happen using to the RowReader. |
| Error | For other issues |
Implemented in EdgeTypeLoader, and NodeTypeLoader.
References RunNPhases().
Referenced by RunNPhases().
|
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.
| IOException | If bad things happen using to the RowReader. |
| Error | For other issues |
Implemented in EdgeTypeLoader, and NodeTypeLoader.
References RunTwoPhases().
Referenced by RunTwoPhases().
| void TypeLoader::SetAttributePositions | ( | sparksee::gdb::Int32List & | attrsPos | ) |
Sets the list of attribute positions.
| attrsPos | [in] Attribute positions (column index >=0). |
References SetAttributePositions().
Referenced by SetAttributePositions().
| void TypeLoader::SetAttributes | ( | sparksee::gdb::AttributeList & | attrs | ) |
Sets the list of Attributes.
| attrs | [in] Attribute identifiers to be loaded |
References SetAttributes().
Referenced by SetAttributes().
| void TypeLoader::SetFrequency | ( | sparksee::gdb::int32_t | freq | ) |
Sets the frequency of listener notification.
| freq | [in] Frequency in number of rows managed to notify progress to all listeners |
References SetFrequency().
Referenced by SetFrequency().
| void TypeLoader::SetGraph | ( | sparksee::gdb::Graph & | graph | ) |
Sets the graph where the data will be loaded.
| graph | [in] Graph. |
References SetGraph().
Referenced by SetGraph().
|
protected |
Sets the attribute that will be used to find the head of the edge.
This method is protected because only the Edge loaders should have it.
| attr | [in] Head Attribute |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), and EdgeTypeLoader::SetHeadAttribute().
|
protected |
Sets the flag to create missing head nodes when loading nodes or edges.
| flag | True if the nodes need to be created. False otherwise |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), and EdgeTypeLoader::SetHeadMEP().
|
protected |
Sets the position of the head attribute in the source data.
This method is protected because only the Edge loaders should have it.
| pos | [in] Head position |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), and EdgeTypeLoader::SetHeadPosition().
| 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.
| localeStr | [in] The locale string for the read data. See CSVReader. |
References SetLocale().
Referenced by SetLocale().
| 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.
| path | [in] The path to the error log file. |
| IOException | If bad things happen opening the file. |
| 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.
| rr | [in] Input RowReader. |
References SetRowReader().
Referenced by SetRowReader().
|
protected |
Sets the attribute that will be used to find the tail of the edge.
This method is protected because only the Edge loaders should have it.
| attr | [in] Tail Attribute |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), and EdgeTypeLoader::SetTailAttribute().
|
protected |
Sets the flag to create missing tail nodes when loading nodes or edges.
| flag | True if the nodes need to be created. False otherwise |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), and EdgeTypeLoader::SetTailMEP().
|
protected |
Sets the position of the tail attribute in the source data.
This method is protected because only the Edge loaders should have it.
| pos | [in] Tail position |
Referenced by EdgeTypeLoader::EdgeTypeLoader(), and EdgeTypeLoader::SetTailPosition().
| void TypeLoader::SetTimestampFormat | ( | const std::wstring & | timestampFormat | ) |
Sets a specific timestamp format.
| timestampFormat | [in] A string with the timestamp format definition. |
References SetTimestampFormat().
Referenced by SetTimestampFormat().
| void TypeLoader::SetType | ( | sparksee::gdb::type_t | type | ) |