Interface ContainerLoader


  • public interface ContainerLoader
    Interface for loading a Container with graph and attributes data from an importer.

    Data pushed to a container are not directly appended to the main graph structure and Processor are doing this job.

    Use the draft factory for getting NodeDraft and EdgeDraft instances.

    Author:
    Mathieu Bastian
    See Also:
    Importer
    • Method Detail

      • addEdge

        void addEdge​(EdgeDraft edgeDraft)
        Adds an edge to this container. The edge must have source and target defined. If the edge already exist, it is ignored. Source and target nodes must be added to the container before pushing edgeDraft.
        Parameters:
        edgeDraft - edge that is to be pushed to this container
      • addNode

        void addNode​(NodeDraft nodeDraft)
        Adds a node to this container. Identified by its id. If no id is present, a unique identifier is generated.
        Parameters:
        nodeDraft - node that is to be pushed to this container
      • removeEdge

        void removeEdge​(EdgeDraft edgeDraft)
        Removes an edge from this container. Do nothing if the edge is not in the container.
        Parameters:
        edgeDraft - edge that is to be removed from this container
      • getNode

        NodeDraft getNode​(String id)
        Returns the node with the given id, or create a new node with this id if not found.
        Parameters:
        id - node identifier
        Returns:
        found node, or a new default node
      • nodeExists

        boolean nodeExists​(String id)
        Returns true if a node exists with the given id.
        Parameters:
        id - node identifier
        Returns:
        true if node exists, false otherwise
      • getEdge

        EdgeDraft getEdge​(String id)
        Returns the edge with the given id, or null if not found.
        Parameters:
        id - edge identifier
        Returns:
        edge with id as an identifier, or null if not found
      • edgeExists

        boolean edgeExists​(String id)
        Returns true if an edge exists with the given id.
        Parameters:
        id - an edge identifier
        Returns:
        true if edge exists, false otherwise
      • edgeExists

        boolean edgeExists​(String source,
                           String target)
        Returns true if an edge exists from source to target.
        Parameters:
        source - edge source node
        target - edge target node
        Returns:
        true if edges exists, false otherwise
      • setEdgeDefault

        void setEdgeDefault​(EdgeDirectionDefault edgeDefault)
        Set edge default type: DIRECTED, UNDIRECTED or MIXED. Default value is directed.
        Parameters:
        edgeDefault - edge default type value
      • getNodeColumn

        ColumnDraft getNodeColumn​(String key)
        Returns the node column draft with key as identifier.
        Parameters:
        key - node column key
        Returns:
        column draft or null if not found
      • getEdgeColumn

        ColumnDraft getEdgeColumn​(String key)
        Returns the edge column draft with key as identifier.
        Parameters:
        key - edge column key
        Returns:
        column draft or null if not found
      • addNodeColumn

        ColumnDraft addNodeColumn​(String key,
                                  Class typeClass)
        Adds a new node column to this container.

        If a column with this key already exists, it is ignored and return the existing column.

        Parameters:
        key - node column identifier
        typeClass - node column type
        Returns:
        column draft
      • addEdgeColumn

        ColumnDraft addEdgeColumn​(String key,
                                  Class typeClass)
        Adds a new edge column to this container.

        If a column with this key already exists, it is ignored and return the existing column.

        Parameters:
        key - edge column identifier
        typeClass - edge column type
        Returns:
        column draft
      • addNodeColumn

        ColumnDraft addNodeColumn​(String key,
                                  Class typeClass,
                                  boolean dynamic)
        Adds a new dynamic node column to this container.

        Dynamic attributes have values over time.

        If a column with this key already exists, it is ignored and return the existing column.

        Parameters:
        key - node column identifier
        typeClass - node column type
        dynamic - true if the column needs to be dynamic, false otherwise
        Returns:
        column draft
      • addEdgeColumn

        ColumnDraft addEdgeColumn​(String key,
                                  Class typeClass,
                                  boolean dynamic)
        Adds a new dynamic edge column to this container.

        Dynamic attributes have values over time.

        If a column with this key already exists, it is ignored and return the existing column.

        Parameters:
        key - edge column identifier
        typeClass - edge column type
        dynamic - true if the column needs to be dynamic, false otherwise
        Returns:
        column draft
      • factory

        ElementDraft.Factory factory()
        Returns the factory for building nodes and edges instances.
        Returns:
        the draft factory
      • setTimeFormat

        void setTimeFormat​(TimeFormat timeFormat)
        Sets the current Time Format for dynamic data, either DATE, DATETIME or DOUBLE. It configures how the dates are formatted.

        The default value is DOUBLE.

        Parameters:
        timeFormat - time format
      • setTimestamp

        void setTimestamp​(String timestamp)
        Sets the timestamp for the entire graph. All elements and all dynamic columns will automatically receive this timestamp when the graph is processed.
        Parameters:
        timestamp - timestamp
      • setInterval

        void setInterval​(String start,
                         String end)
        Sets the interval for the entire graph. All elements and all dynamic columns will automatically receive this interval when the graph is processed.
        Parameters:
        start - interval start
        end - interval end
      • setElementIdType

        void setElementIdType​(ElementIdType type)
        Sets the type of the id for elements.
        Parameters:
        type - id type
      • getTimeRepresentation

        TimeRepresentation getTimeRepresentation()
        Gets the current time representation, either TIMESTAMP or INTERVAL.

        Returns:
        time representation
      • setTimeRepresentation

        void setTimeRepresentation​(TimeRepresentation timeRepresentation)
        Sets the current time representation, either TIMESTAMP or INTERVAL.

        The default value is INTERVAL.

        Parameters:
        timeRepresentation - time representation
      • setTimeZone

        void setTimeZone​(org.joda.time.DateTimeZone timeZone)
        Sets the time zone that is used to parse date and time.

        If not set, the local time zone is used.

        Parameters:
        timeZone - time zone
      • setAllowSelfLoop

        void setAllowSelfLoop​(boolean value)
      • setAllowAutoNode

        void setAllowAutoNode​(boolean value)
      • setAllowParallelEdge

        void setAllowParallelEdge​(boolean value)
      • setAutoScale

        void setAutoScale​(boolean autoscale)
      • setFillLabelWithId

        void setFillLabelWithId​(boolean value)
      • setEdgesMergeStrategy

        void setEdgesMergeStrategy​(EdgeMergeStrategy edgesMergeStrategy)