Package org.gephi.io.importer.api
Interface ContainerLoader
-
public interface ContainerLoaderInterface for loading aContainerwith graph and attributes data from an importer.Data pushed to a container are not directly appended to the main graph structure and
Processorare doing this job.Use the draft factory for getting
NodeDraftandEdgeDraftinstances.- Author:
- Mathieu Bastian
- See Also:
Importer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEdge(EdgeDraft edgeDraft)Adds an edge to this container.ColumnDraftaddEdgeColumn(String key, Class typeClass)Adds a new edge column to this container.ColumnDraftaddEdgeColumn(String key, Class typeClass, boolean dynamic)Adds a new dynamic edge column to this container.voidaddNode(NodeDraft nodeDraft)Adds a node to this container.ColumnDraftaddNodeColumn(String key, Class typeClass)Adds a new node column to this container.ColumnDraftaddNodeColumn(String key, Class typeClass, boolean dynamic)Adds a new dynamic node column to this container.booleanedgeExists(String id)Returnstrueif an edge exists with the givenid.booleanedgeExists(String source, String target)Returnstrueif an edge exists fromsourcetotarget.ElementDraft.Factoryfactory()Returns the factory for building nodes and edges instances.EdgeDraftgetEdge(String id)Returns the edge with the givenid, ornullif not found.ColumnDraftgetEdgeColumn(String key)Returns the edge column draft withkeyas identifier.NodeDraftgetNode(String id)Returns the node with the givenid, or create a new node with this id if not found.ColumnDraftgetNodeColumn(String key)Returns the node column draft withkeyas identifier.TimeRepresentationgetTimeRepresentation()Gets the current time representation, eitherTIMESTAMPorINTERVAL.booleannodeExists(String id)Returnstrueif a node exists with the givenid.voidremoveEdge(EdgeDraft edgeDraft)Removes an edge from this container.voidsetAllowAutoNode(boolean value)voidsetAllowParallelEdge(boolean value)voidsetAllowSelfLoop(boolean value)voidsetAutoScale(boolean autoscale)voidsetEdgeDefault(EdgeDirectionDefault edgeDefault)Set edge default type: DIRECTED, UNDIRECTED or MIXED.voidsetEdgesMergeStrategy(EdgeMergeStrategy edgesMergeStrategy)voidsetElementIdType(ElementIdType type)Sets the type of the id for elements.voidsetFillLabelWithId(boolean value)voidsetInterval(String start, String end)Sets the interval for the entire graph.voidsetMetadata(MetadataDraft metadata)Sets the (optional) graph metadata.voidsetTimeFormat(TimeFormat timeFormat)Sets the current Time Format for dynamic data, eitherDATE,DATETIMEorDOUBLE.voidsetTimeRepresentation(TimeRepresentation timeRepresentation)Sets the current time representation, eitherTIMESTAMPorINTERVAL.voidsetTimestamp(String timestamp)Sets the timestamp for the entire graph.voidsetTimeZone(org.joda.time.DateTimeZone timeZone)Sets the time zone that is used to parse date and time.
-
-
-
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 pushingedgeDraft.- 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 givenid, 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)
Returnstrueif a node exists with the givenid.- Parameters:
id- node identifier- Returns:
trueif node exists,falseotherwise
-
getEdge
EdgeDraft getEdge(String id)
Returns the edge with the givenid, ornullif not found.- Parameters:
id- edge identifier- Returns:
- edge with
idas an identifier, ornullif not found
-
edgeExists
boolean edgeExists(String id)
Returnstrueif an edge exists with the givenid.- Parameters:
id- an edge identifier- Returns:
trueif edge exists,falseotherwise
-
edgeExists
boolean edgeExists(String source, String target)
Returnstrueif an edge exists fromsourcetotarget.- Parameters:
source- edge source nodetarget- edge target node- Returns:
trueif edges exists,falseotherwise
-
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 withkeyas identifier.- Parameters:
key- node column key- Returns:
- column draft or null if not found
-
getEdgeColumn
ColumnDraft getEdgeColumn(String key)
Returns the edge column draft withkeyas 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 identifiertypeClass- 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 identifiertypeClass- 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 identifiertypeClass- node column typedynamic- 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 identifiertypeClass- edge column typedynamic- 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, eitherDATE,DATETIMEorDOUBLE. 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 startend- 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, eitherTIMESTAMPorINTERVAL.- Returns:
- time representation
-
setTimeRepresentation
void setTimeRepresentation(TimeRepresentation timeRepresentation)
Sets the current time representation, eitherTIMESTAMPorINTERVAL.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
-
setMetadata
void setMetadata(MetadataDraft metadata)
Sets the (optional) graph metadata.- Parameters:
metadata- graph metadata
-
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)
-
-