Пример #1
0
 public override void Visit(CypherVisitor cypherVisitor)
 {
     cypherVisitor.Enter(this);
     ContainerReference.Visit(cypherVisitor);
     Names.ForEach(name => name.Visit(cypherVisitor));
     cypherVisitor.Leave(this);
 }
Пример #2
0
 public override void Visit(CypherVisitor cypherVisitor)
 {
     cypherVisitor.Enter(this);
     Expressions.NameOrExpression(Left).Visit(cypherVisitor);
     Operator.Visit(cypherVisitor);
     Right.Visit(cypherVisitor);
     cypherVisitor.Leave(this);
 }
Пример #3
0
        public void DoubleLiteral()
        {
            var visitor = new CypherVisitor();

            DoubleLiteral literal = new(1.11);

            literal.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #4
0
        public void NamedNode()
        {
            var visitor = new CypherVisitor();

            Node movie = Node.Create("Movie").Named("m");

            movie.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #5
0
        public void StringLiteral()
        {
            var visitor = new CypherVisitor();

            StringLiteral literal = new("Test");

            literal.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #6
0
        public void IntegerLiteral()
        {
            var visitor = new CypherVisitor();

            IntegerLiteral literal = new(1);

            literal.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #7
0
        public void BooleanLiteral()
        {
            var visitor = new CypherVisitor();

            BooleanLiteral literal = Language.BooleanLiteral.True;

            literal.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
        public void ExpressionIsTrue()
        {
            var  visitor = new CypherVisitor();
            Node movie   = Node.Create("Movie").Named("m");

            Condition statement = movie.Property("Released").IsTrue();

            statement.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
        public void ExpressionIsEqualTo()
        {
            var  visitor = new CypherVisitor();
            Node movie   = Node.Create("Movie").Named("m");

            Condition statement = movie.Property("Title").IsEqualTo(Cypher.LiteralOf("The Matrix"));

            statement.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #10
0
        public void ExpressionMatchesRegex()
        {
            var  visitor = new CypherVisitor();
            Node person  = Node.Create("Person").Named("p");

            Condition statement = person.Property("Email").Matches(".*\\\\.com");

            statement.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #11
0
        public void NodeWithOneProperty()
        {
            var visitor = new CypherVisitor();

            Node movie = Node.Create("Movie")
                         .Named("m")
                         .WithProperties("Title", Cypher.LiteralOf("The Matrix"));

            movie.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #12
0
        public void Where()
        {
            var  visitor = new CypherVisitor();
            Node movie   = Node.Create("Movie").Named("m");

            Condition condition = movie.Property("Title").IsEqualTo(Cypher.LiteralOf("The Matrix"));

            Where where = new(condition);
            where.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #13
0
        public void WhereStatementIncludingXOrCompoundConditionChain()
        {
            var  visitor = new CypherVisitor();
            Node movie   = Node.Create("Movie").Named("m");

            Where where = new(
                movie.Property("Title")
                .IsEqualTo(Cypher.LiteralOf("The Matrix"))
                .XOr(movie.Property("Rating").IsEqualTo(Cypher.LiteralOf(3.2))));
            where.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #14
0
        public string Build()
        {
            var visitor = new CypherVisitor();

            _match?.Visit(visitor);
            _return?.Visit(visitor);
            _orderBy?.Visit(visitor);
            _skip?.Visit(visitor);
            _limit?.Visit(visitor);

            return(visitor.Print());
        }
Пример #15
0
        public void WhereStatementIncludingAndCompoundCondition()
        {
            var  visitor = new CypherVisitor();
            Node movie   = Node.Create("Movie").Named("m");

            Condition condition1 =
                movie.Property("Title").IsEqualTo(Cypher.LiteralOf("The Matrix"));
            Condition condition2   = movie.Property("Rating").IsEqualTo(Cypher.LiteralOf(3.2));
            Condition andCondition = Condition.And(condition1, condition2);

            Where where = new(andCondition);
            where.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #16
0
        public void NodeWithAdditionalLabels()
        {
            string[] additionalLabels =
            {
                "Film",
                "Flick"
            };

            var visitor = new CypherVisitor();

            Node movie = Node.Create("Movie", additionalLabels).Named("m");

            movie.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #17
0
        public void WhereStatementIncludingXOrLargeChain()
        {
            var  visitor = new CypherVisitor();
            Node movie   = Node.Create("Movie").Named("m");

            Condition property1 = movie.Property("Title").IsEqualTo(Cypher.LiteralOf("The Matrix"));
            Condition property2 = movie.Property("Rating").IsEqualTo(Cypher.LiteralOf(3.2));
            Condition property3 = movie.Property("Age").IsEqualTo(Cypher.LiteralOf(2));
            Condition property4 = movie.Property("Name").IsEqualTo(Cypher.LiteralOf("Peter"));
            Condition property5 = movie.Property("Name").IsEqualTo(Cypher.LiteralOf("Tim"));

            Where where = new(property1.XOr(property2.And(property3))
                              .Or(property4.Or(property5).Not()));
            where.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
Пример #18
0
        public void NodeWithMultipleProperties()
        {
            var visitor = new CypherVisitor();

            Node movie = Node.Create("Movie")
                         .Named("m")
                         .WithProperties(
                "Title",
                Cypher.LiteralOf("The Matrix"),
                "YearReleased",
                Cypher.LiteralOf(1999),
                "Released",
                Cypher.LiteralOf(true),
                "Rating",
                Cypher.LiteralOf(8.7)
                );

            movie.Visit(visitor);

            visitor.Print().MatchSnapshot();
        }
Пример #19
0
 public override void Visit(CypherVisitor cypherVisitor)
 {
     cypherVisitor.Enter(this);
     Labels.ForEach(value => value.Visit(cypherVisitor));
     cypherVisitor.Leave(this);
 }
Пример #20
0
 public override void Visit(CypherVisitor cypherVisitor)
 {
     cypherVisitor.Enter(this);
     Children.ForEach(child => PrepareVisit(child).Visit(cypherVisitor));
     cypherVisitor.Leave(this);
 }