Class EdgeTypeLoader

java.lang.Object
com.sparsity.sparksee.io.TypeLoader
com.sparsity.sparksee.io.EdgeTypeLoader

public class EdgeTypeLoader extends TypeLoader
EdgeTypeLoader class.

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 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 nodes
      tailMEP - [in] The MissingEndpoint policy for the tail nodes
  • Method Details

    • run

      public void run() throws RuntimeException, IOException
      See the TypeLoader class Run method.

      ErrorFor other issues

      Overrides:
      run in class TypeLoader
      Throws:
      RuntimeException - null
      IOException - If bad things happen using to the RowReader.
    • setLogError

      public void setLogError(String path) throws 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.

      Overrides:
      setLogError in class TypeLoader
      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:
      setType in class TypeLoader
      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

      public void setLocale(String localeStr)
      Sets the locale that will be used to read the data.

      It should match the locale used in the rowreader.

      Overrides:
      setLocale in class TypeLoader
      Parameters:
      localeStr - [in] The locale string for the read data. See CSVReader.
    • setTimestampFormat

      public void setTimestampFormat(String timestampFormat)
      Sets a specific timestamp format.

      Overrides:
      setTimestampFormat in class TypeLoader
      Parameters:
      timestampFormat - [in] A string with the timestamp format definition.
    • setAttributes

      public void setAttributes(AttributeList attrs)
      Sets the list of Attributes.

      Overrides:
      setAttributes in class TypeLoader
      Parameters:
      attrs - [in] Attribute identifiers to be loaded
    • register

      public void register(TypeLoaderListener tel)
      Registers a new listener.

      Overrides:
      register in class TypeLoader
      Parameters:
      tel - TypeLoaderListener to be registered.
    • setFrequency

      public void setFrequency(int freq)
      Sets the frequency of listener notification.

      Overrides:
      setFrequency in class TypeLoader
      Parameters:
      freq - [in] Frequency in number of rows managed to notify progress to all listeners
    • runTwoPhases

      public void runTwoPhases() throws RuntimeException, IOException
      See the TypeLoader class RunTwoPhases method.

      ErrorFor other issues

      Overrides:
      runTwoPhases in class TypeLoader
      Throws:
      RuntimeException - null
      IOException - 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

      public void setRowReader(RowReader rr)
      Sets the input data source.

      Overrides:
      setRowReader in class TypeLoader
      Parameters:
      rr - [in] Input RowReader.
    • setTailMEP

      public void setTailMEP(MissingEndpoint mep)
      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

      public void setAttributePositions(Int32List attrsPos)
      Sets the list of attribute positions.

      attrsPos[in] Attribute positions (column index >=0).

      Overrides:
      setAttributePositions in class TypeLoader
      Parameters:
      attrsPos - [in] Attribute positions (column index >=0).
    • setGraph

      public void setGraph(Graph graph)
      Sets the graph where the data will be loaded.

      Overrides:
      setGraph in class TypeLoader
      Parameters:
      graph - [in] Graph.
    • runNPhases

      public void runNPhases(int partitions) throws RuntimeException, IOException
      See the TypeLoader class RunNPhases method.

      ErrorFor other issues

      Overrides:
      runNPhases in class TypeLoader
      Parameters:
      partitions - null
      Throws:
      RuntimeException - null
      IOException - If bad things happen using to the RowReader.
    • setHeadMEP

      public void setHeadMEP(MissingEndpoint mep)
      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:
      setLogOff in class TypeLoader