상속: Net.Graph.Neo4JD.BaseEntity
예제 #1
0
파일: Index.cs 프로젝트: sonyarouje/Neo4jD
        public void RemoveNode(Node node)
        {
            if (node.GetLocation() == null)
                throw new InvalidNodeException();

            _indexRepo.RemoveNodeFromIndex(this,node);
        }
예제 #2
0
 public RequestResult GetGermlinExecutionResult(Node node, string query)
 {
     query = query.Replace("#id", node.Id.ToString());
     var uri = UriHelper.ConcatUri(GraphEnvironment.GetBaseUri(), "db/data/ext/GremlinPlugin/graphdb/execute_script");
     var result = _graphRequest.Post(RequestType.POST, uri, query);
     return result;
 }
예제 #3
0
        public Node CreateNode(Node node)
        {
            var uri = UriHelper.ConcatUri(GraphEnvironment.GetBaseUri(), "db/data/node");
            var result = _graphRequest.Post(RequestType.POST, uri, node.GetProperties());
            node.SetLocation(result.GetLocation());

            return node;
        }
예제 #4
0
파일: Index.cs 프로젝트: sonyarouje/Neo4jD
        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
파일: 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);
        }
예제 #6
0
 public IList<Node> CreateNodeArray(string element, RequestResult result)
 {
     IList<Node> childs = new List<Node>();
     JArray array = JArray.Parse(result.GetResponseData());
     foreach (var tkn in array)
     {
         Node node = new Node();
         node.SetLocation(new Uri(tkn[element].ToString()));
         node = this.GetNode(node);
         childs.Add(node);
     }
     return childs;
 }
예제 #7
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);
        }
예제 #8
0
        public void CreateSonRelationship()
        {
            Node son = new Node();
            son.AddProperty("FirstName", "Sony");
            son.AddProperty("LastName", "Arouje");
            son.Create();

            Node father = Node.Get(1);
            Assert.IsNotNull(father);
            Assert.IsNotNull(father.GetLocation());
            Console.WriteLine(father.GetLocation().ToString());

            Relationship relationship = father.CreateRelationshipTo(son, "son");
            Assert.IsNotNull(relationship.GetLocation());
        }
예제 #9
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());
        }
예제 #10
0
        public IList<Relationship> GetAllPathsTo(Node toNode, RequestResult result)
        {
            IList<Relationship> relationShips = new List<Relationship>();
            JArray array = JArray.Parse(result.GetResponseData());
            foreach (var tkn in array)
            {
                Node node = new Node();
                node.SetLocation(new Uri(tkn["end"].ToString()));
                if (node.Id == toNode.Id)
                {
                    Relationship relationShip = _relationShipRepo.GetRelationship(new Uri(tkn["self"].ToString()));
                    relationShips.Add(relationShip);
                }
            }

            return relationShips;
        }
예제 #11
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;
 }
예제 #12
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;
 }
예제 #13
0
 public Node GetNode(string nodeId)
 {
     var uri = UriHelper.ConcatUri(GraphEnvironment.GetBaseUri(), "db/data/node/" + nodeId);
     Node node = new Node();
     node.SetLocation(uri);
     return this.GetNode(node);
 }
예제 #14
0
 public void TryDelete_A_Node_That_Is_NotFetched()
 {
     Node node=new Node();
     node.Delete();
 }
예제 #15
0
파일: Node.cs 프로젝트: sonyarouje/Neo4jD
 public IList<Relationship> GetAllPathsTo(Node endNode)
 {
     RequestResult result = _nodeRepo.GetRelatedNodes(this, "out");
     return _nodeRepo.GetAllPathsTo(endNode,result);
 }
예제 #16
0
 public Node GetNode(Uri nodeUri)
 {
     Node node = new Node();
     node.SetLocation(nodeUri);
     return this.GetNode(node);
 }
예제 #17
0
 internal Relationship(Node startNode, Node endNode, string relationShipType)
     : this()
 {
     _toNodeLocation = endNode.GetLocation().ToString();
     _type = relationShipType;
 }
예제 #18
0
 public Node GetNode(Node node)
 {
     var result = _graphRequest.Post(RequestType.GET, node.GetLocation(), null);
     node.SetResult(result);
     return node;
 }
예제 #19
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;
 }