コード例 #1
0
        /// <summary>
        /// Extract the values corresponding to the range
        /// </summary>
        /// <param name="myIndex">The interesting index</param>
        /// <param name="myConstant">The inderesting range</param>
        /// <returns>An enumerable of vertexIDs</returns>
        private IEnumerable <long> GetValues(ISonesIndex myIndex, RangeLiteralExpression myConstant)
        {
            if (myIndex is ISonesRangeIndex)
            {
                //use the range funtionality
                foreach (var aVertexID in ((ISonesRangeIndex)myIndex)
                         .Between(myConstant.Lower, myConstant.Upper, myConstant.IncludeBorders, myConstant.IncludeBorders))
                {
                    yield return(aVertexID);
                }
            }
            else
            {
                //stupid, but works

                if (myConstant.IncludeBorders)
                {
                    foreach (var aVertexIDSet in myIndex.Keys()
                             .Where(key =>
                                    (key.CompareTo(myConstant.Lower) >= 0) &&
                                    (key.CompareTo(myConstant.Upper) <= 0))
                             .Select(key => myIndex[key]))
                    {
                        foreach (var aVertexID in aVertexIDSet)
                        {
                            yield return(aVertexID);
                        }
                    }
                }
                else
                {
                    foreach (var aVertexIDSet in myIndex.Keys()
                             .Where(key =>
                                    (key.CompareTo(myConstant.Lower) > 0) &&
                                    (key.CompareTo(myConstant.Upper) < 0))
                             .Select(key => myIndex[key]))
                    {
                        foreach (var aVertexID in aVertexIDSet)
                        {
                            yield return(aVertexID);
                        }
                    }
                }
            }

            yield break;
        }
コード例 #2
0
 /// <summary>
 /// Creates a new queryplan that processes a in range operation using indices
 /// </summary>
 /// <param name="mySecurityToken">The current security token</param>
 /// <param name="myTransactionToken">The current transaction token</param>
 /// <param name="myProperty">The interesting property</param>
 /// <param name="myConstant">The constant value</param>
 /// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
 /// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
 /// <param name="myExpressionIndex">The index name which is used for resolving the expression</param>
 public QueryPlanInRangeWithIndex(SecurityToken mySecurityToken,
                                  Int64 myTransactionToken,
                                  QueryPlanProperty myProperty,
                                  RangeLiteralExpression myConstant,
                                  IVertexStore myVertexStore,
                                  Boolean myIsLongrunning,
                                  IIndexManager myIndexManager,
                                  String myExpressionIndex = null)
 {
     _securityToken    = mySecurityToken;
     _transactionToken = myTransactionToken;
     _property         = myProperty;
     _constant         = myConstant;
     _vertexStore      = myVertexStore;
     _isLongrunning    = myIsLongrunning;
     _expressionIndex  = myExpressionIndex;
 }
コード例 #3
0
 /// <summary>
 /// Creates a new queryplan that processes a in range operation using indices
 /// </summary>
 /// <param name="mySecurityToken">The current security token</param>
 /// <param name="myTransactionToken">The current transaction token</param>
 /// <param name="myProperty">The interesting property</param>
 /// <param name="myConstant">The constant value</param>
 /// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
 /// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
 /// <param name="myExpressionIndex">The index name which is used for resolving the expression</param>
 public QueryPlanInRangeWithIndex(SecurityToken mySecurityToken, 
                                     Int64 myTransactionToken, 
                                     QueryPlanProperty myProperty, 
                                     RangeLiteralExpression myConstant, 
                                     IVertexStore myVertexStore, 
                                     Boolean myIsLongrunning, 
                                     IIndexManager myIndexManager,
                                     String myExpressionIndex = null)
 {
     _securityToken = mySecurityToken;
     _transactionToken = myTransactionToken;
     _property = myProperty;
     _constant = myConstant;
     _vertexStore = myVertexStore;
     _isLongrunning = myIsLongrunning;
     _expressionIndex = myExpressionIndex;
 }
コード例 #4
0
        /// <summary>
        /// Extract the values corresponding to the range
        /// </summary>
        /// <param name="myIndex">The interesting index</param>
        /// <param name="myConstant">The inderesting range</param>
        /// <returns>An enumerable of vertexIDs</returns>
        private IEnumerable<long> GetValues(ISonesIndex myIndex, RangeLiteralExpression myConstant)
        {
            if (myIndex is ISonesRangeIndex)
            {
                //use the range funtionality
                foreach (var aVertexID in ((ISonesRangeIndex)myIndex)
                    .Between(myConstant.Lower, myConstant.Upper, myConstant.IncludeBorders, myConstant.IncludeBorders))
                {
                    yield return aVertexID;
                }
            }
            else
            {
                //stupid, but works

                if (myConstant.IncludeBorders)
                {
                    foreach (var aVertexIDSet in myIndex.Keys()
                        .Where(key =>
                            (key.CompareTo(myConstant.Lower) >= 0) &&
                            (key.CompareTo(myConstant.Upper) <= 0))
                                .Select(key => myIndex[key]))
                    {
                        foreach (var aVertexID in aVertexIDSet)
                        {
                            yield return aVertexID;
                        }
                    }
                }
                else
                {
                    foreach (var aVertexIDSet in myIndex.Keys()
                        .Where(key =>
                            (key.CompareTo(myConstant.Lower) > 0) &&
                            (key.CompareTo(myConstant.Upper) < 0))
                                .Select(key => myIndex[key]))
                    {
                        foreach (var aVertexID in aVertexIDSet)
                        {
                            yield return aVertexID;
                        }
                    }
                }
            }

            yield break;
        }
