当前位置: 首页>>代码示例>>C#>>正文


C# IVertexType.GetAttributeDefinitions方法代码示例

本文整理汇总了C#中IVertexType.GetAttributeDefinitions方法的典型用法代码示例。如果您正苦于以下问题:C# IVertexType.GetAttributeDefinitions方法的具体用法?C# IVertexType.GetAttributeDefinitions怎么用?C# IVertexType.GetAttributeDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVertexType的用法示例。


在下文中一共展示了IVertexType.GetAttributeDefinitions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddVertexTypeAndAttributesRecursivly

        private void AddVertexTypeAndAttributesRecursivly(IGraphDB myGraphDB, 
            SecurityToken mySecurityToken,
            Int64 myTransactionToken,
            IVertexType type,
            ref HashSet<IVertexType> types)
        {
            if (!type.IsUserDefined) return;

            if (type.HasParentType)
            {
                if (!types.Contains(type.ParentVertexType))
                {
                    types.Add(type.ParentVertexType);

                    foreach (var attr in (type.GetAttributeDefinitions(false)).Where(attrDef => attrDef.Kind == AttributeType.Property))
                    {
                        var attrType = myGraphDB.GetVertexType<IVertexType>(mySecurityToken,
                                                                            myTransactionToken,
                                                                            new RequestGetVertexType(attr.ID),
                                                                            (stats, vertex) => vertex);

                        AddVertexTypeAndAttributesRecursivly(myGraphDB,
                                                                mySecurityToken,
                                                                myTransactionToken,
                                                                attrType,
                                                                ref types);
                    }
                }
            }
        }
开发者ID:anukat2015,项目名称:sones,代码行数:30,代码来源:GraphDBExport_GQL.cs

