Пример #1
0
        public override Exceptional<IObject> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext dbContext)
        {
            if (attributeIndex is UUIDIndex)
            {
                return new Exceptional<IObject>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), "Aggregating attribute UUID is not implemented!"));
            }
            else
            {
                var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(attributeIndex.IndexRelatedTypeUUID);

                // HACK: rewrite as soon as we have real attribute index keys
                if (attributeIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs.Count != 1)
                {
                    return new Exceptional<IObject>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                }

                var typeAttr = graphDBType.GetTypeAttributeByUUID(attributeIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs.First());
                ADBBaseObject oneVal = typeAttr.GetADBBaseObjectType(dbContext.DBTypeManager);

                return new Exceptional<IObject>(attributeIndex.GetKeyValues(indexRelatedType, dbContext).AsParallel().Select(kv =>
                {
                    var mul = oneVal.Clone(kv.Key);
                    mul.Mul(oneVal.Clone(kv.Value.Count()));
                    return mul;

                }).Aggregate(oneVal.Clone(), (elem, result) => { result.Add(elem); return result; }));
            }
        }
Пример #2
0
        public override Exceptional<IObject> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext dbContext)
        {
            //if (graphDBType.IsAbstract)
            //{
            //    #region For abstract types, count all attribute idx of the subtypes

            //    UInt64 count = 0;

            //    foreach (var aSubType in dbContext.DBTypeManager.GetAllSubtypes(graphDBType, false))
            //    {
            //        if (!aSubType.IsAbstract)
            //        {
            //            count += aSubType.GetUUIDIndex(dbContext.DBTypeManager).GetValueCount();
            //        }
            //    }

            //    return new Exceptional<IObject>(new DBUInt64(count));

            //    #endregion
            //}
            //else
            //{
                #region Return the count of idx values

                var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(attributeIndex.IndexRelatedTypeUUID);

                return new Exceptional<IObject>(new DBUInt64(attributeIndex.GetValueCount()));

                #endregion
            //}
        }
