-
Notifications
You must be signed in to change notification settings - Fork 274
Neo4jBatch Implementation
<dependency>
<groupId>com.tinkerpop.blueprints</groupId>
<artifactId>blueprints-neo4jbatch-graph</artifactId>
<version>??</version>
</dependency>
Graph graph = new Neo4jBatchGraph("/tmp/neo4j");
Neo4jBatchGraph
provides support for the bulk insertion of data into a Neo4j graph. This Blueprints implementation is single-threaded and non-transactional. It is meant for initial dumps of raw data into a Neo4j graph and is much faster than doing the equivalent process using Neo4jGraph
(see Neo4j Implementation).
Note: This is not a pure Blueprints implementation. Consider the following issues when using Neo4jBatchGraph
:
- Delete methods (except for Element.removeProperty()) are not supported.
- There are no default Index.VERTICES and Index.EDGES indices created at startup.
- The Neo4j “reference node” (vertex 0) is not automagically deleted upon graph creation.
Unlike Neo4jGraph
, and like TinkerGraph
, Neo4jBatchGraph
can accept a long
id on vertex creation:
long id = 1L;
graph.addVertex(id)
When utilizing Neo4jBatchGraph
it is important to make use of the flush
method on Neo4jBatchIndex
. This method must be called before querying the index for data to ensure that it returns results consistently. This method is not a standard Index
API method and thus, be sure to typecast the index to Neo4jBatchIndex
. Note that calling flush
(and using indices in general) has a noticeable impact on the performance when writing to the graph.