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


C# IVertex.HasOutgoingEdge方法代码示例

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


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

示例1: HasValue

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

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

示例2: CreateVertexUpdateDefinition


//.........这里部分代码省略.........
                {
                    foreach (var edge in myUpdate.UpdateOutgoingEdges)
                    {

                        var edgeDef = myVertexType.GetOutgoingEdgeDefinition(edge.EdgeName);
                        switch (edgeDef.Multiplicity)
                        {
                            case EdgeMultiplicity.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));
                                    }
                                }
                                break;
                            case EdgeMultiplicity.MultiEdge:
                                {
                                    List<SingleEdgeDeleteDefinition> internSingleDelete = null;
                                    if (myVertex.HasOutgoingEdge(edgeDef.ID))
                                    {
                                        internSingleDelete = new List<SingleEdgeDeleteDefinition>();
                                        foreach (var edgeInstance in myVertex.GetOutgoingHyperEdge(edgeDef.ID).GetTargetVertices())
                                        {
                                            internSingleDelete.Add(new SingleEdgeDeleteDefinition(source, new VertexInformation(edgeInstance.VertexTypeID, edgeInstance.VertexID)));
                                        }
                                    }

                                    List<SingleEdgeUpdateDefinition> internSingleUpdate = null;
                                    var targets = GetResultingVertexIDs(myTransaction, mySecurity, edge, edgeDef.TargetVertexType);

                                    if (targets != null)
                                    {
                                        foreach (var target in targets)
                                        {
                                            internSingleUpdate = internSingleUpdate ?? new List<SingleEdgeUpdateDefinition>();
                                            internSingleUpdate.Add(new SingleEdgeUpdateDefinition(source, target, edgeDef.InnerEdgeType.ID));
                                        }
                                    }
                                    if (edge.ContainedEdges != null)
                                    {
                                        foreach (var innerEdge in edge.ContainedEdges)
                                        {
                                            targets = GetResultingVertexIDs(myTransaction, mySecurity, innerEdge, edgeDef.TargetVertexType);
                                            if (targets != null && targets.CountIsGreater(0))
                                            {
                                                ConvertUnknownProperties(innerEdge, edgeDef.InnerEdgeType);
                                                var structured = CreateStructuredUpdate(innerEdge.StructuredProperties, edgeDef.InnerEdgeType);
                                                var unstructured = CreateUnstructuredUpdate(innerEdge.UnstructuredProperties);

                                                foreach (var target in targets)
                                                {
开发者ID:loubo,项目名称:sones,代码行数:67,代码来源:ExecuteVertexHandler.cs

示例3: CreateIndexDefinition

        public static IIndexDefinition CreateIndexDefinition(IVertex myIndexVertex, IVertexType myDefiningVertexType = null)
        {
            var id = GetUUID(myIndexVertex);
            var props = GetIndexedProperties(myIndexVertex);
            var typeName = GetIndexTypeName(myIndexVertex);
            var edition = myIndexVertex.EditionName;
            var isUserDefined = GetIndexDotIsUserDefined(myIndexVertex);
            var name = GetIndexDotName(myIndexVertex);
            var single = myIndexVertex.GetProperty<bool>((long)AttributeDefinitions.IndexDotIsSingleValue);
            var range = myIndexVertex.GetProperty<bool>((long)AttributeDefinitions.IndexDotIsRange);
            var version = myIndexVertex.GetProperty<bool>((long)AttributeDefinitions.IndexDotIsVersioned);
            var sourceIndex = (myIndexVertex.HasOutgoingEdge((long)AttributeDefinitions.IndexDotSourceIndex))
                ? CreateIndexDefinition(myIndexVertex.GetOutgoingSingleEdge((long)AttributeDefinitions.IndexDotSourceIndex).GetTargetVertex())
                : null;

            myDefiningVertexType = myDefiningVertexType ?? GetDefiningVertexType(myIndexVertex);

            return new IndexDefinition
            {
                ID = id,
                IndexedProperties = props,
                Edition = edition,
                IndexTypeName = typeName,
                IsUserdefined = isUserDefined,
                Name = name,
                VertexType = myDefiningVertexType,
                IsSingle = single,
                IsRange = range,
                IsVersioned = version,
                SourceIndex = sourceIndex,
            };
        }
开发者ID:loubo,项目名称:sones,代码行数:32,代码来源:BaseGraphStorageManager.cs

示例4: Find

        /// <summary>
        /// Searches shortest, all shortest or all paths starting from "myStart" to "myEnd".
        /// </summary>
        /// <param name="myTypeAttribute">The Attribute representing the edge to follow (p.e. "Friends")</param>
        /// <param name="myTypeManager">The TypeManager for the Node type</param>
        /// <param name="myDBObjectCache">The Object Cache for faster object lookup</param>
        /// <param name="myStart">The start node</param>
        /// <param name="myEnd">The end node</param>
        /// <param name="shortestOnly">true, if only shortest path shall be found</param>
        /// <param name="findAll">if true and shortestOnly is true, all shortest paths will be found. if true, and shortest only is false, all paths will be searched</param>
        /// <param name="myMaxDepth">The maximum depth to search</param>
        /// <param name="myMaxPathLength">The maximum path length which shall be analyzed</param>
        /// <returns>A HashSet which contains all found paths. Every path is represented by a List of ObjectUUIDs</returns>
        public HashSet<List<Tuple<long, long>>> Find(IAttributeDefinition myTypeAttribute, 
            IVertexType myVertexType,
            IVertex myStart,
            IVertex myEnd,
            bool shortestOnly,
            bool findAll,
            UInt64 myMaxDepth,
            UInt64 myMaxPathLength)
        {
            #region data

            //queue for BFS
            Queue<IVertex> queue = new Queue<IVertex>();

            //Dictionary to store visited TreeNodes
            Dictionary<Tuple<long, long>, Node> visitedNodes = new Dictionary<Tuple<long, long>, Node>();

            HashSet<Tuple<long, long>> visitedVertices = new HashSet<Tuple<long, long>>();

            //current depth
            UInt64 depth = 1;

            //first node in path tree, the start of the select
            Node root = new Node(myStart.VertexTypeID, myStart.VertexID);

            //target node, the target of the select
            Node target = new Node(myEnd.VertexTypeID, myEnd.VertexID);

            //dummy node to check in which level the BFS is
            IVertex dummy = null;

            //if the maxDepth is greater then maxPathLength, then set maxDepth to maxPathLength
            if (myMaxDepth > myMaxPathLength)
                myMaxDepth = myMaxPathLength;
            else if (myMaxPathLength > myMaxDepth)
                myMaxPathLength = myMaxDepth;

            //enqueue first node to start the BFS
            queue.Enqueue(myStart);
            queue.Enqueue(dummy);

            //add root to visitedNodes
            visitedNodes.Add(root.Key, root);

            //search the type on which the attribute is defined
            IVertexType currentType = myVertexType;
            List<IVertexType> tempList = new List<IVertexType>();
            tempList.Add(currentType);

            bool foundDefinedType = false;

            while (currentType.HasParentType && !foundDefinedType)
            {
                if (currentType.ParentVertexType.HasAttribute(myTypeAttribute.Name))
                {
                    foundDefinedType = true;
                }

                currentType = currentType.ParentVertexType;
                tempList.Add(currentType);
            }

            if (foundDefinedType)
                _Types = tempList;
            else
                _Types.Add(myVertexType);

            #endregion

            #region BFS

            //check that the start node has the outgoing edge and the target has incoming vertices
            if (!myStart.HasOutgoingEdge(myTypeAttribute.ID) && !HasIncomingVertices(myEnd, myTypeAttribute.ID))
            {
                return null;
            }

            //if there is more than one object in the queue and the actual depth is less than MaxDepth
            while ((queue.Count > 0) && (depth < myMaxDepth))
            {
                //get the first Object of the queue
                IVertex currentVertex = queue.Dequeue();

                //dummy
                if (currentVertex == null || visitedVertices.Contains(new Tuple<long, long>(currentVertex.VertexTypeID, currentVertex.VertexID)))
                {
                    continue;
//.........这里部分代码省略.........
开发者ID:anukat2015,项目名称:sones,代码行数:101,代码来源:BFS.cs

示例5: Find

        /// <summary>
        /// Please look at the class documentation for detailed description how this algorithm works.
        /// </summary>
        /// <param name="myTypeAttribute">The Attribute representing the edge to follow (p.e. "Friends")</param>
        /// <param name="myStart">The start node</param>
        /// <param name="myEnd">The end node</param>
        /// <param name="shortestOnly">true, if only shortest path shall be found</param>
        /// <param name="findAll">if true and shortestOnly is true, all shortest paths will be found. if true, and shortest only is false, all paths will be searched</param>
        /// <param name="myMaxDepth">The maximum depth to search</param>
        /// <param name="myMaxPathLength">The maximum path length which shall be analyzed</param>
        /// <returns>A HashSet which contains all found paths. Every path is represented by a List of ObjectUUIDs</returns>m>
        public HashSet<List<long>> Find(IAttributeDefinition myTypeAttribute, IVertex myStart, IVertex myEnd, bool shortestOnly, bool findAll, byte myMaxDepth, byte myMaxPathLength)
        {
            #region declarations

            //queue for BFS
            var queueLeft = new Queue<IVertex>();
            var queueRight = new Queue<IVertex>();

            //Dictionary to store visited TreeNodes
            var visitedNodesLeft = new Dictionary<long, Node>();
            var visitedNodesRight = new Dictionary<long, Node>();

            var visitedVerticesLeft = new HashSet<long>();
            var visitedVerticesRight = new HashSet<long>();

            //set current depth left
            byte depthLeft = 2;
            //set current depth right
            byte depthRight = 1;

            //maximum depth
            byte maxDepthLeft = 0;
            byte maxDepthRight = 0;

            #region initialize maxDepths
            //if the maxDepth is greater then maxPathLength, then set maxDepth to maxPathLength
            if (myMaxDepth > myMaxPathLength)
            {
                myMaxDepth = myMaxPathLength;
            }

            //set depth for left side
            maxDepthLeft = Convert.ToByte(myMaxDepth / 2 + 1);

            //if myMaxDepth is 1 maxDepthRight keeps 0, just one side is searching
            if (myMaxDepth > 1)
            {
                //both sides have the same depth
                maxDepthRight = maxDepthLeft;
            }

            //if myMaxDepth is even, one side has to search in a greater depth
            if ((myMaxDepth % 2) == 0)
            {
                maxDepthRight = Convert.ToByte(maxDepthLeft - 1);
            }

            #endregion

            //shortest path length
            byte shortestPathLength = 0;

            //target node, the target of the select
            var target = new Node(myEnd.VertexID);
            var root = new Node(myStart.VertexID);
            HashSet<long> rootFriends = new HashSet<long>();

            //dummy node to check in which level the BFS is
            IVertex dummyLeft = null;
            IVertex dummyRight = null;

            #endregion

            #region BidirectionalBFS
            //check if the EdgeType is ASetReferenceEdgeType

            #region initialize variables

            //enqueue start node to start from left side
            queueLeft.Enqueue(myStart);
            //enqueue dummyLeft to analyze the depth of the left side
            queueLeft.Enqueue(dummyLeft);

            //enqueue target node to start from right side
            queueRight.Enqueue(myEnd);
            //enqueue dummyRight to analyze the depth of the right side
            queueRight.Enqueue(dummyRight);

            visitedNodesLeft.Add(root.Key, root);
            //add root and target to visitedNodes
            visitedNodesRight.Add(target.Key, target);

            #endregion

            #region check if start has outgoing and target has incoming edge

            if (!myStart.HasOutgoingEdge(myTypeAttribute.ID))
            {
                return null;
//.........这里部分代码省略.........
开发者ID:loubo,项目名称:sones,代码行数:101,代码来源:BidirectionalBFS.cs

示例6: 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

示例7: GetAllSelectedAttributesFromVertex


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

                            myUsingGraph = _ExpressionGraph.IsGraphRelevant(new LevelKey((levelKey + key).Edges, _graphdb, mySecurityToken, myTransactionToken), myDBObject);
                        }

                        if (myUsingGraph && !(selectionElementFunction.Element.Kind != AttributeType.Property))
                        {
                            switch (selectionElementFunction.Element.Kind)
                            {
                                case AttributeType.IncomingEdge:
                                    #region incoming edge

                                    var incomingEdgeDefinition = (IIncomingEdgeDefinition)selectionElementFunction.Element;

                                    if (myDBObject.HasIncomingVertices(incomingEdgeDefinition.RelatedEdgeDefinition.RelatedType.ID, incomingEdgeDefinition.RelatedEdgeDefinition.ID))
                                    {
                                        callingObject = _ExpressionGraph.Select(
                                            new LevelKey(
                                                (myLevelKey + new EdgeKey(selectionElementFunction.Element.RelatedType.ID, selectionElementFunction.Element.ID)).Edges,
                                                _graphdb, mySecurityToken, myTransactionToken), myDBObject, true);
                                    }
                                    else
                                    {
                                        callingObject = null;
                                    }

                                    #endregion
                                    break;

                                case AttributeType.OutgoingEdge:
                                    #region outgoing edge

                                    if (myDBObject.HasOutgoingEdge(selectionElementFunction.Element.ID))
                                    {

                                        callingObject = _ExpressionGraph.Select(
                                            new LevelKey(
                                                (myLevelKey + new EdgeKey(selectionElementFunction.Element.RelatedType.ID, selectionElementFunction.Element.ID)).Edges,
                                                _graphdb, mySecurityToken, myTransactionToken), myDBObject, true);

                                    }
                                    else
                                    {
                                        callingObject = null;
                                    }

                                    #endregion

                                    break;

                                case AttributeType.Property:

                                    callingObject = GetCallingObject(myDBObject, selectionElementFunction.Element);
                                    break;

                                case AttributeType.BinaryProperty:
                                default:
                                    continue;
                            }
                        }
                        else
                        {
                            callingObject = GetCallingObject(myDBObject, selectionElementFunction.Element);
                        }
开发者ID:cosh,项目名称:sones,代码行数:66,代码来源:SelectResultManager.cs

示例8: 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

示例9: 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

示例10: 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

示例11: Find


//.........这里部分代码省略.........
            //dummy node to check in which level the BFS is
            _DummyLeft = null;
            _DummyRight = null;

            _FindAll = findAll;
            _ShortestOnly = shortestOnly;

            #endregion

            #region BidirectionalBFS
            //check if the EdgeType is ASetReferenceEdgeType

            #region initialize variables

            //enqueue start node to start from left side
            _QueueLeft.Enqueue(myStart);
            //enqueue _DummyLeft to analyze the depth of the left side
            _QueueLeft.Enqueue(_DummyLeft);

            //enqueue _Target node to start from right side
            _QueueRight.Enqueue(myEnd);
            //enqueue _DummyRight to analyze the depth of the right side
            _QueueRight.Enqueue(_DummyRight);

            //add _Root and _Target to visitedNodes
            _VisitedNodesLeft.Add(_Root.Key, _Root);
            _VisitedNodesRight.Add(_Target.Key, _Target);

            #endregion

            #region check if start has outgoing and _Target has incoming edge

            //check that the start node has the outgoing edge and the target has incoming vertices
            if (!myStart.HasOutgoingEdge(_AttributeDefinition.ID) && !HasIncomingVertices(myEnd))
            {
                return null;
            }

            #endregion

            //if there is more than one object in the queue and the actual depth is less than MaxDepth
            while (((_QueueLeft.Count > 0) && (_QueueRight.Count > 0)) &&
                   ((_DepthLeft <= _MaxDepthLeft) || (_DepthRight <= _MaxDepthRight)))
            {
                #region both queues contain objects and both depths are not reached
                if (((_QueueLeft.Count > 0) && (_QueueRight.Count > 0)) &&
                    ((_DepthLeft <= _MaxDepthLeft) && (_DepthRight <= _MaxDepthRight)))
                {
                    #region check if a level is completely searched

                    if (LeftLevelCompleted())
                        continue;

                    if (RightLevelCompleted())
                        continue;

                    #endregion check if there is a dummyNode at the beginning of a queue

                    #region get first nodes of the queues

                    //hold the actual element of the queues
                    Node currentNodeLeft;
                    Node currentNodeRight;

                    IVertex currentVertexLeft;
                    IVertex currentVertexRight;
开发者ID:anukat2015,项目名称:sones,代码行数:67,代码来源:BidirectionalBFS.cs

示例12: Find


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

            HashSet<long> visitedVertices = new HashSet<long>();

            //current depth
            byte depth = 0;

            //first node in path tree, the start of the select
            Node root = new Node(myStart.VertexID);

            //target node, the target of the select
            Node target = new Node(myEnd.VertexID);

            //dummy node to check in which level the BFS is
            IVertex dummy = null;

            //if the maxDepth is greater then maxPathLength, then set maxDepth to maxPathLength
            if (myMaxDepth > myMaxPathLength)
            {
                myMaxDepth = myMaxPathLength;
            }

            //enqueue first node to start the BFS
            queue.Enqueue(myStart);
            queue.Enqueue(dummy);

            //add root to visitedNodes
            visitedNodes.Add(root.Key, root);

            #endregion

            #region BFS

            //check if root node has edge and target has backwardedge
            if (!myStart.HasOutgoingEdge(myTypeAttribute.ID))
            {
                return null;
            }

            if (!myEnd.HasIncomingVertices(myEnd.VertexTypeID, myTypeAttribute.ID))
            {
                return null;
            }

            //if there is more than one object in the queue and the actual depth is less than MaxDepth
            while ((queue.Count > 0) && (depth <= myMaxDepth))
            {
                //get the first Object of the queue
                IVertex currentVertex = queue.Dequeue();

                //dummy
                if (currentVertex == null || visitedVertices.Contains(currentVertex.VertexID))
                {
                    continue;
                }

                visitedVertices.Add(currentVertex.VertexID);

                Node currentNode;

                if (visitedNodes.ContainsKey(currentVertex.VertexID))
                {
                    currentNode = visitedNodes[currentVertex.VertexID];
                }
                else
                {
                    currentNode = new Node(currentVertex.VertexID);
开发者ID:loubo,项目名称:sones,代码行数:67,代码来源:BFS.cs


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