Пример #3
0
        public override IEnumerable<ObjectUUID> IndexSingleOperation(AAttributeIndex myIndex, ADBBaseObject myOperationValue, AttributeUUID myAttributeUUID, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
        {
            IndexKey lookup = new IndexKey(myAttributeUUID, myOperationValue, myIndex.IndexKeyDefinition);
            var currentType = dbContext.DBTypeManager.GetTypeByUUID(myIndex.IndexRelatedTypeUUID);

            var result = myIndex.Contains(lookup, currentType, dbContext);
            if (result.Value)
            {
                var interestingUUIDs = myIndex.GetValues(lookup, currentType, dbContext);

                foreach (var aIndexValue in myIndex.GetAllValues(currentType, dbContext))
                {
                    foreach (var aUUID in aIndexValue)
                    {
                        if (!interestingUUIDs.Contains(aUUID))
                        {
                            yield return aUUID;
                        }
                    }
                }
            }
            else
            {
                foreach (var aIndexValue in myIndex.GetKeyValues(currentType, dbContext).Select(kv => kv.Value))
                {
                    foreach (var aUUID in aIndexValue)
                    {
                        yield return aUUID;
                    }
                }
            }

            yield break;
        }
Пример #4
0
        public override IEnumerable<ObjectUUID> IndexOperation(AAttributeIndex myIndex, TupleDefinition myTuple, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
        {
            if (myTuple.Count() != 2)
            {
                throw new GraphDBException(new Error_InvalidInRangeInterval(2, myTuple.Count()));
            }

            var currentType = dbContext.DBTypeManager.GetTypeByUUID(myIndex.IndexRelatedTypeUUID);

            #region As soon as the index supports ranges use them!!

            //limits
            var fromKey = new IndexKey(myIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs[0], (myTuple.ElementAt(0).Value as ValueDefinition).Value, myIndex.IndexKeyDefinition);
            var toKey = new IndexKey(myIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs[0], (myTuple.ElementAt(1).Value as ValueDefinition).Value, myIndex.IndexKeyDefinition);

            switch (myTuple.KindOfTuple)
            {
                case KindOfTuple.Inclusive:
                    return myIndex.InRange(fromKey, toKey, true, true, currentType, dbContext);
                case KindOfTuple.LeftExclusive:
                    return myIndex.InRange(fromKey, toKey, false, true, currentType, dbContext);
                case KindOfTuple.RightExclusive:
                    return myIndex.InRange(fromKey, toKey, true, false, currentType, dbContext);
                case KindOfTuple.Exclusive:
                    return myIndex.InRange(fromKey, toKey, false, false, currentType, dbContext);
                default:
                    throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
            }

            #endregion
        }
Пример #5
0
        public override IEnumerable<ObjectUUID> IndexSingleOperation(AAttributeIndex myIndex, ADBBaseObject myOperationValue, AttributeUUID myAttributeUUID, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
        {
            var myIndeyKey = new IndexKey(myAttributeUUID, myOperationValue, myIndex.IndexKeyDefinition);
            var currentType = dbContext.DBTypeManager.GetTypeByUUID(myIndex.IndexRelatedTypeUUID);

            if (myIndex.Contains(myIndeyKey, currentType, dbContext))
            {
                foreach (var aUUID in myIndex.GetValues(myIndeyKey, currentType, dbContext))
                {
                    yield return aUUID;
                }
            }

            yield break;
        }
Пример #6
0
        /// <summary>
        /// Count the index elements
        /// <seealso cref=" ABaseAggregate"/>
        /// </summary>
        public override Exceptional<FuncParameter> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext dbContext)
        {
            //if (graphDBType.IsAbstract)
            //{
            //    #region For abstract types, count all attribute idx of the subtypes

            //    UInt64 count = 0;

            //    foreach (var aSubType in dbContext.DBTypeManager.GetAllSubtypes(graphDBType, false))
            //    {
            //        if (!aSubType.IsAbstract)
            //        {
            //            count += aSubType.GetUUIDIndex(dbContext.DBTypeManager).GetValueCount();
            //        }
            //    }

            //    return new Exceptional<IObject>(new DBUInt64(count));

            //    #endregion
            //}
            //else
            //{
            #region Return the count of idx values

            var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(attributeIndex.IndexRelatedTypeUUID);
            var count = attributeIndex.GetValueCount(dbContext, indexRelatedType);

            foreach (var type in dbContext.DBTypeManager.GetAllSubtypes(indexRelatedType, false))
            {
                var idx = type.GetAttributeIndex(dbContext, attributeIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs, attributeIndex.IndexEdition);
                if (idx.Success())
                {
                    count += idx.Value.GetValueCount(dbContext, type);
                }
            }

            return new Exceptional<FuncParameter>(new FuncParameter(new DBUInt64(count)));

            #endregion
            //}
        }
Пример #7
0
        public virtual IEnumerable<ObjectUUID> IndexSingleOperation(AAttributeIndex myIndex, ADBBaseObject myOperationValue, AttributeUUID myAttributeUUID, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
        {
            foreach (var keyValPair in myIndex.GetKeyValues(dbContext.DBTypeManager.GetTypeByUUID(myIndex.IndexRelatedTypeUUID), dbContext))
            {
                var res = Compare(keyValPair.Key.IndexKeyValues[0], myOperationValue);

                if (res.Failed())
                {
                    throw new GraphDBException(res.PushIError(new Error_InvalidIndexOperation(myIndex.IndexName, keyValPair.Key.IndexKeyValues[0].Value, myOperationValue.Value)).IErrors);
                }

                if (res.Value)
                {
                    foreach (var aUUID in keyValPair.Value)
                    {
                        yield return aUUID;
                    }
                }
            }

            yield break;
        }
Пример #8
0
        public override Exceptional<FuncParameter> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext dbContext)
        {
            if (attributeIndex.IsUUIDIndex)
            {
                return new Exceptional<FuncParameter>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), "AVG(UUID) is not implemented!"));
            }

            var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(attributeIndex.IndexRelatedTypeUUID);

            // HACK: rewrite as soon as we have real attribute index keys
            ADBBaseObject aADBBaseObject = new DBDouble(DBObjectInitializeType.Default);
            DBUInt64 total = new DBUInt64((UInt64)0);

            foreach (var idxEntry in attributeIndex.GetKeyValues(indexRelatedType, dbContext))
            {
                aADBBaseObject.Add(aADBBaseObject.Clone(idxEntry.Key));

                total += (UInt64)idxEntry.Value.LongCount();
            }
            aADBBaseObject.Div(total);

            return new Exceptional<FuncParameter>(new FuncParameter(aADBBaseObject));
        }
