public void RemoveNode(Node node) { if (node.GetLocation() == null) throw new InvalidNodeException(); _indexRepo.RemoveNodeFromIndex(this,node); }
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; }
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; }
public Index Add(Node node, string key, string value) { if (node.GetLocation() == null) throw new InvalidNodeException(); _indexRepo.AddNodeToIndex(this,node, key, value); return this; }
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); }
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; }
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); }
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()); }
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()); }
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; }
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; }
public RequestResult GetRelatedNodes(Node node, string direction) { RequestResult result = _graphRequest.Post(RequestType.GET, new Uri(string.Concat(node.GetLocation(), @"/relationships/", direction)), null); return result; }
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); }
public void TryDelete_A_Node_That_Is_NotFetched() { Node node=new Node(); node.Delete(); }
public IList<Relationship> GetAllPathsTo(Node endNode) { RequestResult result = _nodeRepo.GetRelatedNodes(this, "out"); return _nodeRepo.GetAllPathsTo(endNode,result); }
public Node GetNode(Uri nodeUri) { Node node = new Node(); node.SetLocation(nodeUri); return this.GetNode(node); }
internal Relationship(Node startNode, Node endNode, string relationShipType) : this() { _toNodeLocation = endNode.GetLocation().ToString(); _type = relationShipType; }
public Node GetNode(Node node) { var result = _graphRequest.Post(RequestType.GET, node.GetLocation(), null); node.SetResult(result); return node; }
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; }