-
Notifications
You must be signed in to change notification settings - Fork 8
Versioning with Neo4j
Asaf Shakarchi edited this page Jun 8, 2014
·
9 revisions
Neo4j is a very known graph database implementation and production ready,
Using Antiquity in conjunction with Neo4j is very simple, The only thing required is to initialize a Neo4j blueprints graph instance as the base graph and wrap it with Antiquity's graph implementation,
//Create a neo4j database instance
GraphDatabaseService graph = new GraphDatabaseFactory().newEmbeddedDatabase("target/database/location");
//Wrap it with Blueprints
Neo4j2Graph neo4j2Graph = new Neo4j2Graph(graph);
neo4j2Graph.autoStartTransaction(true);
//Create Antiquity wrapper
Configuration conf = new Configuration.ConfBuilder().build();
TransactionalVersionedGraph<Neo4j2Graph, Long> vg = (TransactionalVersionedGraph) new ActiveVersionedGraph.ActiveVersionedTransactionalGraphBuilder<Neo4j2Graph, Long>(
neo4j2Graph, new LongGraphIdentifierBehavior()
).init(true).conf(conf).build();
//Do something with vg (versioned graph) here (see other usage examples)
- For more information about Blueprints Neo4jGraph implementation see: https://github.com/tinkerpop/blueprints/wiki/Neo4j-Implementation