コード例 #5
0
 /// <summary>
 /// Creates a new queryplan that processes a in range operation without any index
 /// </summary>
 /// <param name="mySecurityToken">The current security token</param>
 /// <param name="myTransactionToken">The current transaction token</param>
 /// <param name="myProperty">The interesting property</param>
 /// <param name="myConstant">The constant value</param>
 /// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
 /// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
 public QueryPlanInRangeWithoutIndex(SecurityToken mySecurityToken, TransactionToken myTransactionToken, QueryPlanProperty myProperty, RangeLiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning)
     : base(myProperty, null, myIsLongrunning, mySecurityToken, myTransactionToken, myVertexStore)
 {
     _constantRange = myConstant;
 }
コード例 #6
0
 /// <summary>
 /// Creates a new queryplan that processes a in range operation without any index
 /// </summary>
 /// <param name="mySecurityToken">The current security token</param>
 /// <param name="myTransactionToken">The current transaction token</param>
 /// <param name="myProperty">The interesting property</param>
 /// <param name="myConstant">The constant value</param>
 /// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
 /// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
 public QueryPlanInRangeWithoutIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, RangeLiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning)
     : base(myProperty, null, myIsLongrunning, mySecurityToken, myTransactionToken, myVertexStore)
 {
     _constantRange = myConstant;
 }
コード例 #7
0
 internal ServiceRangeLiteralExpression(RangeLiteralExpression myExpression)
 {
     this.IncludeBorders = myExpression.IncludeBorders;
     this.Lower          = myExpression.Lower;
     this.Upper          = myExpression.Upper;
 }
コード例 #8
0
        /// <summary>
        /// Extract the values corresponding to the range
        /// </summary>
        /// <param name="myIndex">The interesting index</param>
        /// <param name="myConstant">The inderesting range</param>
        /// <returns>An enumerable of vertexIDs</returns>
        private IEnumerable<Int64> GetValues(IIndex<IComparable, long> myIndex, RangeLiteralExpression myConstant)
        {
            if (myIndex is ISingleValueIndex<IComparable, Int64>)
            {
                foreach (var aVertexID in GetSingleIndexValues((ISingleValueIndex<IComparable, Int64>)myIndex, myConstant))
                {
                    yield return aVertexID;
                }
            }
            else
            {
                if (myIndex is IMultipleValueIndex<IComparable, Int64>)
                {
                    foreach (var aVertexID in GetMultipleIndexValues((IMultipleValueIndex<IComparable, Int64>)myIndex, myConstant))
                    {
                        yield return aVertexID;
                    }
                }
                else
                {
                    //there might be a little more interfaces... sth versioned
                }
            }

            yield break;
        }
コード例 #9
0
        /// <summary>
        /// Extract values from a single value index
        /// </summary>
        /// <param name="mySingleValueIndex">The interesting index</param>
        /// <param name="myConstant">The interesting range</param>
        /// <returns>An enumerable of vertexIDs</returns>
        private IEnumerable<long> GetSingleIndexValues(ISingleValueIndex<IComparable, long> mySingleValueIndex, RangeLiteralExpression myConstant)
        {
            if (mySingleValueIndex is IRangeIndex<IComparable, long>)
            {
                //use the range funtionality

                foreach (var aVertexID in ((ISingleValueRangeIndex<IComparable, long>)mySingleValueIndex)
                    .InRange(myConstant.Lower, myConstant.Upper, myConstant.IncludeBorders, myConstant.IncludeBorders))
                {
                    yield return aVertexID;
                }
            }
            else
            {
                //stupid, but works

                if (myConstant.IncludeBorders)
                {
                    foreach (var aVertexID in mySingleValueIndex
                        .Where(kv =>
                            (kv.Key.CompareTo(myConstant.Lower) >= 0) &&
                            (kv.Key.CompareTo(myConstant.Upper) <= 0))
                                .Select(kv => kv.Value))
                    {
                        yield return aVertexID;
                    }
                }
                else
                {
                    foreach (var aVertexID in mySingleValueIndex
                        .Where(kv =>
                            (kv.Key.CompareTo(myConstant.Lower) > 0) &&
                            (kv.Key.CompareTo(myConstant.Upper) < 0))
                                .Select(kv => kv.Value))
                    {
                        yield return aVertexID;
                    }
                }
            }

            yield break;
        }