//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.internal.kernel.api.IndexReference createIndex(org.neo4j.internal.kernel.api.Transaction transaction) throws org.neo4j.internal.kernel.api.exceptions.schema.SchemaKernelException, org.neo4j.internal.kernel.api.exceptions.InvalidTransactionTypeKernelException private IndexReference CreateIndex([email protected] transaction) { TokenWrite tokenWrite = transaction.TokenWrite(); SchemaWrite schemaWrite = transaction.SchemaWrite(); LabelSchemaDescriptor schemaDescriptor = forLabel(tokenWrite.LabelGetOrCreateForName("hello"), tokenWrite.PropertyKeyGetOrCreateForName("hepp")); return(schemaWrite.IndexCreate(schemaDescriptor)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void createConstraint(String key, String property) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal override void CreateConstraint(string key, string property) { TokenWrite tokenWrite = TokenWriteInNewTransaction(); int label = tokenWrite.LabelGetOrCreateForName(key); int propertyKey = tokenWrite.PropertyKeyGetOrCreateForName(property); Commit(); SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); schemaWrite.NodeKeyConstraintCreate(forLabel(label, propertyKey)); Commit(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void createConstraint(String key, String property) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal override void CreateConstraint(string key, string property) { TokenWrite tokenWrite = TokenWriteInNewTransaction(); int relTypeId = tokenWrite.RelationshipTypeGetOrCreateForName(key); int propertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName(property); Commit(); SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); schemaWrite.RelationshipPropertyExistenceConstraintCreate(forRelType(relTypeId, propertyKeyId)); Commit(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void createConstraint(String label, String propertyKey) throws org.neo4j.internal.kernel.api.exceptions.KernelException private void CreateConstraint(string label, string propertyKey) { int labelId; int propertyKeyId; TokenWrite tokenWrite = TokenWriteInNewTransaction(); labelId = tokenWrite.LabelGetOrCreateForName(label); propertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName(propertyKey); Commit(); SchemaWrite schemaWrite = SchemaWriteInNewTransaction(); schemaWrite.UniquePropertyConstraintCreate(forLabel(labelId, propertyKeyId)); Commit(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldComputeDegreeWithType() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldComputeDegreeWithType() { // GIVEN long node; int @in, @out, loop; using (Transaction tx = Transaction()) { Write write = tx.DataWrite(); node = write.NodeCreate(); TokenWrite tokenWrite = tx.TokenWrite(); @out = tokenWrite.RelationshipTypeGetOrCreateForName("OUT"); @in = tokenWrite.RelationshipTypeGetOrCreateForName("IN"); loop = tokenWrite.RelationshipTypeGetOrCreateForName("LOOP"); write.RelationshipCreate(node, @out, write.NodeCreate()); write.RelationshipCreate(node, @out, write.NodeCreate()); write.RelationshipCreate(write.NodeCreate(), @in, node); write.RelationshipCreate(node, loop, node); tx.Success(); } using (Transaction tx = Transaction()) { Read read = tx.DataRead(); CursorFactory cursors = tx.Cursors(); using (NodeCursor nodes = cursors.AllocateNodeCursor()) { assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, @out), equalTo(2)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, @in), equalTo(0)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, OUTGOING, loop), equalTo(1)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, @out), equalTo(0)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, @in), equalTo(1)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, INCOMING, loop), equalTo(1)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, @out), equalTo(2)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, @in), equalTo(1)); assertThat(nodeGetDegreeIfDense(read, node, nodes, cursors, BOTH, loop), equalTo(1)); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: int initializeLabelOrRelType(org.neo4j.internal.kernel.api.TokenWrite tokenWrite, String name) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal override int InitializeLabelOrRelType(TokenWrite tokenWrite, string name) { return(tokenWrite.LabelGetOrCreateForName(name)); }