Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static org.neo4j.storageengine.api.schema.IndexDescriptor createAnIndex(HighlyAvailableGraphDatabase db, org.neo4j.graphdb.Label label, String propertyName) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        private static IndexDescriptor CreateAnIndex(HighlyAvailableGraphDatabase db, Label label, string propertyName)
        {
            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx        = KernelTransaction(db);
                int            labelId       = ktx.TokenWrite().labelGetOrCreateForName(label.Name());
                int            propertyKeyId = ktx.TokenWrite().propertyKeyGetOrCreateForName(propertyName);
                IndexReference index         = ktx.SchemaWrite().indexCreate(SchemaDescriptorFactory.forLabel(labelId, propertyKeyId));
                tx.Success();
                return(( IndexDescriptor )index);
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void createCompositeIndex(org.neo4j.graphdb.GraphDatabaseService graphDb, String label, String... properties) throws Exception
        protected internal override void CreateCompositeIndex(GraphDatabaseService graphDb, string label, params string[] properties)
        {
            GraphDatabaseAPI  @internal   = ( GraphDatabaseAPI )graphDb;
            KernelTransaction ktx         = @internal.DependencyResolver.resolveDependency(typeof(ThreadToStatementContextBridge)).getKernelTransactionBoundToThisThread(true);
            SchemaWrite       schemaWrite = ktx.SchemaWrite();
            TokenWrite        token       = ktx.TokenWrite();

            schemaWrite.IndexCreate(SchemaDescriptorFactory.forLabel(token.LabelGetOrCreateForName("Person"), token.PropertyKeyGetOrCreateForName("firstname"), token.PropertyKeyGetOrCreateForName("surname")));
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mixingBeansApiWithKernelAPI() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MixingBeansApiWithKernelAPI()
        {
            // 1: Start your transactions through the Beans API
            Transaction transaction = Db.beginTx();

            // 2: Get a hold of a KernelAPI transaction this way:
            KernelTransaction ktx = StatementContextSupplier.getKernelTransactionBoundToThisThread(true);

            // 3: Now you can interact through both the statement context and the kernel API to manipulate the
            //    same transaction.
            Node node = Db.createNode();

            int labelId = ktx.TokenWrite().labelGetOrCreateForName("labello");

            ktx.DataWrite().nodeAddLabel(node.Id, labelId);

            // 4: Commit through the beans API
            transaction.Success();
            transaction.Close();
        }
Beispiel #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int createRelTypeId(String name) throws Exception
        private int CreateRelTypeId(string name)
        {
            KernelTransaction ktx = ktx();

            return(ktx.TokenWrite().relationshipTypeGetOrCreateForName(name));
        }
Beispiel #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int createPropertyKey(String name) throws Exception
        private int CreatePropertyKey(string name)
        {
            KernelTransaction ktx = ktx();

            return(ktx.TokenWrite().propertyKeyGetOrCreateForName(name));
        }
Beispiel #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int createLabel(String name) throws Exception
        private int CreateLabel(string name)
        {
            KernelTransaction ktx = ktx();

            return(ktx.TokenWrite().labelGetOrCreateForName(name));
        }