Exemple #1
0
 public IndexDescriptor(SchemaDescriptor schema, Type type, Optional <string> userSuppliedName, IndexProviderDescriptor providerDescriptor)
 {
     this.SchemaConflict             = schema;
     this.TypeConflict               = type;
     this.UserSuppliedNameConflict   = userSuppliedName;
     this.ProviderDescriptorConflict = providerDescriptor;
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOnlyIndexIndexedProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOnlyIndexIndexedProperties()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);

            long firstID;

            using (Transaction tx = Db.beginTx())
            {
                firstID = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                SetNodeProp(firstID, "prop2", "zebra");

                Node node2 = Db.createNode(Label);
                node2.SetProperty("prop2", "zebra");
                node2.SetProperty("prop3", "hello");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", firstID);
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zebra");
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSearchAcrossMultipleProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSearchAcrossMultipleProperties()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, "prop", "prop2");
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);

            long firstID;
            long secondID;
            long thirdID;

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Tomtar tomtar oftsat i tomteutstyrsel.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "Olof och Hans");
                SetNodeProp(secondID, "prop2", "och karl");

                Node node3 = Db.createNode(Label);
                thirdID = node3.Id;
                node3.SetProperty("prop2", "Tomtar som inte tomtar ser upp till tomtar som tomtar.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "tomtar Karl", firstID, secondID, thirdID);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToSpecifySwedishAnalyzer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToSpecifySwedishAnalyzer()
        {
            ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, SWEDISH);
            SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
            IndexReference   nodes;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                SchemaWrite schemaWrite = transaction.SchemaWrite();
                nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes");
                transaction.Success();
            }
            Await(nodes);

            long id;

            using (Transaction tx = Db.beginTx())
            {
                id = CreateNodeIndexableByPropertyValue(Label, "Hello and hello again, in the end.");
                CreateNodeIndexableByPropertyValue(Label, "En apa och en tomte bodde i ett hus.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, "nodes", "and", id);
                AssertQueryFindsIds(ktx, "nodes", "in", id);
                AssertQueryFindsIds(ktx, "nodes", "the", id);
                AssertQueryFindsNothing(ktx, "nodes", "en");
                AssertQueryFindsNothing(ktx, "nodes", "och");
                AssertQueryFindsNothing(ktx, "nodes", "ett");
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToSpecifyFoldingAnalyzer() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToSpecifyFoldingAnalyzer()
        {
            ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, FOLDING);
            SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
            IndexReference   nodes;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                SchemaWrite schemaWrite = transaction.SchemaWrite();
                nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes");
                transaction.Success();
            }
            Await(nodes);

            long id;

            using (Transaction tx = Db.beginTx())
            {
                id = CreateNodeIndexableByPropertyValue(Label, "Příliš žluťoučký kůň úpěl ďábelské ódy.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, "nodes", "prilis", id);
                AssertQueryFindsIds(ktx, "nodes", "zlutoucky", id);
                AssertQueryFindsIds(ktx, "nodes", "kun", id);
                AssertQueryFindsIds(ktx, "nodes", "upel", id);
                AssertQueryFindsIds(ktx, "nodes", "dabelske", id);
                AssertQueryFindsIds(ktx, "nodes", "ody", id);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotReturnNonMatches() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotReturnNonMatches()
        {
            SchemaDescriptor nodes = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
            SchemaDescriptor rels  = FulltextAdapter.schemaFor(RELATIONSHIP, new string[] { Reltype.name() }, Settings, PROP);
            IndexReference   nodesIndex;
            IndexReference   relsIndex;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                nodesIndex = tx.SchemaWrite().indexCreate(nodes, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                relsIndex  = tx.SchemaWrite().indexCreate(rels, FulltextIndexProviderFactory.Descriptor.name(), REL_INDEX_NAME);
                tx.Success();
            }
            Await(nodesIndex);
            Await(relsIndex);
            using (Transaction tx = Db.beginTx())
            {
                long firstNode  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                long secondNode = CreateNodeWithProperty(Label, "prop2", "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid.");
                CreateRelationshipIndexableByPropertyValue(firstNode, secondNode, "Hello. Hello again.");
                CreateRelationshipWithProperty(secondNode, firstNode, "prop2", "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid.");

                tx.Success();
            }
            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zebra");
                AssertQueryFindsNothing(ktx, REL_INDEX_NAME, "zebra");
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindNodeWithString() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindNodeWithString()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);
            long firstID;
            long secondID;

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", firstID);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "zebra", secondID);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "zedonk", secondID);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "cross", secondID);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToUpdateAndQueryAfterIndexChange() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToUpdateAndQueryAfterIndexChange()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);

            long firstID;
            long secondID;
            long thirdID;
            long fourthID;

            using (Transaction tx = Db.beginTx())
            {
                firstID = CreateNodeIndexableByPropertyValue(Label, "thing");

                secondID = Db.createNode(Label).Id;
                SetNodeProp(secondID, "prop2", "zebra");

                thirdID = CreateNodeIndexableByPropertyValue(Label, "zebra");
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "thing zebra", firstID, thirdID);
            }

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, "prop2");
                tx.SchemaWrite().indexDrop(index);
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);

            using (Transaction tx = Db.beginTx())
            {
                SetNodeProp(firstID, "prop2", "thing");

                fourthID = Db.createNode(Label).Id;
                SetNodeProp(fourthID, "prop2", "zebra");
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "thing zebra", firstID, secondID, fourthID);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotFindRemovedProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotFindRemovedProperties()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, "prop", "prop2");
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);
            long firstID;
            long secondID;
            long thirdID;

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid.");
                thirdID  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");

                SetNodeProp(firstID, "zebra");
                SetNodeProp(secondID, "Hello. Hello again.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                Node node  = Db.getNodeById(firstID);
                Node node2 = Db.getNodeById(secondID);
                Node node3 = Db.getNodeById(thirdID);

                node.SetProperty("prop", "tomtar");
                node.SetProperty("prop2", "tomtar");

                node2.SetProperty("prop", "tomtar");
                node2.SetProperty("prop2", "Hello");

                node3.RemoveProperty("prop");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", secondID);
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zebra");
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zedonk");
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "cross");
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotReindexNodesWhenDefaultAnalyzerIsChanged() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotReindexNodesWhenDefaultAnalyzerIsChanged()
        {
            long firstID;
            long secondID;

            ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, ENGLISH);
            SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
            IndexReference   nodes;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                SchemaWrite schemaWrite = transaction.SchemaWrite();
                nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes");
                transaction.Success();
            }
            Await(nodes);

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Hello and hello again, in the end.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "En apa och en tomte bodde i ett hus.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsNothing(ktx, "nodes", "and");
                AssertQueryFindsNothing(ktx, "nodes", "in");
                AssertQueryFindsNothing(ktx, "nodes", "the");
                AssertQueryFindsIds(ktx, "nodes", "en", secondID);
                AssertQueryFindsIds(ktx, "nodes", "och", secondID);
                AssertQueryFindsIds(ktx, "nodes", "ett", secondID);
            }

            ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, SWEDISH);
            using (KernelTransactionImplementation ktx = KernelTransaction)
            {
                SchemaRead schemaRead = ktx.SchemaRead();
                Await(schemaRead.IndexGetForName("nodes"));
                // These results should be exactly the same as before the configuration change and restart.
                AssertQueryFindsNothing(ktx, "nodes", "and");
                AssertQueryFindsNothing(ktx, "nodes", "in");
                AssertQueryFindsNothing(ktx, "nodes", "the");
                AssertQueryFindsIds(ktx, "nodes", "en", secondID);
                AssertQueryFindsIds(ktx, "nodes", "och", secondID);
                AssertQueryFindsIds(ktx, "nodes", "ett", secondID);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPopulateIndexWithExistingNodesAndRelationships() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPopulateIndexWithExistingNodesAndRelationships()
        {
            long firstNodeID;
            long secondNodeID;
            long firstRelID;
            long secondRelID;

            using (Transaction tx = Db.beginTx())
            {
                // skip a few rel ids, so the ones we work with are different from the node ids, just in case.
                Node node = Db.createNode();
                node.CreateRelationshipTo(node, Reltype);
                node.CreateRelationshipTo(node, Reltype);
                node.CreateRelationshipTo(node, Reltype);

                firstNodeID  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                secondNodeID = CreateNodeIndexableByPropertyValue(Label, "This string is slightly shorter than the zebra one");
                firstRelID   = CreateRelationshipIndexableByPropertyValue(firstNodeID, secondNodeID, "Goodbye");
                secondRelID  = CreateRelationshipIndexableByPropertyValue(secondNodeID, firstNodeID, "And now, something completely different");

                tx.Success();
            }

            SchemaDescriptor nodes = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
            SchemaDescriptor rels  = FulltextAdapter.schemaFor(RELATIONSHIP, new string[] { Reltype.name() }, Settings, PROP);
            IndexReference   nodesIndex;
            IndexReference   relsIndex;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                nodesIndex = tx.schemaWrite().indexCreate(nodes, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                relsIndex  = tx.schemaWrite().indexCreate(rels, FulltextIndexProviderFactory.Descriptor.name(), REL_INDEX_NAME);
                tx.Success();
            }
            Await(nodesIndex);
            Await(relsIndex);
            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", firstNodeID);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "string", secondNodeID);
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "goodbye");
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "different");

                AssertQueryFindsNothing(ktx, REL_INDEX_NAME, "hello");
                AssertQueryFindsNothing(ktx, REL_INDEX_NAME, "string");
                AssertQueryFindsIds(ktx, REL_INDEX_NAME, "goodbye", firstRelID);
                AssertQueryFindsIds(ktx, REL_INDEX_NAME, "different", secondRelID);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOrderResultsBasedOnRelevance() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOrderResultsBasedOnRelevance()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, "first", "last");
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);
            long firstID;
            long secondID;
            long thirdID;
            long fourthID;

            using (Transaction tx = Db.beginTx())
            {
                firstID  = Db.createNode(Label).Id;
                secondID = Db.createNode(Label).Id;
                thirdID  = Db.createNode(Label).Id;
                fourthID = Db.createNode(Label).Id;
                SetNodeProp(firstID, "first", "Full");
                SetNodeProp(firstID, "last", "Hanks");
                SetNodeProp(secondID, "first", "Tom");
                SetNodeProp(secondID, "last", "Hunk");
                SetNodeProp(thirdID, "first", "Tom");
                SetNodeProp(thirdID, "last", "Hanks");
                SetNodeProp(fourthID, "first", "Tom Hanks");
                SetNodeProp(fourthID, "last", "Tom Hanks");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIdsInOrder(ktx, NODE_INDEX_NAME, "Tom Hanks", fourthID, thirdID, firstID, secondID);
            }
        }
