public class EdgeTypeLoader extends TypeLoader
Specific TypeLoader implementation for edge types.
Check out the 'Data import' section in the SPARKSEE User Manual for more details on this.
Constructor and Description |
---|
EdgeTypeLoader()
Creates 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.
|
Modifier and Type | Method and Description |
---|---|
void |
register(TypeLoaderListener tel)
Registers a new listener.
|
void |
run()
See the TypeLoader class Run method.
|
void |
runNPhases(int partitions)
See the TypeLoader class RunNPhases method.
|
void |
runTwoPhases()
See the TypeLoader class RunTwoPhases method.
|
void |
setAttributePositions(Int32List attrsPos)
Sets the list of attribute positions.
|
void |
setAttributes(AttributeList attrs)
Sets the list of Attributes.
|
void |
setFrequency(int freq)
Sets the frequency of listener notification.
|
void |
setGraph(Graph graph)
Sets the graph where the data will be loaded.
|
void |
setHeadAttribute(int attr)
Sets the attribute that will be used to find the head of the edge.
|
void |
setHeadMEP(MissingEndpoint mep)
Sets the flag to create missing head nodes when loading nodes or edges.
|
void |
setHeadPosition(int pos)
Sets the position of the head attribute in the source data.
|
void |
setLocale(java.lang.String localeStr)
Sets the locale that will be used to read the data.
|
void |
setLogError(java.lang.String path)
Sets a log error file.
|
void |
setLogOff()
Truns off all the error reporting.
|
void |
setRowReader(RowReader rr)
Sets the input data source.
|
void |
setTailAttribute(int attr)
Sets the attribute that will be used to find the tail of the edge.
|
void |
setTailMEP(MissingEndpoint mep)
Sets the flag to create missing tail nodes when loading nodes or edges.
|
void |
setTailPosition(int pos)
Sets the position of the tail attribute in the source data.
|
void |
setTimestampFormat(java.lang.String timestampFormat)
Sets a specific timestamp format.
|
void |
setType(int type)
Sets the type to be loaded.
|
public 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)
attrsPos[in] Attribute positions (column index >=0). to all listeners.
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 nodespublic void run() throws java.lang.RuntimeException, java.io.IOException
run
in class TypeLoader
java.lang.RuntimeException
- nulljava.io.IOException
- nullpublic void setLogError(java.lang.String path) throws java.io.IOException
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.
setLogError
in class TypeLoader
path
- [in] The path to the error log file.java.io.IOException
- If bad things happen opening the file.public void setType(int type)
setType
in class TypeLoader
type
- [in] Type identifier.public void setHeadPosition(int pos)
This method is protected because only the Edge loaders should have it.
pos
- [in] Head positionpublic void setLocale(java.lang.String localeStr)
It should match the locale used in the rowreader.
setLocale
in class TypeLoader
localeStr
- [in] The locale string for the read data. See CSVReader.public void setTimestampFormat(java.lang.String timestampFormat)
setTimestampFormat
in class TypeLoader
timestampFormat
- [in] A string with the timestamp format definition.public void setAttributes(AttributeList attrs)
setAttributes
in class TypeLoader
attrs
- [in] Attribute identifiers to be loadedpublic void register(TypeLoaderListener tel)
register
in class TypeLoader
tel
- TypeLoaderListener to be registered.public void setFrequency(int freq)
setFrequency
in class TypeLoader
freq
- [in] Frequency in number of rows managed to notify progress to all listenerspublic void runTwoPhases() throws java.lang.RuntimeException, java.io.IOException
runTwoPhases
in class TypeLoader
java.lang.RuntimeException
- nulljava.io.IOException
- nullpublic void setHeadAttribute(int attr)
This method is protected because only the Edge loaders should have it.
attr
- [in] Head Attributepublic void setTailAttribute(int attr)
This method is protected because only the Edge loaders should have it.
attr
- [in] Tail Attributepublic void setTailPosition(int pos)
This method is protected because only the Edge loaders should have it.
pos
- [in] Tail positionpublic void setRowReader(RowReader rr)
setRowReader
in class TypeLoader
rr
- [in] Input RowReader.public void setTailMEP(MissingEndpoint mep)
flagTrue if the nodes need to be created. False otherwise
mep
- nullpublic void setAttributePositions(Int32List attrsPos)
attrsPos[in] Attribute positions (column index >=0).
setAttributePositions
in class TypeLoader
attrsPos
- [in] Attribute positions (column index >=0).public void setGraph(Graph graph)
setGraph
in class TypeLoader
graph
- [in] Graph.public void runNPhases(int partitions) throws java.lang.RuntimeException, java.io.IOException
runNPhases
in class TypeLoader
partitions
- nulljava.lang.RuntimeException
- nulljava.io.IOException
- nullpublic void setHeadMEP(MissingEndpoint mep)
flagTrue if the nodes need to be created. False otherwise
mep
- nullpublic void setLogOff()
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.
setLogOff
in class TypeLoader