Пример #9
0
 public virtual IEnumerable<ObjectUUID> IndexOperationReloaded(AAttributeIndex myIndex, List<Tuple<AttributeUUID, ADBBaseObject>> myOperationValues, TypesOfBinaryExpression typeOfBinExpr)
 {
     throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
 }
Пример #10
0
 public virtual IEnumerable<ObjectUUID> IndexOperation(AAttributeIndex myIndex, TupleDefinition myOperationValues, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
 {
     throw new GraphDBException(new Error_InvalidIndexOperation(myIndex.IndexName));
 }
Пример #11
0
 private IEnumerable<ObjectUUID> IndexSingleOperation(AAttributeIndex myIndex, AOperationDefinition myOperationValue, AttributeUUID myAttributeUUID, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
 {
     if (myOperationValue is ValueDefinition)
     {
         return IndexSingleOperation(myIndex, ((ValueDefinition)myOperationValue).Value, myAttributeUUID, typeOfBinExpr, dbContext);
     }
     else
     {
         if (myOperationValue is TupleDefinition)
         {
             return IndexOperation(myIndex, (myOperationValue as TupleDefinition), typeOfBinExpr, dbContext);
         }
         else
         {
             throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), "Currently, it is not implemented to execute an IndexOperation on anything else but AtomValue or TupleValue."));
         }
     }
 }
Пример #12
0
        public override IEnumerable<ObjectUUID> IndexOperation(AAttributeIndex myIndex, TupleDefinition myTuple, TypesOfBinaryExpression typeOfBinExpr, DBContext dbContext)
        {
            HashSet<ObjectUUID> interestingUUIDs = new HashSet<ObjectUUID>();
            IndexKey idxLookupKey = null;
            var currentType = dbContext.DBTypeManager.GetTypeByUUID(myIndex.IndexRelatedTypeUUID);

            var myOperationValues = myTuple;

            switch (typeOfBinExpr)
            {
                case TypesOfBinaryExpression.LeftComplex:

                    if (!myIndex.IsListOfBaseObjectsIndex)
                    {
                        foreach (var aItem in myOperationValues)
                        {
                            idxLookupKey = new IndexKey(myIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs[0], (aItem.Value as ValueDefinition).Value, myIndex.IndexKeyDefinition);
                            interestingUUIDs.UnionWith(myIndex.GetValues(idxLookupKey, currentType, dbContext));
                        }
                    }
                    else
                    {
                        #region In case the index is from a set or list of baseobjects we use this way to get the values

                        foreach (var aItem in myOperationValues)
                        {
                            idxLookupKey = new IndexKey(myIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs[0], (aItem.Value as ValueDefinition).Value, myIndex.IndexKeyDefinition);
                            interestingUUIDs.UnionWith(myIndex.GetValues(idxLookupKey, currentType, dbContext));
                        }

                        /* What the hack is that??? - This is too slow for any usual usage of in operator! */

                        var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(myIndex.IndexRelatedTypeUUID);

                        foreach (var aKey in myIndex.GetKeys(currentType, dbContext).Where(item => !myOperationValues.Contains(new TupleElement(new ValueDefinition(item.IndexKeyValues[0])))))
                        {
                            foreach (var aMatch in myIndex.GetValues(aKey, indexRelatedType, dbContext).Intersect(interestingUUIDs))
                            {
                                interestingUUIDs.Remove(aMatch);
                            }
                        }

                        #endregion
                    }

                    break;

                case TypesOfBinaryExpression.RightComplex:

                    var myEnumerator = myOperationValues.GetEnumerator();

                    if (myEnumerator.MoveNext())
                    {
                        idxLookupKey = new IndexKey(myIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs[0], (myEnumerator.Current.Value as ValueDefinition).Value, myIndex.IndexKeyDefinition);

                        interestingUUIDs.UnionWith(myIndex.GetValues(idxLookupKey, currentType, dbContext));

                        while (myEnumerator.MoveNext())
                        {
                            idxLookupKey = new IndexKey(myIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs[0], (myEnumerator.Current.Value as ValueDefinition).Value, myIndex.IndexKeyDefinition);
                            interestingUUIDs.IntersectWith(myIndex.GetValues(idxLookupKey, currentType, dbContext));
                        }
                    }

                    break;

                case TypesOfBinaryExpression.Atom:
                case TypesOfBinaryExpression.Complex:
                case TypesOfBinaryExpression.Unknown:
                default:
                    break;
            }

            foreach (var aValidUUID in interestingUUIDs)
            {
                yield return aValidUUID;
            }

            yield break;
        }
