public static string AddGraphVertex(GremlinClient GremlinClient, string VertexType, string VertexName = null, Dictionary <string, string> Properties = null, string id = null) { try { if (string.IsNullOrEmpty(id)) { id = GetGraphVertexID(); } if (VertexName == null) { VertexName = id; } var results = TransactGraphQuery(GremlinClient, GraphQueryBusinessLogic.CreateVertexIfDoesNotExistGraphQuery(VertexType, VertexName, id, Properties)); foreach (var result in results) { // The vertex results are formed as Dictionaries with a nested dictionary for their properties var output = (JObject)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(result)); // Pull the id property and return that if found. id = output[VertexIDProperty].Value <string>(); } return(id); } catch (Exception) { throw; } }
public static List <string> CreateCommunicationSendEdgeQuery(string SenderID, string RecipientID) { List <string> queries = new List <string> { GraphQueryBusinessLogic.CreateSenderRecipientEdgeGraphQuery(SenderID, RecipientID) }; return(queries); }
public static MatterGraphModel GetMatters(IGraphConfiguration GraphConfiguration) { using (var tagHiveClient = CommunicationProcessingBusinessLogic.CreateGremlinClient(GraphConfiguration)) { string query = GraphQueryBusinessLogic.GetMattersGraphQuery(); var results = CommunicationProcessingBusinessLogic.SubmitRequest(tagHiveClient, query).Result; var jsonString = JsonConvert.SerializeObject(results); return(JsonConvert.DeserializeObject <MatterGraphModel>(jsonString)); } }
public static DocumentGraphModelList GetDocumentsForTag(IGraphConfiguration GraphConfiguration, string Tag) { using (var tagHiveClient = CommunicationProcessingBusinessLogic.CreateGremlinClient(GraphConfiguration)) { string query = GraphQueryBusinessLogic.GetDocumentsForTagGraphQuery(Tag); var results = CommunicationProcessingBusinessLogic.SubmitRequest(tagHiveClient, query).Result; var jsonString = JsonConvert.SerializeObject(results); return(JsonConvert.DeserializeObject <DocumentGraphModelList>(jsonString)); } }
public static ResultSet <dynamic> AddGraphEdge(GremlinClient GremlinClient, string FromVertexID, string ToVertexID, string EdgeLabel, Dictionary <string, string> Properties = null) { try { var query = GraphQueryBusinessLogic.CreateAddEdgeGraphQuery(FromVertexID, ToVertexID, EdgeLabel, Properties); var results = TransactGraphQuery(GremlinClient, query); return(results); } catch (Exception) { throw; } }
public static ResultSet <dynamic> GetGraphEdge(GremlinClient GremlinClient, string FromVertexID, string ToVertexID, string EdgeLabel) { try { var query = GraphQueryBusinessLogic.CreateRetrieveEdgeGraphQuery(FromVertexID, ToVertexID, EdgeLabel); var results = TransactGraphQuery(GremlinClient, query); return(results); } catch (Exception) { throw; } }
public static ResultSet <dynamic> GetGraphVertex(GremlinClient GremlinClient, string VertexLabel, string PropertyName, string PropertyValue) { try { var query = GraphQueryBusinessLogic.CreateRetrieveVertexGraphQuery(VertexLabel, PropertyName, PropertyValue); var results = TransactGraphQuery(GremlinClient, query); return(results); } catch (Exception) { throw; } }
public static List <string> GetTopicSenders(string Topic, IGraphConfiguration GraphConfiguration) { List <string> tagSenders = new List <string>(); using (var tagHiveClient = CommunicationProcessingBusinessLogic.CreateGremlinClient(GraphConfiguration)) { string query = GraphQueryBusinessLogic.GetTopicSendersGraphQuery(Topic); var results = CommunicationProcessingBusinessLogic.SubmitRequest(tagHiveClient, query).Result; if (results.Count > 0) { foreach (var item in results) { //TagSender tagSender = JsonConvert.DeserializeObject<TagSender>(JsonConvert.SerializeObject(item)); tagSenders.Add(item); } } } return(tagSenders); }
public static Dictionary <string, int> GetTopicSendersWithSentValues(string Topic, IGraphConfiguration GraphConfiguration) { Dictionary <string, int> tagSenders = new Dictionary <string, int>(); using (var tagHiveClient = CommunicationProcessingBusinessLogic.CreateGremlinClient(GraphConfiguration)) { string query = GraphQueryBusinessLogic.GetTopicSendersGraphQueryWithSentValues(Topic); var results = CommunicationProcessingBusinessLogic.SubmitRequest(tagHiveClient, query).Result; if (results.Count > 0) { foreach (var resultsetItem in results) { foreach (var item in resultsetItem) { tagSenders.Add(((KeyValuePair <string, object>)item).Key, int.Parse(((KeyValuePair <string, object>)item).Value.ToString())); } } } } return(tagSenders); }
public static List <string> ParseConcatenatedString(string ConcatenatedStrings, string Delimiter = null, bool MakeLowerCase = true, bool RemoveReservedCharacters = true, string ReplacementCharacters = "") { if (Delimiter == null) { Delimiter = CommunicationAddressDelimiter; } List <string> returnList = new List <string>(); if (ConcatenatedStrings != null && ConcatenatedStrings.Length > 0) { var entries = ConcatenatedStrings.Split(new string[] { Delimiter }, StringSplitOptions.None); foreach (var entry in entries) { //Limiting total tag length if (entry.Length <= MaximumTagLength) { var entryValue = entry; entryValue = GraphQueryBusinessLogic.ConformStringForQuery(entryValue, MakeLowerCase, RemoveReservedCharacters, ReplacementCharacters); returnList.Add(entryValue); } } } return(returnList); }
private static void GenerateVertexInsertionQuery(Dictionary <string, string> GremlinQueries, KeyValuePair <string, string> KVP, string VertexType, string PartitionName = null) { var query = GraphQueryBusinessLogic.CreateAddVertexGraphQuery(VertexType, KVP.Key, Guid.NewGuid().ToString(), PartitionName); GremlinQueries.Add(String.Format("AddVertex {0}", KVP.Key), query); }