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


C# IVertex.GetIncomingVertices方法代码示例

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


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

示例1: GetAttributeVertices

        private static IEnumerable<IVertex> GetAttributeVertices(IVertex myTypeVertex, long myAttributeVertexID)
        {
            if (myTypeVertex.HasIncomingVertices(myAttributeVertexID, (long)AttributeDefinitions.AttributeDotDefiningType))
            {
                var vertices = myTypeVertex.GetIncomingVertices(myAttributeVertexID, (long)AttributeDefinitions.AttributeDotDefiningType);
                foreach (var vertex in vertices)
                {
                    if (vertex == null)
                        throw new UnknownDBException("An element in attributes list is NULL.");

                    yield return vertex;
                }
            }
            yield break;
        }
开发者ID:loubo,项目名称:sones,代码行数:15,代码来源:BaseGraphStorageManager.cs

示例2: GetInIndices

        private static IEnumerable<IIndexDefinition> GetInIndices(IVertex myVertex)
        {
            if (myVertex.HasIncomingVertices((long)BaseTypes.Index, (long)AttributeDefinitions.IndexDotIndexedProperties))
            {
                var indices = myVertex.GetIncomingVertices((long)BaseTypes.Index, (long)AttributeDefinitions.IndexDotIndexedProperties);

                return indices.Select(_ => CreateIndexDefinition(_));
            }
            return Enumerable.Empty<IIndexDefinition>();
        }
开发者ID:loubo,项目名称:sones,代码行数:10,代码来源:BaseGraphStorageManager.cs

