Inheritance: Net.Graph.Neo4JD.BaseEntity
示例#1
0
        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
        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;
 }