示例2: CreateGraphDDL_VertexType

        /// <summary>
        /// Creates the ddl of a type.
        /// </summary>
        /// <param name="myVertexType">The vertex type.</param>
        private String CreateGraphDDL_VertexType(IVertexType myVertexType)
        {
            var stringBuilder = new StringBuilder();
            String delimiter = ", ";
            stringBuilder.AppendFormat("{0} ", myVertexType.Name);

            #region parent type

            //EXTENDS ...
            if (myVertexType.HasParentType)
            {
                stringBuilder.AppendFormat("{0} {1} ", S_EXTENDS.ToUpperString(), myVertexType.ParentVertexType.Name);
            }

            #endregion

            #region attributes
            //are there attributes
            if (myVertexType.HasAttributes(false))
            {
                #region !incomingEdges

                if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind != AttributeType.IncomingEdge))
                {
                    //so, there are attributes that are no incoming edges
                    stringBuilder.Append(String.Concat(S_ATTRIBUTES.ToUpperString(), " ", S_BRACKET_LEFT));

                    #region properties

                    if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.Property))
                    {
                        stringBuilder.Append(String.Concat(CreateGraphDDLOfProperties(myVertexType.GetPropertyDefinitions(false))));
                    }

                    #endregion

                    #region outgoing edges

                    if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.OutgoingEdge))
                    {
                        stringBuilder.Append(String.Concat(CreateGraphDDLOfOutgoingEdges(myVertexType.GetOutgoingEdgeDefinitions(false), myVertexType)));
                    }

                    #endregion

                    if (stringBuilder.ToString().EndsWith(delimiter))
                        stringBuilder.RemoveSuffix(delimiter);

                    stringBuilder.Append(String.Concat(S_BRACKET_RIGHT, " "));

                }

                #endregion

                #region incomingEdges

                if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.IncomingEdge))
                {
                    stringBuilder.Append(
                        String.Concat(S_INCOMINGEDGES.ToUpperString(),
                                        " ",
                                        S_BRACKET_LEFT.ToUpperString(),
                                        CreateGraphDDLOfIncomingEdges(
                                            myVertexType.GetIncomingEdgeDefinitions(false)),
                                        S_BRACKET_RIGHT.ToUpperString(), " "));
                }

                #endregion
            }

            #endregion

            #region Uniques

            if (myVertexType.HasUniqueDefinitions(false))
            {
                if (myVertexType.GetUniqueDefinitions(false).Count() > 0)
                {
                    stringBuilder.Append(S_UNIQUE.ToUpperString() +
                                            " " +
                                            S_BRACKET_LEFT.Symbol +
                                            CreateGraphDDLOfUniqueAttributes(
                                                myVertexType
                                                    .GetUniqueDefinitions(false)) +
                                            S_BRACKET_RIGHT.Symbol + " ");
                }
            }

            #endregion

            #region Mandatory attributes

            if (myVertexType.HasProperties(false))
            {
                if (myVertexType.GetPropertyDefinitions(false).Any(aProperty => aProperty.IsMandatory))
                {
//.........这里部分代码省略.........
开发者ID:cosh,项目名称:sones,代码行数:101,代码来源:SonesGQLGrammar.cs

示例3: CheckToBeRemovedUniques

        private static void CheckToBeRemovedUniques(IEnumerable<string> myUniques, IVertexType vertexType)
        {
            var uniqueDefs = vertexType.GetUniqueDefinitions(true);

            if (myUniques == null)
                return;

            var attributes = vertexType.GetAttributeDefinitions(false).ToList();

            foreach (var aUnique in myUniques)
            {
                if (!attributes.Any(_ => _.Name == aUnique && uniqueDefs.Any(x => x.UniquePropertyDefinitions.Any(y => y.Name == aUnique))))
                {
                    throw new AttributeDoesNotExistException(aUnique, vertexType.Name);
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:17,代码来源:CheckVertexTypeManager.cs

示例4: AddTypeAndAttributesRecursivly

        private void AddTypeAndAttributesRecursivly(ref IGraphDB myGraphDB, ref SecurityToken mySecurityToken, ref TransactionToken myTransactionToken, IVertexType type, ref HashSet<IVertexType> types)
        {
            if (!type.IsUserDefined) return;

            if (type.HasParentType)
            {
                if (!types.Contains(type.ParentVertexType))
                {
                    types.Add(type.ParentVertexType);
                    foreach (var attr in (type.GetAttributeDefinitions(false)).Where(attrDef => attrDef.Kind == AttributeType.Property))
                    {
                        var attrType = myGraphDB.GetVertexType<IVertexType>(mySecurityToken, myTransactionToken, new RequestGetVertexType(attr.ID), (stats, vertex) => vertex);
                        AddTypeAndAttributesRecursivly(ref myGraphDB, ref mySecurityToken, ref myTransactionToken, attrType, ref types);
                    }
                }

                //types.UnionWith(myDBContext.DBTypeManager.GetAllParentTypes(type, true, false));
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:19,代码来源:GraphDBExport_GQL.cs

示例5: CheckToBeRemovedMandatory

        private static void CheckToBeRemovedMandatory(IEnumerable<string> myMandatories, IVertexType vertexType)
        {
            if (myMandatories == null)
                return;

            var attributes = vertexType.GetAttributeDefinitions(false).ToList();

            foreach (var aMandatory in myMandatories)
            {
                if (!attributes.Any(_ => _.Name == aMandatory && (_ as IPropertyDefinition).IsMandatory))
                {
                    throw new AttributeDoesNotExistException(aMandatory, vertexType.Name);
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:15,代码来源:CheckVertexTypeManager.cs

示例6: CheckToBeRemovedAttributes

        /// <summary>
        /// Checks if the to be removed attributes exists on this type
        /// </summary>
        /// <param name="myAlterVertexTypeRequest"></param>
        /// <param name="vertexType"></param>
        private static void CheckToBeRemovedAttributes(RequestAlterVertexType myAlterVertexTypeRequest, IVertexType vertexType)
        {
            #region properties

            var attributesOfCurrentVertexType = vertexType.GetAttributeDefinitions(false).ToList();

            if (myAlterVertexTypeRequest.ToBeRemovedProperties != null)
            {
                foreach (var aToBeDeletedAttribute in myAlterVertexTypeRequest.ToBeRemovedProperties)
                {
                    if (!attributesOfCurrentVertexType.Any(_ => _.Name == aToBeDeletedAttribute))
                    {
                        throw new VertexAttributeIsNotDefinedException(aToBeDeletedAttribute);
                    }
                }
            }

            #endregion

            #region outgoing Edges

            if (myAlterVertexTypeRequest.ToBeRemovedOutgoingEdges != null)
            {
                foreach (var aToBeDeletedAttribute in myAlterVertexTypeRequest.ToBeRemovedOutgoingEdges)
                {
                    if (!attributesOfCurrentVertexType.Any(_ => _.Name == aToBeDeletedAttribute))
                    {
                        throw new VertexAttributeIsNotDefinedException(aToBeDeletedAttribute);
                    }
                }
            }

            #endregion

            #region incoming edges

            if (myAlterVertexTypeRequest.ToBeRemovedIncomingEdges != null)
            {
                foreach (var aToBeDeletedAttribute in myAlterVertexTypeRequest.ToBeRemovedIncomingEdges)
                {
                    if (!attributesOfCurrentVertexType.Any(_ => _.Name == aToBeDeletedAttribute))
                    {
                        throw new VertexAttributeIsNotDefinedException(aToBeDeletedAttribute);
                    }
                }
            }

            #endregion
        }
开发者ID:loubo,项目名称:sones,代码行数:54,代码来源:CheckVertexTypeManager.cs

示例7: CheckToBeAddedUniques

        private static void CheckToBeAddedUniques(RequestAlterVertexType myAlterVertexTypeRequest, IVertexType vertexType)
        {
            var uniques = myAlterVertexTypeRequest.ToBeAddedUniques;
            var addProperties = myAlterVertexTypeRequest.ToBeAddedProperties;

            if (uniques == null)
                return;

            var attributes = vertexType.GetAttributeDefinitions(false).ToList();

            foreach (var aUnique in uniques)
            {
                foreach (var aAttribute in aUnique.Properties)
                {
                    if (!attributes.Any(_ => _.Name == aAttribute) && !addProperties.Any(x => x.AttributeName == aAttribute))
                    {
                        throw new AttributeDoesNotExistException(aAttribute, vertexType.Name);
                    }
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:21,代码来源:CheckVertexTypeManager.cs

示例8: CheckToBeAddedMandatory

        private static void CheckToBeAddedMandatory(RequestAlterVertexType myAlterVertexTypeRequest, IVertexType vertexType)
        {
            var mandatories = myAlterVertexTypeRequest.ToBeAddedMandatories;
            var addProperties = myAlterVertexTypeRequest.ToBeAddedProperties;

            if (mandatories == null)
                return;

            var attributes = vertexType.GetAttributeDefinitions(false).ToList();

            foreach (var aMandatory in mandatories)
            {
                if (!attributes.Any(_ => _.Name == aMandatory.MandatoryAttribute) && !addProperties.Any(x => x.AttributeName == aMandatory.MandatoryAttribute))
                {
                    throw new AttributeDoesNotExistException(aMandatory.MandatoryAttribute, vertexType.Name);
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:18,代码来源:CheckVertexTypeManager.cs

示例9: CheckOldName

        /// <summary>
        /// Checks if the old name exists on the given vertex type
        /// </summary>
        /// <param name="myOldAttributeName"></param>
        /// <param name="vertexType"></param>
        /// <returns></returns>
        private static bool CheckOldName(string myOldAttributeName, IVertexType vertexType)
        {
            if (myOldAttributeName != null)
            {
                var attributesOfCurrentVertexType = vertexType.GetAttributeDefinitions(false).ToList();

                return attributesOfCurrentVertexType.Any(_ => _.Name == myOldAttributeName);
            }

            return true;
        }
开发者ID:loubo,项目名称:sones,代码行数:17,代码来源:CheckVertexTypeManager.cs


注:本文中的IVertexType.GetAttributeDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。