Пример #13
0
        public override Exceptional<FuncParameter> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext dbContext)
        {
            var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(attributeIndex.IndexRelatedTypeUUID);

            return new Exceptional<FuncParameter>(new FuncParameter(attributeIndex.GetKeys(indexRelatedType, dbContext).Min().IndexKeyValues[0]));
        }
Пример #14
0
 public abstract Exceptional<IObject> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext myDBContext);
Пример #15
0
        /// <summary>
        /// Creates an index for the given myAttributes by filling the given the index with the objects
        /// of this type that are already stored.</summary>
        /// <param name="myAttributeNames">The names of the myAttributes, over which the index was created.</param>
        private Exceptional<Boolean> AddAttributeIndex(AAttributeIndex myAttributeIndex, DBContext myDBContext = null)
        {
            // Add this index to the list of indices of this GraphType
            lock (_AttributeIndices)
            {

                if (!_AttributeIndices.ContainsKey(myAttributeIndex.IndexKeyDefinition))
                {

                    #region New IndexKeyDefinition

                    #region Check if the IndexName already exist - same name and different keyDefinitions are not allowed!

                    if (_AttributeIndicesNameLookup.ContainsKey(myAttributeIndex.IndexName))
                    {
                        return new Exceptional<Boolean>(new Error_IndexAlreadyExist(myAttributeIndex.IndexName));
                    }

                    #endregion

                    #region Add Index (IndexKeyDefinition, IndexEdition)

                    _AttributeIndices.Add(myAttributeIndex.IndexKeyDefinition, new Dictionary<string, AAttributeIndex>());
                    _AttributeIndices[myAttributeIndex.IndexKeyDefinition].Add(myAttributeIndex.IndexEdition, myAttributeIndex);

                    _AttributeIndicesNameLookup.Add(myAttributeIndex.IndexName, myAttributeIndex.IndexKeyDefinition);

                    #endregion

                    #endregion

                }

                else if (_AttributeIndices[myAttributeIndex.IndexKeyDefinition].ContainsKey(myAttributeIndex.IndexEdition))
                {

                    #region IndexKeyDefinition and Edition already exist

                    return new Exceptional<Boolean>(new Error_IndexAlreadyExistWithSameEditionAndAttribute(myDBContext, _AttributeIndices[myAttributeIndex.IndexKeyDefinition][myAttributeIndex.IndexEdition].IndexName, myAttributeIndex.IndexKeyDefinition, myAttributeIndex.IndexEdition));

                    #endregion

                }

                else
                {

                    #region Existing IndexKeyDefinition but different edition

                    #region If the IndexName does not exist, add it - different names for same keyDefinition and DIFFERENT Edition are allowed

                    if (!_AttributeIndicesNameLookup.ContainsKey(myAttributeIndex.IndexName))
                    {
                        _AttributeIndicesNameLookup.Add(myAttributeIndex.IndexName, myAttributeIndex.IndexKeyDefinition);
                    }

                    #endregion

                    #region Add Index (IndexEdition)

                    _AttributeIndices[myAttributeIndex.IndexKeyDefinition].Add(myAttributeIndex.IndexEdition, myAttributeIndex);

                    #endregion

                    #endregion

                }

            }

            return new Exceptional<Boolean>(true);
        }
