private long initWithRel( GraphDatabaseService db ) { try ( Transaction tx = db.beginTx() ) { Node node = db.createNode(); node.setProperty( "a", "prop" ); Relationship rel = node.createRelationshipTo( db.createNode(), RelationshipType.withName( "T" ) ); long id = rel.getId(); tx.success(); return id; } }
private static Node createNode( GraphDatabaseService db, String propertyKey, Object value ) { try ( Transaction tx = db.beginTx() ) { Node node = db.createNode( label( LABEL ) ); node.setProperty( propertyKey, value ); tx.success(); return node; } }
private static void bareStartAndEnd( GraphDatabaseService graphDb ) { try ( org.neo4j.graphdb.Transaction tx = graphDb.beginTx() ) { bare = graphDb.createNode().getId(); Node x = graphDb.createNode(), y = graphDb.createNode(); start = x.getId(); end = y.getId(); x.createRelationshipTo( y, withName( "GEN" ) ); tx.success(); } }
private Relationship createRelationship( Node node ) { try ( Transaction tx = node.getGraphDatabase().beginTx() ) { Relationship rel = node.createRelationshipTo( node, MyRelTypes.TEST ); tx.success(); return rel; } }
private void deleteNode( long nodeId ) { try ( Transaction tx = db.beginTx() ) { db.getNodeById( nodeId ).delete(); tx.success(); } }
private long nodeWithWhatever( GraphDatabaseService graphDb, Object value ) { Node node = graphDb.createNode( label( "What" ) ); node.setProperty( "ever", value ); return node.getId(); }
private void createRelationshipsOnNode( GraphDatabaseService db, Node root, int numberOfRelationships ) { for ( int i = 0; i < numberOfRelationships; i++ ) { root.createRelationshipTo( db.createNode(), RelationshipType.withName( "Type" + (i % 4) ) ) .setProperty( "" + i, i ); } }
private void createRelationshipsBetweenNodes( Node source, Node sink, int numberOfRelationships ) { for ( int i = 0; i < numberOfRelationships; i++ ) { source.createRelationshipTo( sink, RelationshipType.withName( "Type" + (i % 4) ) ) .setProperty( "" + i, i ); } } }
private static Node createNode( GraphDatabaseService db, String propertyKey, Object value ) { try ( Transaction tx = db.beginTx() ) { Node node = db.createNode( label( LABEL ) ); node.setProperty( propertyKey, value ); tx.success(); return node; } }
private long person( GraphDatabaseService graphDb, String firstName, String surname ) { Node node = graphDb.createNode( label( "Person" ) ); node.setProperty( "firstname", firstName ); node.setProperty( "surname", surname ); return node.getId(); } }
private long createNodeWithLabel( String labelName ) { long node; try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { node = graphDb.createNode( label( labelName ) ).getId(); ctx.success(); } return node; }
private long nodeWithProp( GraphDatabaseService graphDb, Object value ) { Node node = graphDb.createNode( label( "Node" ) ); node.setProperty( "prop", value ); return node.getId(); }
private void createData() { Label label = Label.label( "toRetry" ); try ( Transaction transaction = database.beginTx() ) { Node node = database.createNode( label ); node.setProperty( "c", "d" ); transaction.success(); } }
private void createSomeData( Label label, String propertyKey ) { try ( Transaction tx = db.beginTx() ) { Node node = db.createNode( label ); node.setProperty( propertyKey, "yeah" ); tx.success(); } } }
private static Node createNodeWithProperty( GraphDatabaseService db, String key, Object value ) { try ( Transaction tx = db.beginTx() ) { Node node = db.createNode(); node.setProperty( key, value ); tx.success(); return node; } }
private long initWithNode( GraphDatabaseService db ) { try ( Transaction tx = db.beginTx() ) { Node theNode = db.createNode(); long id = theNode.getId(); tx.success(); return id; } }
private void createAliens() { try ( Transaction tx = db.beginTx() ) { for ( int i = 0; i < 32; i++ ) { Node alien = db.createNode( ALIEN ); alien.setProperty( SPECIMEN, i / 2 ); } tx.success(); } }
private static void createNode( GraphDatabaseService database, String propertyName, Label testLabel ) { try ( Transaction transaction = database.beginTx() ) { Node node = database.createNode( testLabel ); node.setProperty( propertyName, "value" ); transaction.success(); } }
private long createNodeWithProperty( String propertyKey, Object value ) { Node node; try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { node = graphDb.createNode(); node.setProperty( propertyKey, value ); ctx.success(); } return node.getId(); }
private long createNode() { long node; try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { node = graphDb.createNode().getId(); ctx.success(); } return node; }