123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- /* ==============================================================================
- * 功能描述: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; }
- }
- }
|