Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldListAllConstraints()
        public virtual void ShouldListAllConstraints()
        {
            // Given
            SchemaHelper.createUniquenessConstraint(Db, Label1, PropertyKey);
            SchemaHelper.createUniquenessConstraint(Db, Label2, PropertyKey);
            SchemaHelper.createNodeKeyConstraint(Db, Label1, OtherPropertyKey);
            SchemaHelper.createNodeKeyConstraint(Db, Label2, OtherPropertyKey);

            SchemaHelper.createNodePropertyExistenceConstraint(Db, Label2, PropertyKey);
            SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, PropertyKey);

            SchemaHelper.awaitIndexes(Db);

            // When
            ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetAll());

            // Then
            int labelId1   = LabelId(Label1);
            int labelId2   = LabelId(Label2);
            int relTypeId  = RelationshipTypeId(RelType1);
            int propKeyId  = PropertyKeyId(PropertyKey);
            int propKeyId2 = PropertyKeyId(OtherPropertyKey);

            assertThat(constraints, containsInAnyOrder(ConstraintDescriptorFactory.uniqueForLabel(labelId1, propKeyId), ConstraintDescriptorFactory.uniqueForLabel(labelId2, propKeyId), ConstraintDescriptorFactory.nodeKeyForLabel(labelId1, propKeyId2), ConstraintDescriptorFactory.nodeKeyForLabel(labelId2, propKeyId2), ConstraintDescriptorFactory.existsForLabel(labelId2, propKeyId), ConstraintDescriptorFactory.existsForRelType(relTypeId, propKeyId)));
        }
Ejemplo n.º 2
0
        private ConstraintDescriptor UniqueConstraintDescriptor(Label label, string propertyKey)
        {
            int labelId   = labelId(label);
            int propKeyId = PropertyKeyId(propertyKey);

            return(ConstraintDescriptorFactory.uniqueForLabel(labelId, propKeyId));
        }
