Class EdgeTypeLoader
Specific TypeLoader implementation for edge types.
Check out the 'Data import' section in the SPARKSEE User Manual for more details on this.
- Author:
- Sparsity Technologies http://www.sparsity-technologies.com
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.EdgeTypeLoader(RowReader rowReader, Graph graph, int type, AttributeList attrs, Int32List attrsPos, int hPos, int tPos, int hAttr, int tAttr, MissingEndpoint headMEP, MissingEndpoint tailMEP) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters a new listener.voidrun()See the TypeLoader class Run method.voidrunNPhases(int partitions) See the TypeLoader class RunNPhases method.voidSee the TypeLoader class RunTwoPhases method.voidsetAttributePositions(Int32List attrsPos) Sets the list of attribute positions.voidsetAttributes(AttributeList attrs) Sets the list of Attributes.voidsetFrequency(int freq) Sets the frequency of listener notification.voidSets the graph where the data will be loaded.voidsetHeadAttribute(int attr) Sets the attribute that will be used to find the head of the edge.voidSets the flag to create missing head nodes when loading nodes or edges.voidsetHeadPosition(int pos) Sets the position of the head attribute in the source data.voidSets the locale that will be used to read the data.voidsetLogError(String path) Sets a log error file.voidTruns off all the error reporting.voidSets the input data source.voidsetTailAttribute(int attr) Sets the attribute that will be used to find the tail of the edge.voidSets the flag to create missing tail nodes when loading nodes or edges.voidsetTailPosition(int pos) Sets the position of the tail attribute in the source data.voidsetTimestampFormat(String timestampFormat) Sets a specific timestamp format.voidsetType(int type) Sets the type to be loaded.
-
Constructor Details
-
EdgeTypeLoader
public EdgeTypeLoader()Creates a new instance. -
EdgeTypeLoader
public EdgeTypeLoader(RowReader rowReader, Graph graph, int type, AttributeList attrs, Int32List attrsPos, int hPos, int tPos, int hAttr, int tAttr, MissingEndpoint headMEP, MissingEndpoint tailMEP) Creates a new instance.attrsPos[in] Attribute positions (column index >=0). to all listeners.
- Parameters:
rowReader- [in] Input RowReader.graph- [in] Graph.type- [in] Type identifier.attrs- [in] Attribute identifiers to be loaded.attrsPos- [in] Attribute positions (column index >=0). to all listeners.hPos- [in] The position (index column) for the head value.tPos- [in] The position (index column) for the tail value.hAttr- [in] The attribute identifier for the head.tAttr- [in] The attribute identifier for the tail.headMEP- [in] The MissingEndpoint policy for the head nodestailMEP- [in] The MissingEndpoint policy for the tail nodes
-
-
Method Details
-
run
See the TypeLoader class Run method.ErrorFor other issues
- Overrides:
runin classTypeLoader- Throws:
RuntimeException- nullIOException- If bad things happen using to the RowReader.
-
setLogError
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.
- Overrides:
setLogErrorin classTypeLoader- Parameters:
path- [in] The path to the error log file.- Throws:
IOException- If bad things happen opening the file.
-
setType
public void setType(int type) Sets the type to be loaded.- Overrides:
setTypein classTypeLoader- Parameters:
type- [in] Type identifier.
-
setHeadPosition
public void setHeadPosition(int pos) Sets the position of the head attribute in the source data.This method is protected because only the Edge loaders should have it.
- Parameters:
pos- [in] Head position
-
setLocale
Sets the locale that will be used to read the data.It should match the locale used in the rowreader.
- Overrides:
setLocalein classTypeLoader- Parameters:
localeStr- [in] The locale string for the read data. See CSVReader.
-
setTimestampFormat
Sets a specific timestamp format.- Overrides:
setTimestampFormatin classTypeLoader- Parameters:
timestampFormat- [in] A string with the timestamp format definition.
-
setAttributes
Sets the list of Attributes.- Overrides:
setAttributesin classTypeLoader- Parameters:
attrs- [in] Attribute identifiers to be loaded
-
register
Registers a new listener.- Overrides:
registerin classTypeLoader- Parameters:
tel- TypeLoaderListener to be registered.
-
setFrequency
public void setFrequency(int freq) Sets the frequency of listener notification.- Overrides:
setFrequencyin classTypeLoader- Parameters:
freq- [in] Frequency in number of rows managed to notify progress to all listeners
-
runTwoPhases
See the TypeLoader class RunTwoPhases method.ErrorFor other issues
- Overrides:
runTwoPhasesin classTypeLoader- Throws:
RuntimeException- nullIOException- If bad things happen using to the RowReader.
-
setHeadAttribute
public void setHeadAttribute(int attr) 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.
- Parameters:
attr- [in] Head Attribute
-
setTailAttribute
public void setTailAttribute(int attr) 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.
- Parameters:
attr- [in] Tail Attribute
-
setTailPosition
public void setTailPosition(int pos) Sets the position of the tail attribute in the source data.This method is protected because only the Edge loaders should have it.
- Parameters:
pos- [in] Tail position
-
setRowReader
Sets the input data source.- Overrides:
setRowReaderin classTypeLoader- Parameters:
rr- [in] Input RowReader.
-
setTailMEP
Sets the flag to create missing tail nodes when loading nodes or edges.flagTrue if the nodes need to be created. False otherwise
- Parameters:
mep- null
-
setAttributePositions
Sets the list of attribute positions.attrsPos[in] Attribute positions (column index >=0).
- Overrides:
setAttributePositionsin classTypeLoader- Parameters:
attrsPos- [in] Attribute positions (column index >=0).
-
setGraph
Sets the graph where the data will be loaded.- Overrides:
setGraphin classTypeLoader- Parameters:
graph- [in] Graph.
-
runNPhases
See the TypeLoader class RunNPhases method.ErrorFor other issues
- Overrides:
runNPhasesin classTypeLoader- Parameters:
partitions- null- Throws:
RuntimeException- nullIOException- If bad things happen using to the RowReader.
-
setHeadMEP
Sets the flag to create missing head nodes when loading nodes or edges.flagTrue if the nodes need to be created. False otherwise
- Parameters:
mep- null
-
setLogOff
public void 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.
- Overrides:
setLogOffin classTypeLoader
-