public async Task <IAssociation> AssociateAsync(INode otherNode, QName associationTypeQName, Directionality directionality, JObject data) { if (data == null) { data = new JObject(); } string uri = URI + "/associate"; IDictionary <string, string> queryParams = new Dictionary <string, string>(); queryParams.Add("node", otherNode.Id); queryParams.Add("type", associationTypeQName.ToString()); if (!directionality.Equals(Directionality.DIRECTED)) { queryParams.Add("directionality", directionality.ToString()); } JObject response1 = await Driver.PostAsync(uri, queryParams); string associationId = (string)response1["_doc"]; // Read back association object JObject response2 = await Driver.GetAsync(Branch.URI + "/nodes/" + associationId); Association association = new Association(Branch, response2); return(association); }
public Task UnassociateAsync(INode targetNode, QName associationTypeQName, Directionality directionality) { string uri = URI + "/unassociate"; IDictionary <string, string> queryParams = new Dictionary <string, string>(); queryParams.Add("node", targetNode.Id); queryParams.Add("type", associationTypeQName.ToString()); if (!directionality.Equals(Directionality.DIRECTED)) { queryParams.Add("directionality", directionality.ToString()); } return(Driver.PostAsync(uri, queryParams)); }