當前位置: 首頁>>代碼示例>>C#>>正文


C# GraphDBType.GetMandatoryAttributes方法代碼示例

本文整理匯總了C#中sones.GraphDB.TypeManagement.GraphDBType.GetMandatoryAttributes方法的典型用法代碼示例。如果您正苦於以下問題:C# GraphDBType.GetMandatoryAttributes方法的具體用法?C# GraphDBType.GetMandatoryAttributes怎麽用?C# GraphDBType.GetMandatoryAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sones.GraphDB.TypeManagement.GraphDBType的用法示例。


在下文中一共展示了GraphDBType.GetMandatoryAttributes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateGraphDDL

        private String CreateGraphDDL(DumpFormats myDumpFormat, GraphDBType myGraphDBType, DBContext myDBContext)
        {
            var stringBuilder = new StringBuilder();
            stringBuilder.AppendFormat("{0} ", myGraphDBType.Name);

            if (myGraphDBType.ParentTypeUUID != null)
            {

                stringBuilder.AppendFormat("{0} {1} ", S_EXTENDS.ToUpperString(), myGraphDBType.GetParentType(myDBContext.DBTypeManager).Name);//builder.AppendLine();

                #region Not backwardEdge attributes

                if (myGraphDBType.GetFilteredAttributes(ta => !ta.IsBackwardEdge).CountIsGreater(0))
                {
                    stringBuilder.Append(S_ATTRIBUTES.ToUpperString() + S_BRACKET_LEFT.ToUpperString() + CreateGraphDDLOfAttributes(myDumpFormat, myGraphDBType.GetFilteredAttributes(ta => !ta.IsBackwardEdge), myDBContext) + S_BRACKET_RIGHT.ToUpperString() + " ");
                }

                #endregion

                #region BackwardEdge attributes

                if (myGraphDBType.GetFilteredAttributes(ta => ta.IsBackwardEdge).CountIsGreater(0))
                {
                    stringBuilder.Append(S_BACKWARDEDGES.ToUpperString() + S_BRACKET_LEFT.ToUpperString() + CreateGraphDDLOfBackwardEdges(myDumpFormat, myGraphDBType.GetFilteredAttributes(ta => ta.IsBackwardEdge), myDBContext) + S_BRACKET_RIGHT.ToUpperString() + " ");
                }

                #endregion

                #region Uniques

                if (myGraphDBType.GetUniqueAttributes().CountIsGreater(0))
                {
                    stringBuilder.Append(S_UNIQUE.ToUpperString() + S_BRACKET_LEFT.Symbol + CreateGraphDDLOfAttributeUUIDs(myDumpFormat, myGraphDBType.GetUniqueAttributes(), myGraphDBType) + S_BRACKET_RIGHT.Symbol + " ");
                }

                #endregion

                #region Mandatory attributes

                if (myGraphDBType.GetMandatoryAttributes().CountIsGreater(0))
                {
                    stringBuilder.Append(S_MANDATORY.ToUpperString() + S_BRACKET_LEFT.Symbol + CreateGraphDDLOfAttributeUUIDs(myDumpFormat, myGraphDBType.GetMandatoryAttributes(), myGraphDBType) + S_BRACKET_RIGHT.Symbol + " ");
                }

                #endregion

                #region Indices

                if (myGraphDBType.GetAllAttributeIndices(false).CountIsGreater(0))
                {
                    stringBuilder.Append(S_INDICES.ToUpperString() + S_BRACKET_LEFT.Symbol + CreateGraphDDLOfIndices(myDumpFormat, myGraphDBType.GetAllAttributeIndices(false), myGraphDBType) + S_BRACKET_RIGHT.Symbol + " ");
                }

                #endregion

            }

            return stringBuilder.ToString();
        }
開發者ID:ipbi,項目名稱:sones,代碼行數:59,代碼來源:GraphQueryLanguage.cs

示例2: GenerateOutput

        /// <summary>
        /// Generate an output for an type with the attributes of the types and all parent types
        /// </summary>         
        /// <param name="myGraphDBType">The db type</param>
        /// <param name="myDBContext">The db context</param>
        /// <param name="myDepth">If depth == 0 only the type basic attributes will be returned</param>
        private Vertex GenerateOutput(DBContext myDBContext, GraphDBType myGraphDBType, Int32 myDepth = 0)
        {
            var retVal = new Vertex();

            if (myGraphDBType.ParentTypeUUID != null)

            retVal.AddAttribute("UUID",        myGraphDBType.UUID);
            retVal.AddAttribute("TYPE",        myGraphDBType.GetType().Name);
            retVal.AddAttribute("Name",        myGraphDBType.Name);
            retVal.AddAttribute("Comment",     myGraphDBType.Comment);

            if (myDepth > 0)
            {

                retVal.AddAttribute("Properties", new Edge(retVal, GeneratePropertiesOutput(myGraphDBType, myDBContext,
                    myGraphDBType.Attributes.Where(a => !(a.Value.EdgeType is IReferenceEdge)).Select(kv => kv.Value)))
                {
                    EdgeTypeName = "Property"
                });

                retVal.AddAttribute("Edges", new Edge(retVal, GenerateEdgesOutput(myGraphDBType, myDBContext, myGraphDBType.Attributes.Where(a => (a.Value.EdgeType is IReferenceEdge) && !a.Value.IsBackwardEdge).Select(kv => kv.Value)))
                {
                    EdgeTypeName = "Edge"
                });

                retVal.AddAttribute("BackwardEdges", new Edge(retVal, GenerateEdgesOutput(myGraphDBType, myDBContext, myGraphDBType.Attributes.Where(a => (a.Value.EdgeType is IReferenceEdge) && a.Value.IsBackwardEdge).Select(kv => kv.Value)))
                {
                    EdgeTypeName = "Edge"
                });

                retVal.AddAttribute("UniqueAttributes", new Edge(retVal, GeneratePropertiesOutput(myGraphDBType, myDBContext,
                    myGraphDBType.GetUniqueAttributes().Select(a => myGraphDBType.GetTypeAttributeByUUID(a))))
                {
                    EdgeTypeName = "Unique"
                });

                retVal.AddAttribute("MandatoryAttributes", new Edge(retVal, GeneratePropertiesOutput(myGraphDBType, myDBContext,
                    myGraphDBType.GetMandatoryAttributes().Select(a => myGraphDBType.GetTypeAttributeByUUID(a))))
                {
                    EdgeTypeName = "Mandatory"
                });

                retVal.AddAttribute("Indices", new Edge(retVal, GenerateIndicesOutput(myGraphDBType, myDBContext))
                {
                    EdgeTypeName = "Index"
                });

                if (myGraphDBType.ParentTypeUUID != null)
                {
                    var _ParentType = myDBContext.DBTypeManager.GetTypeByUUID(myGraphDBType.ParentTypeUUID);
                    retVal.AddAttribute("Extends", new Edge(retVal, GenerateOutput(myDBContext, _ParentType, myDepth - 1))
                    {
                        EdgeTypeName = "VertexType"
                    });
                }

            }

            return retVal;
        }
開發者ID:Vadi,項目名稱:sones,代碼行數:66,代碼來源:DescribeTypeDefinition.cs


注:本文中的sones.GraphDB.TypeManagement.GraphDBType.GetMandatoryAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。