Gephi Toolkit Javadoc

org.gephi.io.importer.api
Interface ContainerLoader

All Known Implementing Classes:
ImportContainerImpl

public interface ContainerLoader

Interface for a loading a Container with graph and attributes data from an importers. Data pushed to a container are not appended directly to the main data structure, Processor are doing this job.

Use the draft factory for getting NodeDraft and EdgeDraft instances.

For pushing columns associated to nodes and edges, retrieve attribute model by calling getAttributeModel().

How to push nodes with attributes

There is two steps, first identify columns and then push values.
//Add a URL column to nodes, must be done once only before importing nodes
 AttributeColumn col = getAttributeModel().getNodeTable().addColumn("url", AttributeType.STRING);
 //Write the URL value to a node draft
 nodeDraft.addAttributeValue(col, "http://gephi.org");

Author:
Mathieu Bastian
See Also:
Importer, AttributeModel

Nested Class Summary
static interface ContainerLoader.DraftFactory
          Node and edge draft factory.
 
Method Summary
 void addEdge(EdgeDraft edgeDraft)
          Adds an edge to the container.
 void addNode(NodeDraft nodeDraft)
          Adds a node to the container.
 boolean edgeExists(NodeDraft source, NodeDraft target)
          Returns true if an edge exists from source to target.
 boolean edgeExists(java.lang.String id)
          Returns true if an edge exists with the given id.
 ContainerLoader.DraftFactory factory()
          Returns the factory for building nodes and edges instances.
 AttributeModel getAttributeModel()
          Returns the attribute model for this container.
 EdgeDraft getEdge(NodeDraft source, NodeDraft target)
          Returns the edge with the given source and target or null if not found.
 EdgeDraft getEdge(java.lang.String id)
          Returns the edge with the given id, or null if not found.
 NodeDraft getNode(java.lang.String id)
          Returns the node with the given id, or create a new node with this id if not found.
 boolean nodeExists(java.lang.String id)
          Returns true if a node exists with the given id.
 void removeEdge(EdgeDraft edgeDraft)
          Removes an edge from the container.
 void setEdgeDefault(EdgeDefault edgeDefault)
          Set edge default type: DIRECTED, UNDIRECTED or MIXED.
 void setTimeFormat(DynamicModel.TimeFormat timeFormat)
          Sets the current Time Format for dynamic data, either DATE of DOUBLE.
 void setTimeIntervalMax(java.lang.String max)
          Sets the time value where the interval ends.
 void setTimeIntervalMin(java.lang.String min)
          Sets the time value where the interval starts.
 

Method Detail

addEdge

void addEdge(EdgeDraft edgeDraft)
Adds an edge to the 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 - the edge that is to be pushed to the container

addNode

void addNode(NodeDraft nodeDraft)
Adds a node to the container. Identified by its id. If no id is present, a unique identifier is generated.

Parameters:
nodeDraft - the node that is to be pushed to the container

removeEdge

void removeEdge(EdgeDraft edgeDraft)
Removes an edge from the container. Do nothing if the edge is not in the container.

Parameters:
edgeDraft - the edge that is to be removed from the container

getNode

NodeDraft getNode(java.lang.String id)
Returns the node with the given id, or create a new node with this id if not found.

Parameters:
id - a node identifier
Returns:
the found node, or a new default node

nodeExists

boolean nodeExists(java.lang.String id)
Returns true if a node exists with the given id.

Parameters:
id - a node identifier
Returns:
true if node exists, false otherwise

getEdge

EdgeDraft getEdge(java.lang.String id)
Returns the edge with the given id, or null if not found.

Parameters:
id - an edge identifier
Returns:
the edge with id as an identifier, or null if not found

getEdge

EdgeDraft getEdge(NodeDraft source,
                  NodeDraft target)
Returns the edge with the given source and target or null if not found.

Parameters:
source - the edge source node
target - the edge target node
Returns:
the edge from source to target or null if not found

edgeExists

boolean edgeExists(java.lang.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(NodeDraft source,
                   NodeDraft target)
Returns true if an edge exists from source to target.

Parameters:
source - the edge source node
target - the edge target node
Returns:
true if edges exists, false otherwise

setEdgeDefault

void setEdgeDefault(EdgeDefault edgeDefault)
Set edge default type: DIRECTED, UNDIRECTED or MIXED. Default value is directed.

Parameters:
edgeDefault - the edge default type value

getAttributeModel

AttributeModel getAttributeModel()
Returns the attribute model for this container. Columns can be manipulated from this model.

Returns:
the attribute model

factory

ContainerLoader.DraftFactory factory()
Returns the factory for building nodes and edges instances.

Returns:
the draft factory

setTimeIntervalMin

void setTimeIntervalMin(java.lang.String min)
Sets the time value where the interval starts. Nodes and edges can have time intervals that defines their lifetime, this method sets the time interval start. If not set by the user, default value is the yougest element.

Parameters:
min - the lower time interval bound

setTimeIntervalMax

void setTimeIntervalMax(java.lang.String max)
Sets the time value where the interval ends. Nodes and edges can have time intervals that defines their lifetime, this method sets the time interval end. If not set by the user, default value is the oldest element.

Parameters:
max - the upper time interval bound

setTimeFormat

void setTimeFormat(DynamicModel.TimeFormat timeFormat)
Sets the current Time Format for dynamic data, either DATE of DOUBLE. Says how the dates are formatted.

Parameters:
timeFormat - the current time format

Gephi Toolkit Javadoc