Exemple #13
0
        internal IndexCheck(StoreIndexDescriptor indexRule)
        {
            this._indexRule = indexRule;
            SchemaDescriptor schema = indexRule.Schema();

            int[]  entityTokenIntIds  = Schema.EntityTokenIds;
            long[] entityTokenLongIds = new long[entityTokenIntIds.Length];
            for (int i = 0; i < entityTokenIntIds.Length; i++)
            {
                entityTokenLongIds[i] = entityTokenIntIds[i];
            }
            [email protected]_PropertySchemaType propertySchemaType = Schema.propertySchemaType();
            _entityType = Schema.entityType();
            if (_entityType == EntityType.NODE)
            {
                _nodeChecker = new NodeInUseWithCorrectLabelsCheck <IndexEntry, Org.Neo4j.Consistency.report.ConsistencyReport_IndexConsistencyReport>(entityTokenLongIds, propertySchemaType, false);
            }
            if (_entityType == EntityType.RELATIONSHIP)
            {
                _relationshipChecker = new RelationshipInUseWithCorrectRelationshipTypeCheck <IndexEntry, Org.Neo4j.Consistency.report.ConsistencyReport_IndexConsistencyReport>(entityTokenLongIds);
            }
        }
Exemple #14
0
 private CreateConstraintFailureException PropertyExistenceConstraintsNotAllowed(SchemaDescriptor descriptor)
 {
     // When creating a Property Existence Constraint in Community Edition
     return(new CreateConstraintFailureException(ConstraintDescriptorFactory.existsForSchema(descriptor), ERROR_MESSAGE_EXISTS));
 }