Пример #16
0
        /// <summary>
        /// Creates an index for the given myAttributes by filling the given the index with the objects
        /// of this type that are already stored.</summary>
        /// <param name="myAttributeNames">The names of the myAttributes, over which the index was created.</param>
        private Exceptional<Boolean> AddAttributeIndex(AAttributeIndex myAttributeIndex, DBContext myDBContext = null)
        {
            // Add this index to the list of indices of this GraphType
            lock (_AttributeIndices)
            {

                if (!_AttributeIndices.ContainsKey(myAttributeIndex.IndexKeyDefinition))
                {

                    #region New IndexKeyDefinition

                    #region Check if the IndexName already exist - same name and different keyDefinitions are not allowed!

                    if (_AttributeIndicesNameLookup.ContainsKey(myAttributeIndex.IndexName))
                    {
                        return new Exceptional<Boolean>(new Error_IndexAlreadyExist(myAttributeIndex.IndexName));
                    }

                    #endregion

                    #region Add Index (IndexKeyDefinition, IndexEdition)

                    _AttributeIndices.Add(myAttributeIndex.IndexKeyDefinition, new Dictionary<string, AAttributeIndex>());
                    _AttributeIndices[myAttributeIndex.IndexKeyDefinition].Add(myAttributeIndex.IndexEdition, myAttributeIndex);

                    _AttributeIndicesNameLookup.Add(myAttributeIndex.IndexName, myAttributeIndex.IndexKeyDefinition);

                    #endregion

                    #endregion

                }

                else if (_AttributeIndices[myAttributeIndex.IndexKeyDefinition].ContainsKey(myAttributeIndex.IndexEdition))
                {

                    #region IndexKeyDefinition and Edition already exist

                    return new Exceptional<Boolean>(new Error_IndexAlreadyExistWithSameEditionAndAttribute(myDBContext, _AttributeIndices[myAttributeIndex.IndexKeyDefinition][myAttributeIndex.IndexEdition].IndexName, myAttributeIndex.IndexKeyDefinition, myAttributeIndex.IndexEdition));

                    #endregion

                }

                else
                {

                    #region Existing IndexKeyDefinition but different edition

                    #region If the IndexName does not exist, add it - different names for same keyDefinition and DIFFERENT Edition are allowed

                    if (!_AttributeIndicesNameLookup.ContainsKey(myAttributeIndex.IndexName))
                    {
                        _AttributeIndicesNameLookup.Add(myAttributeIndex.IndexName, myAttributeIndex.IndexKeyDefinition);
                    }

                    #endregion

                    #region Add Index (IndexEdition)

                    _AttributeIndices[myAttributeIndex.IndexKeyDefinition].Add(myAttributeIndex.IndexEdition, myAttributeIndex);

                    #endregion

                    #endregion

                }

                myAttributeIndex.ObjectLocation = ObjectLocation + DBConstants.DBIndicesLocation + myAttributeIndex.IndexName;
                myAttributeIndex.ObjectName = myAttributeIndex.IndexName;
                myAttributeIndex.ObjectEdition = myAttributeIndex.IndexEdition;
                myAttributeIndex.ObjectStream = DBConstants.DBINDEXSTREAM;
                var storeResult = myDBContext.IGraphFSSession.StoreFSObject(myAttributeIndex, true);
                if (storeResult.Failed())
                {
                    return new Exceptional<bool>(storeResult);
                }

            }

            return new Exceptional<Boolean>(true);
        }
Пример #17
0
        public override Exceptional<IObject> Aggregate(AAttributeIndex attributeIndex, GraphDBType graphDBType, DBContext dbContext)
        {
            var indexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(attributeIndex.IndexRelatedTypeUUID);

            return new Exceptional<IObject>(attributeIndex.GetKeys(indexRelatedType, dbContext).Max().IndexKeyValues[0]);
        }
