public class CSVLoader
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
loadEdges(Graph graph,
java.lang.String fileName,
java.lang.String edgeType,
java.lang.String tailNodeType,
java.lang.String headNodeType,
int tail,
int head,
java.lang.String separator,
boolean directed,
boolean header,
MissingEndpoint onMissingTail,
MissingEndpoint onMissingHead,
int[] columns,
java.lang.String[] attrNames,
DataType[] dataTypes,
AttributeKind[] attrKinds)
Loads edges from a CSV file.
|
static void |
loadNodes(Graph graph,
java.lang.String fileName,
java.lang.String nodeType,
java.lang.String separator,
boolean header,
int[] columns,
java.lang.String[] attrNames,
DataType[] dataTypes,
AttributeKind[] attrKinds)
Loads nodes from a CSV file.
|
public static void loadEdges(Graph graph, java.lang.String fileName, java.lang.String edgeType, java.lang.String tailNodeType, java.lang.String headNodeType, int tail, int head, java.lang.String separator, boolean directed, boolean header, MissingEndpoint onMissingTail, MissingEndpoint onMissingHead, int[] columns, java.lang.String[] attrNames, DataType[] dataTypes, AttributeKind[] attrKinds)
nodeType[in] The type of the edge to load. If it does not exist, it creates it
graph
- [in] The graph to load the edges intofileName
- [in] The name of the fileedgeType
- nulltailNodeType
- [in] The type of the tail nodes. If it does not exist and onMissingTail is set to "Create", it creates it. Otherwise, an exception is thrownheadNodeType
- [in] The type of the head nodes. It it does not exist and onMissingHead is set to "Create", it creates it. Otherwise, an exception is throwntail
- [in] The tail column index. Default: 0head
- [in] The head column index. Default: 1separator
- [in] The column separator. Default: ","directed
- [in] True if this edge is directed or not. False otherwise. Default: Trueheader
- [in] True if the CSV contains a header. False otherwise. Default: TrueonMissingTail
- [in] The policy to follow when a tail is missing. Default: "IsError"onMissingHead
- [in] The policy to follow when a head is missing. Default: "IsError"columns
- [in] The list of columns to load. tail and head columns must be in this list if this list is specified. If the list is empty, all columns are loaded. Default: emptyattrNames
- [in] The attribute names. If this list is empty and hasHeader is set to true, the header values are used as attribute names. Default: emptydataTypes
- [in] The dataTypes of the attributes if this do not already exist. If this list is empty, the method tries to infer the data type from the first non-header row. Default: emptyattrKinds
- [in] The attributeKinds of the attributes if these do not already exist. If this list is empty, the attributeKind of the created attributes are set to Basic. Default: emptypublic static void loadNodes(Graph graph, java.lang.String fileName, java.lang.String nodeType, java.lang.String separator, boolean header, int[] columns, java.lang.String[] attrNames, DataType[] dataTypes, AttributeKind[] attrKinds)
graph
- [in] The graph to load the nodes intofileName
- [in] The name of the filenodeType
- [in] The type of the node to load. If it does not exist, it creates itseparator
- [in] The separator of the CSV file. Default: ","header
- [in] True if the CSV contains a header. False otherwise. Default: Truecolumns
- [in] The list of columns to load. tail and head columns mus be in this list if this list is specified. Default: all columnsattrNames
- [in] The attribute names. If this list is empty and hasHeader is set to true, the header values are used as attribute names. Default: emptydataTypes
- [in] The dataTypes of the attributes if this do not already exist. Default: empty If this list is empty, the method tries to infer the data type from the first non-header rowattrKinds
- [in] The attributeKinds of the attributes if these do not already exist. Default: empty If this list is empty, the attributeKind of the created attributes are set to Basic. Default: empty