use of org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl in project timbuctoo by HuygensING.
the class TinkerPopGraphManager method start.
@Override
public void start() throws Exception {
synchronized (graphWaitList) {
initGraphDatabaseService();
this.graph = Neo4jGraph.open(new Neo4jGraphAPIImpl(graphDatabase));
new DatabaseMigrator(this, migrations).execute();
callWaiters();
}
}
use of org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl in project timbuctoo by HuygensING.
the class TestGraphBuilder method build.
public Neo4jGraph build() {
// one is called.
if (neo4jDb == reusableNeo4jDb) {
if (trans != null) {
trans.close();
}
cleanDb(neo4jDb);
}
Neo4jGraphAPIImpl neo4jGraphApi = new Neo4jGraphAPIImpl(neo4jDb);
Neo4jGraph neo4jGraph = Neo4jGraph.open(neo4jGraphApi);
try (org.apache.tinkerpop.gremlin.structure.Transaction tx = neo4jGraph.tx()) {
final List<RelationData> requestedRelations = new LinkedList<>();
final Map<String, Vertex> identifiableVertices = new HashMap<>();
// Create all identifiable vertices
graphFragmentBuilders.forEach(builder -> {
Tuple<Vertex, String> result = builder.build(neo4jGraph, requestedRelations::add);
identifiableVertices.put(result.getRight(), result.getLeft());
});
// then we can create the relations between them
requestedRelations.forEach(relationData -> relationData.makeRelation(identifiableVertices));
tx.commit();
}
if (neo4jDb == reusableNeo4jDb) {
// we're re-using the database
// make sure we own the toplevel transaction so are guaranteed to close it
trans = neo4jDb.beginTx();
}
return neo4jGraph;
}
Aggregations