Ejemplo n.º 1
0
            public void MatchNamedNodeSkipLimit()
            {
                Node             movie     = Cypher.Node("Movie").Named("m");
                StatementBuilder statement = Cypher.Match(movie).Return(movie).Skip(1).Limit(1);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 2
0
            public void AliasedExpressionInReturn()
            {
                StatementBuilder statement = Cypher.Match(_bikeNode)
                                             .Return(_bikeNode.As("bike"));

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 3
0
            public void MatchThreeNodes()
            {
                StatementBuilder statement = Cypher
                                             .Match(_bikeNode, _userNode, Cypher.Node("U").Named("o"));

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 4
0
            public void SimpleRelationshipSingleTypeWithMinimumLength()
            {
                StatementBuilder statement = Cypher.Match(
                    _userNode.RelationshipTo(_bikeNode, "OWNS").Minimum(3))
                                             .Return(_bikeNode, _userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 5
0
            public void SimpleRelationshipMultipleTypes()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode.RelationshipTo(_bikeNode, "OWNS", "RIDES"))
                                             .Return(_bikeNode, _userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 6
0
            public void NodeWithProperties()
            {
                StatementBuilder statement = Cypher
                                             .Match(_bikeNode, _userNode, Cypher.Node("U").Named("o"))
                                             .Return(_bikeNode, _userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 7
0
            public void ReturnAsterisk()
            {
                StatementBuilder statement = Cypher
                                             .Match(_bikeNode, _userNode, Cypher.Node("U").Named("o"))
                                             .Return(Cypher.Asterisk);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 8
0
            public void NodeWithTwoFieldsProjection()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode)
                                             .Return(_userNode.Project("name", "email"));

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 9
0
            public void MatchTwoNamedNode()
            {
                Node movie = Node.Create("Movie").Named("m");
                Node bike  = Node.Create("Bike").Named("b");

                StatementBuilder statement = Cypher.Match(movie, bike);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 10
0
            public void PropertyIsNull()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode)
                                             .Where(_userNode.Property("email").IsNull())
                                             .Return(_userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 11
0
            public void NodeWithTwoFieldsProjectionWithOrderByDescending()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode)
                                             .Return(_userNode.Project("name", "email"))
                                             .OrderBy(Cypher.Sort(_userNode.Property("name")).Descending());

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 12
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();
            }
Ejemplo n.º 13
0
            public void PropertyIsEqual()
            {
                StatementBuilder statement = Cypher
                                             .Match(_userNode)
                                             .Where(_userNode.Property("email")
                                                    .IsEqualTo(Cypher.LiteralOf("*****@*****.**")))
                                             .Return(_userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 14
0
            public void PredicateExists()
            {
                Relationship?condition = _userNode.RelationshipTo(_bikeNode, "OWNS");

                StatementBuilder statement = Cypher
                                             .Match(new Where(Predicates.Exists(condition)), _userNode)
                                             .Return(_userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 15
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();
            }
Ejemplo n.º 16
0
            public void ChainedRelationshipSingle()
            {
                Node tripNode = Cypher.Node("Trip").Named("t");

                StatementBuilder statement = Cypher
                                             .Match(_userNode
                                                    .RelationshipTo(_bikeNode, "OWNS")
                                                    .Named("r1")
                                                    .RelationshipTo(tripNode, "USED_ON")
                                                    .Named("r2")
                                                    )
                                             .Return(_bikeNode, _userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 17
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();
            }
Ejemplo n.º 18
0
            public void ChainedRelationshipMultiple()
            {
                Node tripNode = Cypher.Node("Trip").Named("t");

                StatementBuilder statement = Cypher
                                             .Match(_userNode
                                                    .RelationshipTo(_bikeNode, "OWNS")
                                                    .Named("r1")
                                                    .RelationshipTo(tripNode, "USED_ON")
                                                    .Named("r2")
                                                    .RelationshipFrom(_userNode, "WAS_ON")
                                                    .Named("x")
                                                    .RelationshipBetween(Cypher.Node("SOMETHING"))
                                                    .Named("y")
                                                    )
                                             .Return(_bikeNode, _userNode);

                statement.Build().MatchSnapshot();
            }
Ejemplo n.º 19
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();
            }
Ejemplo n.º 20
0
            public void PredicateAll()
            {
                var compoundCondition = new CompoundCondition(Operator.And);

                Node         bikeNode  = Cypher.Node("Bike");
                Relationship userBikes = _userNode.RelationshipTo(bikeNode, "OWNS");

                compoundCondition.Add(Predicates.Exists(userBikes));

                SymbolicName userOwns = Cypher.Name("userOwns");

                //var test = Cypher.ListWith(userOwns).In();


                StatementBuilder statement = Cypher
                                             .Match(new Where(compoundCondition), _userNode)
                                             .Return(_userNode);

                statement.Build().MatchSnapshot();
            }