示例#1
0
            public void PropertyIsEqual()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode)
                                             .Where(_userNode.Property("email")
                                                    .IsEqualTo(Cypher.LiteralOf("*****@*****.**")))
                                             .Return(_userNode);

                statement.Build().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();
        }
示例#3
0
            public void SimpleRelationshipSingleTypeWithProperties()
            {
                StatementBuilder statement = Cypher.Match(
                    _userNode.RelationshipTo(_bikeNode, "OWNS")
                    .WithProperties(
                        Cypher.MapOf("boughtOn", Cypher.LiteralOf("2021-03-02"))))
                                             .Return(_bikeNode, _userNode);

                statement.Build().MatchSnapshot();
            }
示例#4
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();
        }
        public void ExpressionMatches()
        {
            var  visitor = new CypherVisitor();
            Node person  = Node.Create("Person").Named("p");

            Condition statement =
                person.Property("Email").Matches(Cypher.LiteralOf("*****@*****.**"));

            statement.Visit(visitor);
            visitor.Print().MatchSnapshot();
        }
示例#6
0
            public void OrCondition()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode)
                                             .Where(_userNode.Property("email")
                                                    .IsEqualTo(Cypher.LiteralOf("*****@*****.**"))
                                                    .Or(_userNode.Property("address").IsNull()))
                                             .Return(_userNode);

                statement.Build().MatchSnapshot();
            }
        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();
        }
        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();
        }
        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();
        }
示例#10
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();
        }
示例#11
0
            public void MatchNamedNodeWithProperties()
            {
                Node movie = Cypher.Node("Movie")
                             .Named("m")
                             .WithProperties(
                    "title",
                    Cypher.LiteralOf("The Matrix"),
                    "yearReleased",
                    Cypher.LiteralOf(1999),
                    "released",
                    Cypher.LiteralOf(true),
                    "rating",
                    Cypher.LiteralOf(8.7)
                    );

                StatementBuilder statement = Cypher.Match(movie);

                statement.Build().MatchSnapshot();
            }
示例#12
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();
        }
示例#13
0
            public void NodeWithTwoFieldsAndRelationshipProjection()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode, _bikeNode)
                                             .Return(_userNode.Project(
                                                         "name",
                                                         "email",
                                                         "owns",
                                                         new PatternComprehension(
                                                             _userNode.RelationshipTo(_bikeNode, "OWNS"),
                                                             new Where(_bikeNode.Property("age").IsEqualTo(Cypher.LiteralOf(12))),
                                                             _bikeNode.Project("age"))
                                                         ))
                                             .OrderBy(Cypher.Sort(_userNode.Property("name")).Descending());

                ;
                statement.Build().MatchSnapshot();
            }