use of org.neo4j.server.helpers.UnitOfWork in project neo4j by neo4j.
the class NeoServerJAXRSIT method createSimpleDatabase.
private int createSimpleDatabase(final GraphDatabaseAPI graph) {
final int numberOfNodes = 10;
new Transactor(graph, new UnitOfWork() {
@Override
public void doWork() {
for (int i = 0; i < numberOfNodes; i++) {
graph.createNode();
}
for (Node n1 : graph.getAllNodes()) {
for (Node n2 : graph.getAllNodes()) {
if (n1.equals(n2)) {
continue;
}
n1.createRelationshipTo(n2, RelationshipType.withName("REL"));
}
}
}
}).execute();
return numberOfNodes;
}
Aggregations