private int createPropertyKeyToken( String name ) { return (int) nextId( PropertyKeyTokenRecord.class ); }
int relType1 = (int) nextId( RelationshipType.class ); transaction.relationshipTypeDoCreateForName( "relationshiptype1", relType1 ); long[] nodeIds = new long[8]; for ( int i = 0; i < nodeIds.length; i++ ) nodeIds[i] = nextId( Node.class ); transaction.nodeDoCreate( nodeIds[i] ); transaction.relationshipDoCreate( nextId( Relationship.class ), relType1, nodeIds[i], nodeIds[i * 2] ); long rel5 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel5, relType1, nodeIds[0], nodeIds[5] ); long rel2 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel2, relType1, nodeIds[1], nodeIds[2] ); long rel3 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel3, relType1, nodeIds[1], nodeIds[3] ); long rel6 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel6, relType1, nodeIds[1], nodeIds[6] ); long rel1 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel1, relType1, nodeIds[0], nodeIds[1] ); long rel4 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel4, relType1, nodeIds[0], nodeIds[4] ); long rel7 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel7, relType1, nodeIds[0], nodeIds[7] ); commitTx();
int relType1 = (int) nextId( RelationshipType.class ); String typeName = "relationshiptype1"; transaction.relationshipTypeDoCreateForName( typeName, relType1 ); for ( int i = 0; i < 3; i++ ) nodeIds[i] = nextId( Node.class ); transaction.nodeDoCreate( nodeIds[i] ); nodeAddProperty( nodeIds[i], index( "nisse" ), 10 - i ); transaction.relationshipDoCreate( nextId( Relationship.class ), relType1, nodeIds[i], nodeIds[i + 1] ); transaction.relationshipDoCreate( nextId( Relationship.class ), relType1, nodeIds[0], nodeIds[2] ); commitTx();
@Test public void testRels1() throws Exception { initializeStores( databaseLayout, stringMap() ); startTx(); int relType1 = (int) nextId( RelationshipType.class ); String typeName = "relationshiptype1"; transaction.relationshipTypeDoCreateForName( typeName, relType1 ); long[] nodeIds = new long[3]; for ( int i = 0; i < 3; i++ ) { nodeIds[i] = nextId( Node.class ); transaction.nodeDoCreate( nodeIds[i] ); nodeAddProperty( nodeIds[i], index( "nisse" ), 10 - i ); } for ( int i = 0; i < 2; i++ ) { transaction.relationshipDoCreate( nextId( Relationship.class ), relType1, nodeIds[i], nodeIds[i + 1] ); } commitTx(); startTx(); for ( int i = 0; i < 3; i += 2 ) { deleteRelationships( nodeIds[i] ); transaction.nodeDoDelete( nodeIds[i] ); } commitTx(); ds.stop(); }
startTx(); long node1 = nextId( Node.class ); transaction.nodeDoCreate( node1 ); long node2 = nextId( Node.class ); transaction.nodeDoCreate( node2 ); StorageProperty n1prop1 = nodeAddProperty( node1, index( "prop1" ), "string1" ); StorageProperty n2prop3 = nodeAddProperty( node2, index( "prop3" ), false ); int relType1 = (int) nextId( RelationshipType.class ); String typeName1 = "relationshiptype1"; transaction.relationshipTypeDoCreateForName( typeName1, relType1 ); int relType2 = (int) nextId( RelationshipType.class ); String typeName2 = "relationshiptype2"; transaction.relationshipTypeDoCreateForName( typeName2, relType2 ); long rel1 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel1, relType1, node1, node2 ); long rel2 = nextId( Relationship.class ); transaction.relationshipDoCreate( rel2, relType2, node2, node1 ); nodeIds[i] = nextId( Node.class ); transaction.nodeDoCreate( nodeIds[i] ); nodeAddProperty( nodeIds[i], index( "nisse" ), 10 - i ); long id = nextId( Relationship.class ); transaction.relationshipDoCreate( id, relType1, nodeIds[i], nodeIds[i + 1] ); transaction.relationshipDoDelete( id, relType1, nodeIds[i], nodeIds[i + 1] );
@Test public void testProps1() throws Exception { initializeStores( databaseLayout, stringMap() ); startTx(); long nodeId = nextId( Node.class ); transaction.nodeDoCreate( nodeId ); pStore.nextId(); StorageProperty prop = nodeAddProperty( nodeId, index( "nisse" ), 10 ); commitTx(); ds.stop(); initializeStores( databaseLayout, stringMap() ); startTx(); StorageProperty prop2 = nodeAddProperty( nodeId, prop.propertyKeyId(), 5 ); transaction.nodeDoRemoveProperty( nodeId, prop2.propertyKeyId() ); transaction.nodeDoDelete( nodeId ); commitTx(); ds.stop(); }