
public class OGraphBatchInsert
extends java.lang.Object
This batch insert procedure is made of four phases, that have to be executed in the correct order:
Typical usage:
//phase 1: begin
batch.begin();
//phase 2: create edges
Map<String, Object> edgeProps = new HashMap<String, Object>
edgeProps.put("foo", "bar");
batch.createEdge(0L, 1L, edgeProps);
batch.createVertex(2L);
batch.createEdge(3L, 4L, null);
...
//phase 3: set properties on vertices, THIS CAN BE DONE ONLY AFTER EDGE AND VERTEX CREATION
Map<String, Object> vertexProps = new HashMap<String, Object>
vertexProps.put("foo", "bar");
batch.setVertexProperties(0L, vertexProps)
...
//phase 4: end
batch.end();
OGraphBatchInsert batch = new OGraphBatchInsert("plocal:your/db", "admin", "admin");
There is no need to create vertices before connecting them:
batch.createVertex(0L);
batch.createVertex(1L);
batch.createEdge(0L, 1L, props);
is equivalent to (but less performing than)
batch.createEdge(0L, 1L, props);
batch.createVertex(Long) is needed only if you want to create unconnected vertices
| Constructor and Description |
|---|
OGraphBatchInsert(java.lang.String iDbURL)
Creates a new batch insert procedure by using admin user.
|
OGraphBatchInsert(java.lang.String iDbURL,
java.lang.String iUserName,
java.lang.String iPassword)
Creates a new batch insert procedure.
|
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Creates the database (if it does not exist) and initializes batch operations.
|
void |
createEdge(java.lang.Long from,
java.lang.Long to,
java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a new edge between two vertices.
|
void |
createVertex(java.lang.Long v)
Creates a new vertex
|
void |
end()
Flushes data to db and closes the db.
|
int |
getAverageEdgeNumberPerNode() |
int |
getBonsaiThreshold() |
java.lang.String |
getEdgeClass() |
int |
getEstimatedEntries()
Returns the estimated number of entries.
|
java.lang.String |
getIdPropertyName() |
int |
getParallel() |
java.lang.String |
getVertexClass() |
void |
setAverageEdgeNumberPerNode(int averageEdgeNumberPerNode)
configures the average number of edges per node (for optimization).
|
void |
setBonsaiThreshold(int bonsaiThreshold)
Sets the threshold for passing from emdedded RidBag to SBTreeBonsai implementation, in number
of edges (low level optimization).
|
void |
setEdgeClass(java.lang.String edgeClass) |
void |
setEstimatedEntries(int estimatedEntries)
Sets the estimated number of entries, 0 for auto-resize (default).
|
void |
setIdPropertyName(java.lang.String idPropertyName) |
void |
setParallel(int parallel)
sets the number of parallel threads to be used for batch insert
|
void |
setVertexClass(java.lang.String vertexClass) |
void |
setVertexProperties(java.lang.Long id,
java.util.Map<java.lang.String,java.lang.Object> properties) |
public OGraphBatchInsert(java.lang.String iDbURL)
iDbURL - db connection URL (plocal:/your/db/path)public OGraphBatchInsert(java.lang.String iDbURL,
java.lang.String iUserName,
java.lang.String iPassword)
iDbURL - db connection URL (plocal:/your/db/path)iUserName - db user name (use admin for new db)iPassword - db password (use admin for new db)public void begin()
public void end()
public void createVertex(java.lang.Long v)
v - the vertex IDpublic void createEdge(java.lang.Long from,
java.lang.Long to,
java.util.Map<java.lang.String,java.lang.Object> properties)
from - id of the vertex that is starting point of the edgeto - id of the vertex that is end point of the edgepublic void setVertexProperties(java.lang.Long id,
java.util.Map<java.lang.String,java.lang.Object> properties)
public int getAverageEdgeNumberPerNode()
public void setAverageEdgeNumberPerNode(int averageEdgeNumberPerNode)
averageEdgeNumberPerNode - public java.lang.String getIdPropertyName()
public void setIdPropertyName(java.lang.String idPropertyName)
idPropertyName - the property name where ids are written on verticespublic java.lang.String getEdgeClass()
public void setEdgeClass(java.lang.String edgeClass)
edgeClass - the edge class namepublic java.lang.String getVertexClass()
public void setVertexClass(java.lang.String vertexClass)
vertexClass - the vertex class namepublic int getBonsaiThreshold()
public void setBonsaiThreshold(int bonsaiThreshold)
See OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD}
public int getEstimatedEntries()
public void setEstimatedEntries(int estimatedEntries)
public int getParallel()
public void setParallel(int parallel)
parallel - number of threads (default 4)Copyright © 2009–2023 OrientDB. All rights reserved.