use of org.neo4j.server.helpers.Transactor in project neo4j by neo4j.
the class NeoWebServerJAXRSIT method createSimpleDatabase.
private static int createSimpleDatabase(final GraphDatabaseAPI graph) {
final var numberOfNodes = 10;
new Transactor(graph, tx -> {
for (var i = 0; i < numberOfNodes; i++) {
tx.createNode();
}
for (var node1 : tx.getAllNodes()) {
for (var node2 : tx.getAllNodes()) {
if (node1.equals(node2)) {
continue;
}
node1.createRelationshipTo(node2, RelationshipType.withName("REL"));
}
}
}).execute();
return numberOfNodes;
}
use of org.neo4j.server.helpers.Transactor 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