Пример #18
0
        internal Exceptional<IVersionedIndexObject<IndexKey, ObjectUUID>> LoadOrCreateDBIndex(ObjectLocation myShardObjectLocation, IVersionedIndexObject<IndexKey, ObjectUUID> myIIndexObject, AAttributeIndex correspondingIDX)
        {
            if (!(myIIndexObject is AFSObject))
            {
                return new Exceptional<IVersionedIndexObject<IndexKey, ObjectUUID>>(new Error_IndexIsNotPersistent(myIIndexObject));
            }

            var result = _IGraphFSSession.GetOrCreateFSObject<AFSObject>(myShardObjectLocation, DBConstants.DBINDEXSTREAM, () => myIIndexObject as AFSObject);
            if (!result.Success())
            {
                return new Exceptional<IVersionedIndexObject<IndexKey, ObjectUUID>>(result);
            }

            else
            {

                if (result.Value.isNew)
                {
                    //TODO: might be a performance bug
                    if (!_IGraphFSSession.ObjectExists(correspondingIDX.FileSystemLocation).Value)
                    {
                        result.PushIExceptional(_IGraphFSSession.CreateDirectoryObject(correspondingIDX.FileSystemLocation));
                    }

                    // Uncomment as soon as index is serializeable
                    result.PushIExceptional(_IGraphFSSession.StoreFSObject(result.Value, false));
                    //result.AddErrorsAndWarnings(result.Value.Save());
                    //ToDo: Fehler beim Speichern werden im Weiterm ignoriert statt darauf reagiert!
                }

                return new Exceptional<IVersionedIndexObject<IndexKey, ObjectUUID>>(result.Value as IVersionedIndexObject<IndexKey, ObjectUUID>);

            }
        }
Пример #19
0
 /// <summary>
 /// Abstract aggregate function for a attribute index
 /// </summary>
 /// <param name="myAttributeIndex">Attribute index</param>
 /// <param name="myGraphDBType">Underlying type of the index</param>
 /// <param name="myDBContext">The db context</param>
 /// <returns>The result of the aggregation</returns>
 public abstract Exceptional<FuncParameter> Aggregate(AAttributeIndex myAttributeIndex, GraphDBType myGraphDBType, DBContext myDBContext);
Пример #20
0
        /// <summary>
        /// Generate an output for an index
        /// </summary>
        /// <param name="myIndex">The index</param>
        /// <param name="myName">The index name</param>
        /// <returns>List of readouts which contain the index information</returns>
        private Vertex GenerateOutput(AAttributeIndex myIndex, String myName)
        {
            var _Index = new Dictionary<String, Object>();

            _Index.Add("Name",                   myName);
            _Index.Add("Edition",                myIndex.IndexEdition);
            _Index.Add("IndexType",              myIndex.IndexType);
            _Index.Add("IsUuidIndex",            myIndex.IsUUIDIndex);
            _Index.Add("IsUniqueAttributeIndex", myIndex.IsUniqueAttributeIndex);

            return new Vertex(_Index);
        }
Пример #21
0
        private Vertex GenerateCreateIndexResult(String myDBType, List<IndexAttributeDefinition> myAttributeList, AAttributeIndex myAttributeIndex)
        {
            var payload = new Dictionary<String, Object>();

            payload.Add("NAME", myAttributeIndex.IndexName);
            payload.Add("EDITION", myAttributeIndex.IndexEdition);
            payload.Add("INDEXTYPE", myAttributeIndex.IndexType);
            payload.Add("ONTYPE", myDBType);

            var attributes = new List<Vertex>();

            foreach (var _Attribute in myAttributeList)
            {
                var payloadAttributes = new Dictionary<String, Object>();
                payloadAttributes.Add("ATTRIBUTE", _Attribute.IndexAttribute);
                attributes.Add(new Vertex(payloadAttributes));
            }

            payload.Add("ATTRIBUTES", new Edge(null, attributes) { EdgeTypeName = "ATTRIBUTE" });

            return new Vertex(payload);
        }