Ejemplo n.º 3
0
        private void GivenUniqueConstraint(string label, string propKey)
        {
            int labelId = Token(label, _labels).Value;
            int propId  = Token(propKey, _propKeys).Value;

            IndexReference index = IndexDescriptorFactory.uniqueForSchema(forLabel(labelId, propId), EMPTY.ProviderDescriptor);

            _uniqueIndexes.Add(index);
            _constraints.Add(ConstraintDescriptorFactory.uniqueForLabel(labelId, propId));
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnCorrectUniquenessRuleForLabelAndProperty() throws org.neo4j.kernel.api.exceptions.schema.SchemaRuleNotFoundException, org.neo4j.kernel.api.exceptions.schema.DuplicateSchemaRuleException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnCorrectUniquenessRuleForLabelAndProperty()
        {
            // Given
            CreateSchema(UniquenessConstraint(LABEL1, PROP1), UniquenessConstraint(LABEL2, PROP1));

            // When
            ConstraintRule rule = _storage.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(LabelId(LABEL1), PropId(PROP1)));

            // Then
            assertNotNull(rule);
            AssertRule(rule, LABEL1, PROP1, Org.Neo4j.@internal.Kernel.Api.schema.constraints.ConstraintDescriptor_Type.Unique);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void constraintPropertyIdsNotUpdatedByConstraintEnforcer()
        public virtual void ConstraintPropertyIdsNotUpdatedByConstraintEnforcer()
        {
            UniquenessConstraintDescriptor   uniquenessConstraint = ConstraintDescriptorFactory.uniqueForLabel(1, 1, 70, 8);
            NodeKeyConstraintDescriptor      nodeKeyConstraint    = ConstraintDescriptorFactory.nodeKeyForLabel(2, 12, 7, 13);
            RelExistenceConstraintDescriptor relTypeConstraint    = ConstraintDescriptorFactory.existsForRelType(3, 5, 13, 8);
            IList <ConstraintDescriptor>     descriptors          = Arrays.asList(uniquenessConstraint, nodeKeyConstraint, relTypeConstraint);

            StorageReader storageReader = PrepareStorageReaderMock(descriptors);

            PropertyExistenceEnforcer.GetOrCreatePropertyExistenceEnforcerFrom(storageReader);

            assertArrayEquals("Property ids should remain untouched.", new int[] { 1, 70, 8 }, uniquenessConstraint.Schema().PropertyIds);
            assertArrayEquals("Property ids should remain untouched.", new int[] { 12, 7, 13 }, nodeKeyConstraint.Schema().PropertyIds);
            assertArrayEquals("Property ids should remain untouched.", new int[] { 5, 13, 8 }, relTypeConstraint.Schema().PropertyIds);
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void committedConstraintRuleShouldCrossReferenceTheCorrespondingIndexRule() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CommittedConstraintRuleShouldCrossReferenceTheCorrespondingIndexRule()
        {
            // when
            SchemaWrite statement = schemaWriteInNewTransaction();

            statement.UniquePropertyConstraintCreate(Descriptor);
            commit();

            // then
            SchemaStorage        schema         = new SchemaStorage(NeoStores().SchemaStore);
            StoreIndexDescriptor indexRule      = Schema.indexGetForSchema(TestIndexDescriptorFactory.uniqueForLabel(TypeId, PropertyKeyId));
            ConstraintRule       constraintRule = Schema.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(TypeId, PropertyKeyId));

            assertEquals(constraintRule.Id, indexRule.OwningConstraint.Value);
            assertEquals(indexRule.Id, constraintRule.OwnedIndex);
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionOnNodeDuplicateRuleFound() throws org.neo4j.kernel.api.exceptions.schema.DuplicateSchemaRuleException, org.neo4j.kernel.api.exceptions.schema.SchemaRuleNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowExceptionOnNodeDuplicateRuleFound()
        {
            // GIVEN
            TokenNameLookup tokenNameLookup = DefaultTokenNameLookup;

            SchemaStorage schemaStorageSpy = Mockito.spy(_storage);

            Mockito.when(schemaStorageSpy.LoadAllSchemaRules(any(), any(), anyBoolean())).thenReturn(Iterators.iterator(GetUniquePropertyConstraintRule(1L, LABEL1, PROP1), GetUniquePropertyConstraintRule(2L, LABEL1, PROP1)));

            //EXPECT
            ExpectedException.expect(typeof(DuplicateSchemaRuleException));
            ExpectedException.expect(new KernelExceptionUserMessageMatcher(tokenNameLookup, "Multiple uniqueness constraints found for :Label1(prop1)."));

            // WHEN
            schemaStorageSpy.ConstraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(LabelId(LABEL1), PropId(PROP1)));
        }
Ejemplo n.º 8
0
 private void ExerciseVisitor(System.Func <object, DbStructureVisitor> visitor)
 {
     visitor(null).visitLabel(0, "Person");
     visitor(null).visitLabel(1, "Party");
     visitor(null).visitPropertyKey(0, "name");
     visitor(null).visitPropertyKey(2, "lastName");
     visitor(null).visitPropertyKey(1, "age");
     visitor(null).visitRelationshipType(0, "ACCEPTS");
     visitor(null).visitRelationshipType(1, "REJECTS");
     visitor(null).visitIndex(TestIndexDescriptorFactory.forLabel(0, 1), ":Person(age)", 0.5d, 1L);
     visitor(null).visitIndex(TestIndexDescriptorFactory.uniqueForLabel(0, 0, 2), ":Person(name, lastName)", 0.5d, 1L);
     visitor(null).visitUniqueConstraint(ConstraintDescriptorFactory.uniqueForLabel(1, 0), ":Party(name)");
     visitor(null).visitNodeKeyConstraint(ConstraintDescriptorFactory.nodeKeyForLabel(0, 1, 2), ":Person(name, lastName)");
     visitor(null).visitAllNodesCount(55);
     visitor(null).visitNodeCount(0, "Person", 50);
     visitor(null).visitNodeCount(0, "Party", 5);
     visitor(null).visitRelCount(0, 1, -1, "MATCH (:Person)-[:REJECTS]->() RETURN count(*)", 5);
 }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetRelatedNodeConstraints()
        public virtual void ShouldGetRelatedNodeConstraints()
        {
            // given
            ConstraintRule constraint1 = ConstraintRule.constraintRule(1L, ConstraintDescriptorFactory.uniqueForLabel(1, 5, 6), null);
            ConstraintRule constraint2 = ConstraintRule.constraintRule(2L, ConstraintDescriptorFactory.uniqueForLabel(1, 5), null);
            ConstraintRule constraint3 = ConstraintRule.constraintRule(3L, ConstraintDescriptorFactory.uniqueForLabel(2, 5), null);

            _indexMap.putUniquenessConstraint(constraint1);
            _indexMap.putUniquenessConstraint(constraint2);
            _indexMap.putUniquenessConstraint(constraint3);

            // when/then
            assertEquals(asSet(constraint2.ConstraintDescriptor), _indexMap.getRelatedConstraints(EntityTokens(1), EntityTokens(), Properties(5), true, NODE));
            assertEquals(asSet(constraint1.ConstraintDescriptor, constraint2.ConstraintDescriptor), _indexMap.getRelatedConstraints(EntityTokens(1), EntityTokens(), Properties(5), false, NODE));
            assertEquals(asSet(constraint1.ConstraintDescriptor, constraint2.ConstraintDescriptor), _indexMap.getRelatedConstraints(EntityTokens(1), EntityTokens(), Properties(5, 6), true, NODE));
            assertEquals(asSet(constraint1.ConstraintDescriptor, constraint2.ConstraintDescriptor), _indexMap.getRelatedConstraints(EntityTokens(), EntityTokens(1), Properties(5), false, NODE));
            assertEquals(asSet(constraint1.ConstraintDescriptor, constraint2.ConstraintDescriptor, constraint3.ConstraintDescriptor), _indexMap.getRelatedConstraints(EntityTokens(1, 2), EntityTokens(), Properties(), false, NODE));
        }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveNodeConstraints()
        public virtual void ShouldRemoveNodeConstraints()
        {
            // given
            ConstraintRule constraint1 = ConstraintRule.constraintRule(1L, ConstraintDescriptorFactory.uniqueForLabel(1, 5, 6), null);
            ConstraintRule constraint2 = ConstraintRule.constraintRule(2L, ConstraintDescriptorFactory.uniqueForLabel(1, 5), null);
            ConstraintRule constraint3 = ConstraintRule.constraintRule(3L, ConstraintDescriptorFactory.uniqueForLabel(2, 5), null);

            _indexMap.putUniquenessConstraint(constraint1);
            _indexMap.putUniquenessConstraint(constraint2);
            _indexMap.putUniquenessConstraint(constraint3);
            assertEquals(asSet(constraint2.ConstraintDescriptor), _indexMap.getRelatedConstraints(EntityTokens(1), EntityTokens(), Properties(5), true, NODE));

            // and when
            _indexMap.removeUniquenessConstraint(constraint1.Id);
            _indexMap.removeUniquenessConstraint(constraint2.Id);
            _indexMap.removeUniquenessConstraint(constraint3.Id);

            // then
            assertTrue(_indexMap.getRelatedConstraints(EntityTokens(1), EntityTokens(), Properties(5), true, NODE).Count == 0);
        }
Ejemplo n.º 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @After public void clean() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Clean()
        {
            if (_transaction != null)
            {
                _transaction.close();
            }

            NewTransaction();
            _transaction.schemaWrite().constraintDrop(ConstraintDescriptorFactory.uniqueForLabel(LABEL, PropertyIds()));
            Commit();

            using (Transaction tx = Kernel.beginTransaction([email protected]_Type.Implicit, LoginContext.AUTH_DISABLED), NodeCursor node = tx.Cursors().allocateNodeCursor())
            {
                tx.DataRead().allNodesScan(node);
                while (node.Next())
                {
                    tx.DataWrite().nodeDelete(node.NodeReference());
                }
                tx.Success();
            }
        }
Ejemplo n.º 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldValidateUniquenessIndexes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
		 public virtual void ShouldValidateUniquenessIndexes()
		 {
			  // Given
			  NeoStores store = mock( typeof( NeoStores ) );
			  IndexingService indexes = mock( typeof( IndexingService ) );
			  IntegrityValidator validator = new IntegrityValidator( store, indexes );
			  UniquenessConstraintDescriptor constraint = ConstraintDescriptorFactory.uniqueForLabel( 1, 1 );

			  doThrow( new UniquePropertyValueValidationException( constraint, ConstraintValidationException.Phase.VERIFICATION, new Exception() ) ).when(indexes).validateIndex(2L);

			  ConstraintRule record = ConstraintRule.constraintRule( 1L, constraint, 2L );

			  // When
			  try
			  {
					validator.ValidateSchemaRule( record );
					fail( "Should have thrown integrity error." );
			  }
			  catch ( Exception )
			  {
					// good
			  }
		 }
Ejemplo n.º 13
0
            public override void DropPropertyUniquenessConstraint(Label label, string[] properties)
            {
                KernelTransaction transaction = SafeAcquireTransaction(TransactionSupplier);

                using (Statement ignore = transaction.AcquireStatement())
                {
                    try
                    {
                        TokenRead tokenRead      = transaction.TokenRead();
                        int       labelId        = tokenRead.NodeLabel(label.Name());
                        int[]     propertyKeyIds = ResolveAndValidatePropertyKeys(tokenRead, properties);
                        transaction.SchemaWrite().constraintDrop(ConstraintDescriptorFactory.uniqueForLabel(labelId, propertyKeyIds));
                    }
                    catch (DropConstraintFailureException e)
                    {
                        throw new ConstraintViolationException(e.GetUserMessage(new SilentTokenNameLookup(transaction.TokenRead())), e);
                    }
                    catch (Exception e) when(e is InvalidTransactionTypeKernelException || e is SchemaKernelException)
                    {
                        throw new ConstraintViolationException(e.Message, e);
                    }
                }
            }
Ejemplo n.º 14
0
 private ConstraintRule GetUniquePropertyConstraintRule(long id, string label, string property)
 {
     return(ConstraintRule.constraintRule(id, ConstraintDescriptorFactory.uniqueForLabel(LabelId(label), PropId(property)), 0L));
 }
Ejemplo n.º 15
0
 private ConstraintRule ConstraintUniqueRule(long ruleId, long ownedIndexId, int labelId, params int[] propertyIds)
 {
     return(ConstraintRule.constraintRule(ruleId, ConstraintDescriptorFactory.uniqueForLabel(labelId, propertyIds), ownedIndexId));
 }
        // === CONSTRAINT RULES ===

        public static ConstraintRule ReadUniquenessConstraintRule(long id, int labelId, ByteBuffer buffer)
        {
            return(new ConstraintRule(id, ConstraintDescriptorFactory.uniqueForLabel(labelId, ReadConstraintPropertyKeys(buffer)), ReadOwnedIndexRule(buffer)));
        }
Ejemplo n.º 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFormatCompositeUniquenessConstraints()
        public virtual void ShouldFormatCompositeUniquenessConstraints()
        {
            assertEquals("ConstraintDescriptorFactory.uniqueForLabel( 23, 42, 43 )", FormatArgument(ConstraintDescriptorFactory.uniqueForLabel(23, 42, 43)));
        }
Ejemplo n.º 18
0
 public void Accept(DbStructureVisitor visitor)
 {
     visitor.VisitLabel(0, "Movie");
     visitor.VisitLabel(1, "Person");
     visitor.VisitLabel(2, "User");
     visitor.VisitLabel(3, "Actor");
     visitor.VisitLabel(4, "Director");
     visitor.VisitPropertyKey(0, "startTime");
     visitor.VisitPropertyKey(1, "__type__");
     visitor.VisitPropertyKey(2, "password");
     visitor.VisitPropertyKey(3, "login");
     visitor.VisitPropertyKey(4, "roles");
     visitor.VisitPropertyKey(5, "name");
     visitor.VisitPropertyKey(6, "description");
     visitor.VisitPropertyKey(7, "id");
     visitor.VisitPropertyKey(8, "releaseDate");
     visitor.VisitPropertyKey(9, "title");
     visitor.VisitPropertyKey(10, "tagline");
     visitor.VisitPropertyKey(11, "language");
     visitor.VisitPropertyKey(12, "imageUrl");
     visitor.VisitPropertyKey(13, "lastModified");
     visitor.VisitPropertyKey(14, "genre");
     visitor.VisitPropertyKey(15, "studio");
     visitor.VisitPropertyKey(17, "imdbId");
     visitor.VisitPropertyKey(16, "trailer");
     visitor.VisitPropertyKey(19, "homepage");
     visitor.VisitPropertyKey(18, "version");
     visitor.VisitPropertyKey(21, "profileImageUrl");
     visitor.VisitPropertyKey(20, "runtime");
     visitor.VisitPropertyKey(23, "birthday");
     visitor.VisitPropertyKey(22, "biography");
     visitor.VisitPropertyKey(25, "stars");
     visitor.VisitPropertyKey(24, "birthplace");
     visitor.VisitPropertyKey(26, "comment");
     visitor.VisitRelationshipType(0, "FRIEND");
     visitor.VisitRelationshipType(1, "DIRECTED");
     visitor.VisitRelationshipType(2, "ACTS_IN");
     visitor.VisitRelationshipType(3, "RATED");
     visitor.VisitRelationshipType(4, "ROOT");
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(0, 9), ":Movie(title)", 1.0d, 12462L);
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(1, 5), ":Person(name)", 1.0d, 49845L);
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(3, 5), ":Actor(name)", 1.0d, 44689L);
     visitor.VisitIndex(TestIndexDescriptorFactory.forLabel(4, 5), ":Director(name)", 1.0d, 6010L);
     visitor.VisitIndex(TestIndexDescriptorFactory.uniqueForLabel(2, 3), ":User(login)", 1.0d, 45L);
     visitor.VisitUniqueConstraint(ConstraintDescriptorFactory.uniqueForLabel(2, 3), "CONSTRAINT ON ( " + "user:User ) ASSERT user.login IS UNIQUE");
     visitor.VisitAllNodesCount(63042L);
     visitor.VisitNodeCount(0, "Movie", 12862L);
     visitor.VisitNodeCount(1, "Person", 50179L);
     visitor.VisitNodeCount(2, "User", 45L);
     visitor.VisitNodeCount(3, "Actor", 44943L);
     visitor.VisitNodeCount(4, "Director", 6037L);
     visitor.VisitRelCount(-1, -1, -1, "MATCH ()-[]->() RETURN count(*)", 106651L);
     visitor.VisitRelCount(0, -1, -1, "MATCH (:Movie)-[]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, -1, 0, "MATCH ()-[]->(:Movie) RETURN count(*)", 106645L);
     visitor.VisitRelCount(1, -1, -1, "MATCH (:Person)-[]->() RETURN count(*)", 106651L);
     visitor.VisitRelCount(-1, -1, 1, "MATCH ()-[]->(:Person) RETURN count(*)", 6L);
     visitor.VisitRelCount(2, -1, -1, "MATCH (:User)-[]->() RETURN count(*)", 36L);
     visitor.VisitRelCount(-1, -1, 2, "MATCH ()-[]->(:User) RETURN count(*)", 6L);
     visitor.VisitRelCount(3, -1, -1, "MATCH (:Actor)-[]->() RETURN count(*)", 97151L);
     visitor.VisitRelCount(-1, -1, 3, "MATCH ()-[]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, -1, -1, "MATCH (:Director)-[]->() RETURN count(*)", 16268L);
     visitor.VisitRelCount(-1, -1, 4, "MATCH ()-[]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, -1, "MATCH ()-[:FRIEND]->() RETURN count(*)", 6L);
     visitor.VisitRelCount(0, 0, -1, "MATCH (:Movie)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, 0, "MATCH ()-[:FRIEND]->(:Movie) RETURN count(*)", 0L);
     visitor.VisitRelCount(1, 0, -1, "MATCH (:Person)-[:FRIEND]->() RETURN count(*)", 6L);
     visitor.VisitRelCount(-1, 0, 1, "MATCH ()-[:FRIEND]->(:Person) RETURN count(*)", 6L);
     visitor.VisitRelCount(2, 0, -1, "MATCH (:User)-[:FRIEND]->() RETURN count(*)", 6L);
     visitor.VisitRelCount(-1, 0, 2, "MATCH ()-[:FRIEND]->(:User) RETURN count(*)", 6L);
     visitor.VisitRelCount(3, 0, -1, "MATCH (:Actor)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, 3, "MATCH ()-[:FRIEND]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 0, -1, "MATCH (:Director)-[:FRIEND]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 0, 4, "MATCH ()-[:FRIEND]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, -1, "MATCH ()-[:DIRECTED]->() RETURN count(*)", 11915L);
     visitor.VisitRelCount(0, 1, -1, "MATCH (:Movie)-[:DIRECTED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, 0, "MATCH ()-[:DIRECTED]->(:Movie) RETURN count(*)", 11915L);
     visitor.VisitRelCount(1, 1, -1, "MATCH (:Person)-[:DIRECTED]->() RETURN count(*)", 11915L);
     visitor.VisitRelCount(-1, 1, 1, "MATCH ()-[:DIRECTED]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 1, -1, "MATCH (:User)-[:DIRECTED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 1, 2, "MATCH ()-[:DIRECTED]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 1, -1, "MATCH (:Actor)-[:DIRECTED]->() RETURN count(*)", 2451L);
     visitor.VisitRelCount(-1, 1, 3, "MATCH ()-[:DIRECTED]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 1, -1, "MATCH (:Director)-[:DIRECTED]->() RETURN count(*)", 11915L);
     visitor.VisitRelCount(-1, 1, 4, "MATCH ()-[:DIRECTED]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 2, -1, "MATCH ()-[:ACTS_IN]->() RETURN count(*)", 94700L);
     visitor.VisitRelCount(0, 2, -1, "MATCH (:Movie)-[:ACTS_IN]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 2, 0, "MATCH ()-[:ACTS_IN]->(:Movie) RETURN count(*)", 94700L);
     visitor.VisitRelCount(1, 2, -1, "MATCH (:Person)-[:ACTS_IN]->() RETURN count(*)", 94700L);
     visitor.VisitRelCount(-1, 2, 1, "MATCH ()-[:ACTS_IN]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 2, -1, "MATCH (:User)-[:ACTS_IN]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 2, 2, "MATCH ()-[:ACTS_IN]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 2, -1, "MATCH (:Actor)-[:ACTS_IN]->() RETURN count(*)", 94700L);
     visitor.VisitRelCount(-1, 2, 3, "MATCH ()-[:ACTS_IN]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 2, -1, "MATCH (:Director)-[:ACTS_IN]->() RETURN count(*)", 4353L);
     visitor.VisitRelCount(-1, 2, 4, "MATCH ()-[:ACTS_IN]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, -1, "MATCH ()-[:RATED]->() RETURN count(*)", 30L);
     visitor.VisitRelCount(0, 3, -1, "MATCH (:Movie)-[:RATED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, 0, "MATCH ()-[:RATED]->(:Movie) RETURN count(*)", 30L);
     visitor.VisitRelCount(1, 3, -1, "MATCH (:Person)-[:RATED]->() RETURN count(*)", 30L);
     visitor.VisitRelCount(-1, 3, 1, "MATCH ()-[:RATED]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 3, -1, "MATCH (:User)-[:RATED]->() RETURN count(*)", 30L);
     visitor.VisitRelCount(-1, 3, 2, "MATCH ()-[:RATED]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 3, -1, "MATCH (:Actor)-[:RATED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, 3, "MATCH ()-[:RATED]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 3, -1, "MATCH (:Director)-[:RATED]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 3, 4, "MATCH ()-[:RATED]->(:Director) RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, -1, "MATCH ()-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(0, 4, -1, "MATCH (:Movie)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 0, "MATCH ()-[:ROOT]->(:Movie) RETURN count(*)", 0L);
     visitor.VisitRelCount(1, 4, -1, "MATCH (:Person)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 1, "MATCH ()-[:ROOT]->(:Person) RETURN count(*)", 0L);
     visitor.VisitRelCount(2, 4, -1, "MATCH (:User)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 2, "MATCH ()-[:ROOT]->(:User) RETURN count(*)", 0L);
     visitor.VisitRelCount(3, 4, -1, "MATCH (:Actor)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 3, "MATCH ()-[:ROOT]->(:Actor) RETURN count(*)", 0L);
     visitor.VisitRelCount(4, 4, -1, "MATCH (:Director)-[:ROOT]->() RETURN count(*)", 0L);
     visitor.VisitRelCount(-1, 4, 4, "MATCH ()-[:ROOT]->(:Director) RETURN count(*)", 0L);
 }