|
@@ -0,0 +1,101 @@
|
|
|
+/* ==============================================================================
|
|
|
+ * 功能描述:Global_Relation_Defination
|
|
|
+ * 创 建 者:Garrett
|
|
|
+ * 创建日期:2019/1/21 10:04:23
|
|
|
+ * ==============================================================================*/
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.ComponentModel;
|
|
|
+using System.Linq;
|
|
|
+using System.Reflection;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
+using SAGA.DotNetUtils.Extend;
|
|
|
+using SAGA.MBI.RequestData;
|
|
|
+
|
|
|
+namespace SAGA.MBI.Model
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// Global_Relation_Defination
|
|
|
+ /// </summary>
|
|
|
+ public class Global_Relation_Defination
|
|
|
+ {
|
|
|
+ private static Global_Relation_Defination m_Instance;
|
|
|
+ public static Global_Relation_Defination Instance
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ if (m_Instance == null)
|
|
|
+ {
|
|
|
+ string json = RelationRequest.GetGlobalRelationDefination();
|
|
|
+ JObject jObject = JObject.Parse(json);
|
|
|
+ m_Instance =
|
|
|
+ jObject.ConvertToInstance(typeof(Global_Relation_Defination)) as Global_Relation_Defination;
|
|
|
+ }
|
|
|
+
|
|
|
+ return m_Instance;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [Description("Content")]
|
|
|
+ public List<Relation_Graph_Defination> Content { get; set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 查找图类型的定义
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="graph_Type"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public Relation_Graph_Defination FindGraphDefination(string graph_Type)
|
|
|
+ {
|
|
|
+ return Content?.FirstOrDefault(t => t.Graph_Type == graph_Type);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 查找关系类型的定义
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="graph_Type"></param>
|
|
|
+ /// <param name="descrption"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public Relation_Type_Defination FindTypeDefination(string graph_Type, string descrption)
|
|
|
+ {
|
|
|
+ var graphModel = FindGraphDefination(graph_Type);
|
|
|
+
|
|
|
+ return graphModel?.Content?.FirstOrDefault(t=>t.Description== descrption);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 图类型的定义
|
|
|
+ /// </summary>
|
|
|
+ public class Relation_Graph_Defination
|
|
|
+ {
|
|
|
+ public Relation_Graph_Defination()
|
|
|
+ {
|
|
|
+ Content=new List<Relation_Type_Defination>();
|
|
|
+ }
|
|
|
+ [Description("graph_type")]
|
|
|
+ public string Graph_Type { get; set; }
|
|
|
+ [Description("graph_name")]
|
|
|
+ public string Graph_Name { get; set; }
|
|
|
+ [Description("Content")]
|
|
|
+ public List<Relation_Type_Defination> Content { get; set; }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 关系类型的定义
|
|
|
+ /// </summary>
|
|
|
+ public class Relation_Type_Defination
|
|
|
+ {
|
|
|
+ [Description("rel_name")]
|
|
|
+ public string Rel_Name { get; set; }
|
|
|
+ [Description("directional")]
|
|
|
+ public string Directional { get; set; }
|
|
|
+ [Description("target_objs")]
|
|
|
+ public string Target_Objs { get; set; }
|
|
|
+ [Description("rel_type")]
|
|
|
+ public string Rel_Type { get; set; }
|
|
|
+ [Description("description")]
|
|
|
+ public string Description { get; set; }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|