-
Notifications
You must be signed in to change notification settings - Fork 273
Batch Implementation
<dependency>
<groupId>com.tinkerpop.blueprints</groupId>
<artifactId>blueprints-core</artifactId>
<version>??</version>
</dependency>
BatchGraph
wraps any TransactionalGraph
to enable batch loading of a large number of edges and vertices by chunking the entire load into smaller batches and maintaining a memory-efficient vertex cache so that intermediate transactional states can be flushed after each chunk is loaded to release memory.
BatchGraph
is ONLY meant for loading data and does not support any retrieval or removal operations. That is, BatchGraph only supports the following methods:
-
addVertex()
for adding vertices -
addEdge()
for adding edges -
getVertex()
to be used when adding edges - Property getter, setter and removal methods for vertices and edges as well as
getId()
An important limitation of BatchGraph is that edge properties can only be set immediately after the edge has been added. If other vertices or edges have been created in the meantime, setting, getting or removing properties will throw exceptions. This is done to avoid caching of edges which would require a great amount of memory.
BatchGraph
wraps TransactionalGraph
. To wrap arbitrary graphs, use BatchGraph.wrap()
which will additionally wrap non-transactional graphs.
BatchGraph can also automatically set the provided element ids as properties on the respective element. Use setVertexIdKey()
and setEdgeIdKey()
to set the keys for the vertex and edge properties respectively. This is useful when the graph implementation ignores supplied ids and allows to make the loaded graph compatible for later wrapping with IdGraph
when setting the vertex and edge Id keys to IdGraph.ID
.