示例3: AddNodeIfValid

        /// <summary>
        /// This method adds a IVertex to a Level if it is valid for a LevelKey.
        /// </summary>
        /// <param name="aDBObject">The Object that is going to be added</param>
        /// <param name="myLevelKey">The LevelKey which is needed for validation.</param>
        /// <param name="currentBackwardResolution">The current backward resolution (initially 0)</param>
        /// <param name="source">The Int64 of the </param>
        /// <returns>True if it was valid or false otherwise.</returns>
        private bool AddNodeIfValid(IVertex aDBObject, LevelKey myLevelKey, int currentBackwardResolution, VertexInformation source, int backwardResolutiondepth)
        {
            #region data

            IAttributeDefinition tempTypeAttribute = null;

            IEnumerable<IVertex> referenceUUIDs = null;

            #endregion

            if ((myLevelKey.Level - currentBackwardResolution) > 0)
            {
                #region level > 0

                int desiredBackwardEdgeLevel = myLevelKey.Level - currentBackwardResolution - 1;

                var tempVertexType = _iGraphDB.GetVertexType(
                    _securityToken,
                    _transactionToken,
                    new RequestGetVertexType(myLevelKey.Edges[desiredBackwardEdgeLevel].VertexTypeID),
                    (stats, vertexType) => vertexType);

                tempTypeAttribute = tempVertexType.GetAttributeDefinition(myLevelKey.Edges[desiredBackwardEdgeLevel].AttributeID);

                #region get reference UUIDs

                if (tempTypeAttribute.Kind == AttributeType.IncomingEdge)
                {
                    #region backward edge handling

                    var incomingEdgeAttribute = tempTypeAttribute as IIncomingEdgeDefinition;

                    if (aDBObject.HasOutgoingEdge(incomingEdgeAttribute.RelatedEdgeDefinition.ID))
                    {
                        referenceUUIDs = aDBObject.GetOutgoingEdge(incomingEdgeAttribute.RelatedEdgeDefinition.ID).GetTargetVertices();
                        //GetUUIDsForAttribute(aDBObject, incomingEdgeAttribute.RelatedEdgeDefinition, tempTypeAttribute.BackwardEdgeDefinition.GetTypeAndAttributeInformation(_DBContext.DBTypeManager).Item2, _DBContext.DBTypeManager.GetTypeByUUID(aDBObject.TypeUUID));
                    }

                    #endregion
                }
                else
                {
                    #region forward edge handling

                    var tempEdgeKey = GetBackwardEdgeKey(myLevelKey, desiredBackwardEdgeLevel, _iGraphDB, _securityToken, _transactionToken);

                    if (!aDBObject.HasIncomingVertices(tempEdgeKey.VertexTypeID, tempEdgeKey.AttributeID))
                    {
                        return false;
                    }

                    referenceUUIDs = aDBObject.GetIncomingVertices(tempEdgeKey.VertexTypeID, tempEdgeKey.AttributeID);

                    #endregion
                }

                #endregion

                if (referenceUUIDs != null)
                {
                    #region references

                    Dictionary<VertexInformation, IComparable> validUUIDs = new Dictionary<VertexInformation, IComparable>();

                    #region process references recursivly

                    foreach (var aReferenceUUID in referenceUUIDs)
                    {
                        if (AddNodeIfValid(aReferenceUUID, myLevelKey, currentBackwardResolution + 1, GenerateVertexInfoFromLevelKeyAndVertexID(aDBObject.VertexTypeID, aDBObject.VertexID), backwardResolutiondepth))
                        {
                            validUUIDs.Add(GenerateVertexInfoFromLevelKeyAndVertexID(aReferenceUUID.VertexTypeID, aReferenceUUID.VertexID), null);
                        }
                    }

                    #endregion

                    if (validUUIDs.Count > 0)
                    {
                        //some valid uuids
                        if (currentBackwardResolution <= backwardResolutiondepth)
                        {
                            #region fill graph

                            FillGraph(aDBObject, myLevelKey, currentBackwardResolution, source, myLevelKey.Edges[desiredBackwardEdgeLevel], validUUIDs);

                            #endregion
                        }

                        return true;
                    }
                    else
                    {
//.........这里部分代码省略.........
开发者ID:loubo,项目名称:sones,代码行数:101,代码来源:CommonUsageGraph.cs

示例4: AddAttributesByDBO

        /// <summary>
        /// This will add all attributes of <paramref name="myDBObject"/> to the 
        /// <paramref name="myAttributes"/> reference. Reference attributes will be resolved to the <paramref name="myDepth"/>
        /// </summary>
        private void AddAttributesByDBO(
            SecurityToken mySecurityToken,
            Int64 myTransactionToken,
            ref Tuple<IDictionary<String, Object>, IDictionary<String, IEdgeView>> myAttributes,
            IVertexType myType,
            IVertex myDBObject,
            Int64 myDepth,
            EdgeList myEdgeList,
            String myReference,
            Boolean myUsingGraph,
            TypesOfSelect mySelType,
            Int64? myTypeID = null)
        {

            #region Get all attributes which are stored at the DBO

            #region properties

            foreach (var aProperty in myType.GetPropertyDefinitions(true))
            {
                var tempResult = aProperty.GetValue(myDBObject);

                if (tempResult != null)
                {
                    myAttributes.Item1.Add(aProperty.Name, tempResult);
                }
            }

            #endregion

            #region unstructured data

            foreach (var aUnstructuredProperty in myDBObject.GetAllUnstructuredProperties())
            {
                myAttributes.Item1.Add(aUnstructuredProperty.PropertyName, aUnstructuredProperty.Property);
            }

            #endregion

            #region outgoing edges

            foreach (var outgoingEdgeDefinition in myType.GetOutgoingEdgeDefinitions(true))
            {
                if (myDBObject.HasOutgoingEdge(outgoingEdgeDefinition.ID))
                {
                    // Since we can define special depth (via setting) for attributes we need to check them now
                    myDepth = GetDepth(-1, myDepth, myType, outgoingEdgeDefinition);
                    if ((myDepth > 0))
                    {
                        myAttributes.Item2.Add(
                            outgoingEdgeDefinition.Name,
                            ResolveAttributeValue(
                                outgoingEdgeDefinition,
                                myDBObject.GetOutgoingEdge(outgoingEdgeDefinition.ID),
                                myDepth,
                                myEdgeList,
                                myDBObject,
                                myReference,
                                myUsingGraph,
                                mySecurityToken,
                                myTransactionToken));
                    }
                    else
                    {
                        myAttributes.Item2.Add(outgoingEdgeDefinition.Name, 
                                                GetNotResolvedReferenceEdgeAttributeValue(myDBObject
                                                                                            .GetOutgoingEdge(outgoingEdgeDefinition.ID)
                                                                                            .GetTargetVertices()));
                    }
                }
            }

            #endregion

            #region incoming

            foreach (var aIncomingEdgeDefinition in myType.GetIncomingEdgeDefinitions(true))
            {
                if (myDBObject.HasIncomingVertices(aIncomingEdgeDefinition
                                                    .RelatedEdgeDefinition
                                                    .RelatedType.ID, 
                                                   aIncomingEdgeDefinition
                                                    .RelatedEdgeDefinition.ID))
                {
                    if (myDepth > 0)
                    {
                        myAttributes.Item2.Add(
                            aIncomingEdgeDefinition.Name,
                            ResolveIncomingEdgeValue(
                                aIncomingEdgeDefinition,
                                myDBObject.GetIncomingVertices(aIncomingEdgeDefinition
                                                                .RelatedEdgeDefinition
                                                                .RelatedType
                                                                .ID, 
                                                               aIncomingEdgeDefinition
                                                                .RelatedEdgeDefinition.ID),
//.........这里部分代码省略.........
开发者ID:cosh,项目名称:sones,代码行数:101,代码来源:SelectResultManager.cs

示例5: GetAttributeValueAndResolve

        /// <summary>   Gets an attribute value - references will be resolved. </summary>
        ///
        /// <remarks>   Stefan, 16.04.2010. </remarks>
        ///
        /// <param name="myType">           Type. </param>
        /// <param name="myTypeAttribute">  my type attribute. </param>
        /// <param name="myDBObject">       my database object. </param>
        /// <param name="myDepth">          Depth of my. </param>
        /// <param name="myLevelKey">       my level key. </param>
        /// <param name="reference">        The reference. </param>
        /// <param name="myUsingGraph">     true to my using graph. </param>
        /// <param name="attributeValue">   [out] The attribute value. </param>
        ///
        /// <returns>   true if it succeeds, false if the DBO does not have the attribute. </returns>
        private Boolean GetAttributeValueAndResolve(SecurityToken mySecurityToken,
                                                    Int64 myTransactionToken,
                                                    IVertexType myType,
                                                    SelectionElement mySelectionelement,
                                                    IVertex myDBObject,
                                                    Int64 myDepth,
                                                    EdgeList myLevelKey,
                                                    String reference,
                                                    Boolean myUsingGraph,
                                                    out Object attributeValue,
                                                    String myUndefAttrName = null)
        {

            var typeAttribute = mySelectionelement.Element;

            switch (typeAttribute.Kind)
            {
                case AttributeType.Property:
                    #region property

                    var property = (IPropertyDefinition)typeAttribute;

                    attributeValue = property.GetValue(myDBObject);

                    return attributeValue != null;

                    #endregion

                case AttributeType.IncomingEdge:

                    #region IsBackwardEdge

                    var incomingEdgeAttribute = (IIncomingEdgeDefinition)typeAttribute;

                    if (myDBObject.HasIncomingVertices(incomingEdgeAttribute.RelatedEdgeDefinition.RelatedType.ID, incomingEdgeAttribute.RelatedEdgeDefinition.ID))
                    {
                        var dbos = myDBObject.GetIncomingVertices(incomingEdgeAttribute.RelatedEdgeDefinition.RelatedType.ID, incomingEdgeAttribute.RelatedEdgeDefinition.ID);

                        if (dbos != null)
                        {
                            if (myDepth > 0)
                            {
                                attributeValue = ResolveIncomingEdgeValue(incomingEdgeAttribute, 
                                                                            dbos, 
                                                                            myDepth, 
                                                                            myLevelKey, 
                                                                            myDBObject, 
                                                                            reference, 
                                                                            myUsingGraph, 
                                                                            mySecurityToken, 
                                                                            myTransactionToken);
                            }
                            else
                            {
                                attributeValue = GetNotResolvedReferenceEdgeAttributeValue(dbos);
                            }

                            return true;

                        }
                    }

                    #endregion

                    break;
                case AttributeType.OutgoingEdge:
                    #region outgoing edges

                    if (myDBObject.HasOutgoingEdge(typeAttribute.ID))
                    {
                        var edge = myDBObject.GetOutgoingEdge(typeAttribute.ID);

                        if (edge != null)
                        {
                            if (myDepth > 0)
                            {
                                attributeValue = ResolveAttributeValue(
                                                    (IOutgoingEdgeDefinition)typeAttribute, 
                                                    edge, 
                                                    myDepth, 
                                                    myLevelKey, 
                                                    myDBObject, 
                                                    reference, 
                                                    myUsingGraph, 
                                                    mySecurityToken, 
                                                    myTransactionToken);
//.........这里部分代码省略.........
开发者ID:cosh,项目名称:sones,代码行数:101,代码来源:SelectResultManager.cs

示例6: GetCallingObject

        private object GetCallingObject(IVertex myDBObject, IAttributeDefinition iAttributeDefinition)
        {
            switch (iAttributeDefinition.Kind)
            {
                case AttributeType.Property:

                    return ((IPropertyDefinition)iAttributeDefinition).GetValue(myDBObject);

                case AttributeType.IncomingEdge:

                    var incomingEdgeAttribue = (IIncomingEdgeDefinition)iAttributeDefinition;

                    if (myDBObject.HasIncomingVertices(incomingEdgeAttribue.RelatedEdgeDefinition.RelatedType.ID, incomingEdgeAttribue.RelatedEdgeDefinition.ID))
                    {
                        return myDBObject.GetIncomingVertices(incomingEdgeAttribue.RelatedEdgeDefinition.RelatedType.ID, incomingEdgeAttribue.RelatedEdgeDefinition.ID);
                    }
                    return null;

                case AttributeType.OutgoingEdge:

                    return myDBObject.HasOutgoingEdge(iAttributeDefinition.ID) ? myDBObject.GetOutgoingEdge(iAttributeDefinition.ID) : null;

                case AttributeType.BinaryProperty:
                default:

                    return null;
            }
        }
开发者ID:cosh,项目名称:sones,代码行数:28,代码来源:SelectResultManager.cs

示例7: GetIncomingVertices

        private IEnumerable<IVertex> GetIncomingVertices(IVertex myVertex)
        {
            List<IVertex> temp = new List<IVertex>();

            foreach (var type in _Types)
            {
                if (myVertex.HasIncomingVertices(type.ID, _AttributeDefinition.ID))
                    temp.AddRange(myVertex.GetIncomingVertices(type.ID, _AttributeDefinition.ID));
            }

            return temp;
        }
开发者ID:anukat2015,项目名称:sones,代码行数:12,代码来源:BidirectionalBFS.cs


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