示例#1
0
        public void CreateNode()
        {
            Node node = new Node();
            node.AddProperty("FirstName", "Kunjachan");
            node.AddProperty("LastName", "Arouje");
            node.Create();

            Assert.IsNotNull(node.GetLocation());
            Console.WriteLine(node.GetLocation().ToString());

            Node mother = new Node();
            mother.AddProperty("FirstName", "Marry").AddProperty("LastName", "Treassa").Create();
            Assert.IsNotNull(mother.GetLocation());
            Console.WriteLine(mother.GetLocation().ToString());
        }
示例#2
0
        public void RemoveNode(Node node)
        {
            if (node.GetLocation() == null)
                throw new InvalidNodeException();

            _indexRepo.RemoveNodeFromIndex(this,node);
        }
示例#3
0
文件: Node.cs 项目: sonyarouje/Neo4jD
        public Relationship CreateRelationshipTo(Node node, string relationShipType)
        {
            if ((this.GetLocation()==null) || (node.GetLocation()==null))
                throw new Exception("Parent or child node is not created. Create both node before creating the relation");

            Relationship relationShip = new Relationship(this, node, relationShipType);
            return _relationShipRepo.CreateRelationship(this, relationShip);
        }
示例#4
0
        public Index Add(Node node, string key, string value)
        {
            if (node.GetLocation() == null)
                throw new InvalidNodeException();
            _indexRepo.AddNodeToIndex(this,node, key, value);

            return this;
        }
示例#5
0
        public void RemoveNode(Node node)
        {
            if (node.GetLocation() == null)
            {
                throw new InvalidNodeException();
            }

            _indexRepo.RemoveNodeFromIndex(this, node);
        }
示例#6
0
        public Index Add(Node node, string key, string value)
        {
            if (node.GetLocation() == null)
            {
                throw new InvalidNodeException();
            }
            _indexRepo.AddNodeToIndex(this, node, key, value);

            return(this);
        }
示例#7
0
        public Relationship CreateRelationshipTo(Node node, string relationShipType)
        {
            if ((this.GetLocation() == null) || (node.GetLocation() == null))
            {
                throw new Exception("Parent or child node is not created. Create both node before creating the relation");
            }

            Relationship relationShip = new Relationship(this, node, relationShipType);

            return(_relationShipRepo.CreateRelationship(this, relationShip));
        }
示例#8
0
 public Node GetNode(Node node)
 {
     var result = _graphRequest.Post(RequestType.GET, node.GetLocation(), null);
     node.SetResult(result);
     return node;
 }
示例#9
0
 public RequestResult GetRestExecutionResult(Node node, string query)
 {
     //Console.WriteLine(query);
     var uri = UriHelper.ConcatUri(node.GetLocation(), "/traverse/node");
     var result = _graphRequest.Post(RequestType.POST, uri, query);
     return result;
 }
示例#10
0
 public RequestResult GetRelatedNodes(Node node, string direction)
 {
     RequestResult result = _graphRequest.Post(RequestType.GET, new Uri(string.Concat(node.GetLocation(), @"/relationships/", direction)), null);
     return result;
 }
示例#11
0
 internal Relationship(Node startNode, Node endNode, string relationShipType)
     : this()
 {
     _toNodeLocation = endNode.GetLocation().ToString();
     _type = relationShipType;
 }
示例#12
0
        public void DeleteNode()
        {
            Node nodeToDelete = new Node();
            nodeToDelete.AddProperty("FirstName", "Delete").AddProperty("LastName", "Node");
            nodeToDelete.Create();
            int id = nodeToDelete.Id;
            Console.WriteLine(nodeToDelete.GetLocation().ToString());

            nodeToDelete.Delete();

            Node accessDeletedNode = Node.Get(id);
            Assert.AreEqual(0, accessDeletedNode.Id);
        }
示例#13
0
 public Relationship CreateRelationship(Node parent, Relationship relationShip)
 {
     var result = _graphRequest.Post(RequestType.POST, new Uri(string.Concat(parent.GetLocation(), @"/relationships")), relationShip.GetProperties());
     relationShip.SetLocation(result.GetLocation());
     return relationShip;
 }
示例#14
0
 internal Relationship(Node startNode, Node endNode, string relationShipType) : this()
 {
     _toNodeLocation = endNode.GetLocation().ToString();
     _type           = relationShipType;
 }