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


C# IVertex.GetOutgoingEdge方法代码示例

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


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

示例1: GetEdge

        public static IEdge GetEdge(this IOutgoingEdgeDefinition myProperty, IVertex myVertex)
        {
            if (myProperty == null)
                throw new NullReferenceException();

            return myVertex.GetOutgoingEdge(myProperty.ID);
        }
开发者ID:anukat2015,项目名称:sones,代码行数:7,代码来源:IOutgoingEdgeDefinitionExtension.cs

示例2: CreateVertexUpdateDefinition


//.........这里部分代码省略.........

                        }
                    }
                }
            }

            #endregion

            #region extract vertex properties
            #region will be ignored
            long vertexID = 0L;
            long creationDate = 0L;
            long modificationDate = 0L;
            #endregion

            ExtractVertexProperties(ref edition, ref revision, ref comment, ref vertexID, ref creationDate, ref modificationDate, toBeUpdatedStructured);
            #endregion

            #region edge magic

            if (myUpdate.AddedElementsToCollectionEdges != null ||
                myUpdate.RemovedElementsFromCollectionEdges != null ||
                myUpdate.UpdateOutgoingEdges != null ||
                myUpdate.UpdateOutgoingEdgesProperties != null)
            {
                VertexInformation source = new VertexInformation(myVertex.VertexTypeID, myVertex.VertexID);

                #region update outgoing edges

                if (myUpdate.UpdateOutgoingEdges != null)
                {
                    foreach (var edge in myUpdate.UpdateOutgoingEdges)
                    {
                        var edgeDef = myVertexType.GetOutgoingEdgeDefinition(edge.EdgeName);

                        switch (edgeDef.Multiplicity)
                        {
                            case EdgeMultiplicity.SingleEdge:
                                {
                                    #region SingleEdge
                                    var targets = GetResultingVertexIDs(myTransaction, mySecurity, edge, edgeDef.TargetVertexType);
                                    if (targets == null || !targets.CountIsGreater(0))
                                    {
                                        toBeDeletedSingle = toBeDeletedSingle ?? new List<long>();
                                        toBeDeletedSingle.Add(edgeDef.ID);
                                    }
                                    else if (targets.CountIsGreater(1))
                                    {
                                        throw new Exception("Single edge can not have more than one target.");
                                    }
                                    else
                                    {
                                        ConvertUnknownProperties(edge, edgeDef.EdgeType);
                                        var structured = CreateStructuredUpdate(edge.StructuredProperties, edgeDef.EdgeType);
                                        var unstructured = CreateUnstructuredUpdate(edge.UnstructuredProperties);

                                        toBeUpdatedSingle = toBeUpdatedSingle ?? new Dictionary<long, SingleEdgeUpdateDefinition>();

                                        toBeUpdatedSingle.Add(edgeDef.ID,
                                                                new SingleEdgeUpdateDefinition(source,
                                                                                                targets.First(),
                                                                                                edgeDef.EdgeType.ID,
                                                                                                edge.Comment,
                                                                                                structured,
                                                                                                unstructured));
                                    }
开发者ID:anukat2015,项目名称:sones,代码行数:67,代码来源:ExecuteVertexHandler.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: CheckNextVerticesOfLeftSide

        private HashSet<List<Tuple<long, long>>> CheckNextVerticesOfLeftSide(ref IVertex myCurrentVertexLeft, ref Node myCurrentNodeLeft)
        {
            //get all referenced ObjectUUIDs using the given Edge
            var leftVertices = myCurrentVertexLeft.GetOutgoingEdge(_AttributeDefinition.ID).GetTargetVertices();

            #region check left friends
            foreach (var nextLeftVertex in leftVertices)
            {
                Node nextLeftNode = null;
                Tuple<long, long> nextLeft = new Tuple<long, long>(nextLeftVertex.VertexTypeID, nextLeftVertex.VertexID);

                #region if the child is the _Target
                if (nextLeft.Equals(_Target.Key))
                {
                    if (TargetFoundCheckAbort(nextLeft, ref myCurrentNodeLeft, ref nextLeftNode, nextLeftVertex))
                        return new TargetAnalyzer(_Root, _Target, _ShortestPathLength, _ShortestOnly, _FindAll).GetPaths();
                }
                #endregion
                #region already visited from right side
                else if (_VisitedNodesRight.ContainsKey(nextLeft))
                {
                    if (VisitedByRightSide(nextLeft, ref myCurrentNodeLeft))
                        return new TargetAnalyzer(_Root, _Target, _ShortestPathLength, _ShortestOnly, _FindAll).GetPaths();
                }
                #endregion already visited from right side
                #region already visited
                else if (_VisitedNodesLeft.ContainsKey(nextLeft))
                {
                    UpdateVisitedLeft(nextLeft, ref myCurrentNodeLeft);
                }
                #endregion already visited
                #region set as visited
                else
                {
                    SetAsVisitedLeft(nextLeft, ref myCurrentNodeLeft, ref nextLeftNode, nextLeftVertex);
                }
                #endregion set as visited
            }
            #endregion check left friends

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


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