Exemple #15
0
 public SchemaRuleNotFoundException(Org.Neo4j.Storageengine.Api.schema.SchemaRule_Kind kind, SchemaDescriptor descriptor) : base(org.neo4j.kernel.api.exceptions.Status_Schema.SchemaRuleAccessFailed, NOT_FOUND_MESSAGE_TEMPLATE, kind, descriptor)
 {
 }
 public AlreadyIndexedException(SchemaDescriptor descriptor, OperationContext context) : base(org.neo4j.kernel.api.exceptions.Status_Schema.IndexAlreadyExists, ConstructUserMessage(context, SchemaUtil.idTokenNameLookup, descriptor))
 {
     this._descriptor = descriptor;
     this._context    = context;
 }
 public DropIndexFailureException(SchemaDescriptor descriptor, SchemaKernelException cause) : base(org.neo4j.kernel.api.exceptions.Status_Schema.IndexDropFailed, format(MESSAGE, descriptor.UserDescription(SchemaUtil.idTokenNameLookup), cause.Message), cause)
 {
     this._descriptor = descriptor;
 }
Exemple #18
0
 public static IndexDescriptor ForSchema(SchemaDescriptor schema, Optional <string> name, IndexProviderDescriptor providerDescriptor)
 {
     return(new IndexDescriptor(schema, GENERAL, name, providerDescriptor));
 }
        private static string ConstructUserMessage(OperationContext context, TokenNameLookup tokenNameLookup, SchemaDescriptor descriptor)
        {
            switch (context)
            {
            case SchemaKernelException.OperationContext.INDEX_CREATION:
                return(MessageWithLabelAndPropertyName(tokenNameLookup, INDEX_CONTEXT_FORMAT, descriptor));

            case SchemaKernelException.OperationContext.CONSTRAINT_CREATION:
                return(MessageWithLabelAndPropertyName(tokenNameLookup, _constraintContextFormat, descriptor));

            default:
                return(string.format(NO_CONTEXT_FORMAT, descriptor));
            }
        }
