예제 #1
0
 public ICypherQuery Execute(ICypherQuery query)
 {
     query
     .With(StatementFactory.With(_source))
     .Match(StatementFactory.Match(_destination, StatementFactory.IdParameter(_destination)))
     .CreateUnique(StatementFactory.Relationship(_source, _destination, _relationship))
     .WithParam(StatementFactory.IdParameter(_destination), _destination.Id);
     return(query);
 }
예제 #2
0
        public void ShouldCreateReverseRelationshipStatement()
        {
            var metadata = new RelationshipMetadata {
                Name = "REL", IsReverse = true
            };
            var result = StatementFactory.Relationship(metadata);

            Assert.Equal("<-[:REL]-", result);
        }
예제 #3
0
        public void ShouldCreateNamedRelationshipStatement()
        {
            var metadata = new RelationshipMetadata {
                Name = "REL", IsReverse = false
            };
            var result = StatementFactory.Relationship(metadata, "x");

            Assert.Equal("-[x:REL]->", result);
        }
예제 #4
0
 public ICypherQuery Execute(ICypherQuery query)
 {
     query = query
             .With(StatementFactory.With(_source))
             .Match(StatementFactory.Match(_destination, StatementFactory.IdParameter(_destination)))
             .Match(StatementFactory.Relationship(_source, _destination, _relationship, _relationshipName))
             .WithParam(StatementFactory.IdParameter(_destination), _destination.Id)
             .Delete(GetNodesToDelete());
     return(query);
 }
예제 #5
0
        public void ShouldCreateNamedRelationship()
        {
            var factory = new AttributeMetadataFactory(new NullLogger());
            var personA = new Person {
                Id = "A"
            };
            var nodeA   = new Node(factory.Create(personA), personA);
            var personB = new Person {
                Id = "B"
            };
            var nodeB        = new Node(factory.Create(personB), personB);
            var relationship = new RelationshipMetadata {
                Name = "REL", IsReverse = true
            };
            var result = StatementFactory.Relationship(nodeA, nodeB, relationship, "r");

            Assert.Equal("(Person_A)<-[r:REL]-(Person_B)", result);
        }