Exemple #20
0
 public RepeatedRelationshipTypeInSchemaException(SchemaDescriptor schema, OperationContext context) : base(org.neo4j.kernel.api.exceptions.Status_Schema.RepeatedRelationshipTypeInSchema, schema, context, SchemaComponent.RelationshipType)
 {
 }
Exemple #21
0
 public static IndexDescriptor UniqueForSchema(SchemaDescriptor schema)
 {
     return(UniqueForSchema(schema, UNDECIDED));
 }
Exemple #22
0
 public static IndexEntryUpdate <SchemaDescriptor> Change(long nodeId, SchemaDescriptor schema, object[] o1, object[] o2)
 {
     return(IndexEntryUpdate.Change(nodeId, schema, ToValues(o1), ToValues(o2)));
 }
Exemple #23
0
 public static IndexDescriptor UniqueForSchema(SchemaDescriptor schema, IndexProviderDescriptor providerDescriptor)
 {
     return(UniqueForSchema(schema, null, providerDescriptor));
 }
Exemple #24
0
 public static IndexEntryUpdate <SchemaDescriptor> Remove(long nodeId, SchemaDescriptor schema, params object[] objects)
 {
     return(IndexEntryUpdate.Remove(nodeId, schema, ToValues(objects)));
 }
Exemple #25
0
 public DuplicateSchemaRuleException(Org.Neo4j.Storageengine.Api.schema.SchemaRule_Kind kind, SchemaDescriptor descriptor) : base(org.neo4j.kernel.api.exceptions.Status_Schema.SchemaRuleDuplicateFound, NOT_FOUND_MESSAGE_TEMPLATE, kind, descriptor)
 {
 }
Exemple #26
0
 private CreateConstraintFailureException NodeKeyConstraintsNotAllowed(SchemaDescriptor descriptor)
 {
     // When creating a Node Key Constraint in Community Edition
     return(new CreateConstraintFailureException(ConstraintDescriptorFactory.existsForSchema(descriptor), ERROR_MESSAGE_NODE_KEY));
 }
Exemple #27
0
 public static IndexDescriptor UniqueForSchema(SchemaDescriptor schema, Optional <string> name, IndexProviderDescriptor providerDescriptor)
 {
     return(new IndexDescriptor(schema, UNIQUE, name, providerDescriptor));
 }
 private StoreIndexDescriptor StoreIndexDescriptorFromSchema(SchemaDescriptor schema)
 {
     return((new IndexDescriptor(schema, GENERAL, "indexName", UNDECIDED)).withId(1));
 }
Exemple #29
0
 public RepeatedPropertyInSchemaException(SchemaDescriptor schema, OperationContext context) : base(org.neo4j.kernel.api.exceptions.Status_Schema.RepeatedPropertyInCompositeSchema, schema, context, SchemaComponent.Property)
 {
 }
Exemple #30
0
 public NoSuchIndexException(SchemaDescriptor descriptor) : base(org.neo4j.kernel.api.exceptions.Status_Schema.IndexNotFound, format(MESSAGE, descriptor.UserDescription(SchemaUtil.idTokenNameLookup)))
 {
     this._descriptor = descriptor;
 }