예제 #1
0
 public Error_CouldNotRemoveSetting(ADBSettingsBase mySetting, TypesSettingScope myScope, GraphDBType myType = null, TypeAttribute myAttribute = null)
 {
     Setting = mySetting;
     Scope = myScope;
     Type = myType;
     Attribute = myAttribute;
 }
예제 #2
0
        /// <summary>
        /// <seealso cref=" AAttributeAssignOrUpdate"/>
        /// </summary>
        public override Exceptional<IObject> GetValueForAttribute(DBObjectStream myDBObject, DBContext myDBContext, GraphDBType myGraphDBType)
        {
            if (AttributeIDChain.IsUndefinedAttribute)
            {
                return new Exceptional<IObject>(GraphDBTypeMapper.GetBaseObjectFromCSharpType(Value));
            }

            #region Simple value

            var dbType = AttributeIDChain.LastAttribute.GetDBType(myDBContext.DBTypeManager);
            if (AttributeIDChain.LastAttribute is SpecialTypeAttribute_UUID)
            {
                dbType = myDBContext.DBTypeManager.GetTypeByName(GraphDBTypeMapper.GetBaseObjectFromCSharpType(Value).ObjectName);//DBString.Name);
            }
            if (GraphDBTypeMapper.IsAValidAttributeType(dbType, AttributeAssignType, myDBContext, Value))
            {
                return new Exceptional<IObject>(GraphDBTypeMapper.GetGraphObjectFromType(AttributeAssignType, Value)); ;
            }
            else
            {
                return new Exceptional<IObject>(new Error_InvalidAttributeValue(AttributeIDChain.LastAttribute.Name, Value));
            }

            #endregion
        }
예제 #3
0
파일: UUIDIndex.cs 프로젝트: ipbi/sones
        public UUIDIndex(string indexName, IndexKeyDefinition idxKey, GraphDBType correspondingType, string indexType = null, string indexEdition = DBConstants.DEFAULTINDEX)
        {
            IndexName          = indexName;
            IndexEdition       = indexEdition;
            IndexKeyDefinition = idxKey;
            IndexRelatedTypeUUID = correspondingType.UUID;

            if (indexEdition == null)
            {
                IndexEdition = DBConstants.DEFAULTINDEX;
            }
            else
            {
                IndexEdition = indexEdition;
            }

            if (String.IsNullOrEmpty(indexType))
            {
                IndexType = "UUIDIndex";
            }
            else
            {
                IndexType = indexType;
            }

            #region Workaround for current IndexOperation of InOperator - just follow the IsListOfBaseObjectsIndex property

            IsListOfBaseObjectsIndex = false;

            #endregion

            FileSystemLocation = (correspondingType.ObjectLocation + "Indices") + (IndexName + "#" + IndexEdition);
        }
예제 #4
0
파일: IDNode.cs 프로젝트: TheByte/sones
 public IDNode(GraphDBType myType, String myReference)
 {
     IDChainDefinition = new Managers.Structures.IDChainDefinition();
     IDChainDefinition.AddPart(new ChainPartTypeOrAttributeDefinition(myType.Name));
     var listOfRefs = new Dictionary<String, GraphDBType>();
     listOfRefs.Add(myReference, myType);
 }
예제 #5
0
 /// <summary>
 /// This will be invoked by the BulkInsert class.
 /// </summary>
 /// <param name="myTypeManager"></param>
 /// <param name="myDBTypeStream"></param>
 /// <param name="myDBObjectStream"></param>
 /// <param name="myBulkInsert"></param>
 internal BulkInsertDBO(DBContext myDBContext, GraphDBType myDBTypeStream, DBObjectStream myDBObjectStream, BulkInsert myBulkInsert)
 {
     _DBContext = myDBContext;
     _DBTypeStream = myDBTypeStream;
     _DBObjectStream = myDBObjectStream;
     _BulkInsert = myBulkInsert;
 }
예제 #6
0
        public ADBBaseObject GetValue(GraphDBType myTypeID, TypeAttribute myAttrID, UUID mySettingUUID, DBContext context)
        {
            if (_TypeAttrSetting.ContainsKey(myTypeID.UUID))
            {
                if (_TypeAttrSetting[myTypeID.UUID].ContainsKey(myAttrID.UUID))
                {
                    if (_TypeAttrSetting[myTypeID.UUID][myAttrID.UUID].ContainsKey(mySettingUUID))
                    {
                        return _TypeAttrSetting[myTypeID.UUID][myAttrID.UUID][mySettingUUID];
                    }
                }
                else
                {
                    _TypeAttrSetting[myTypeID.UUID].Add(myAttrID.UUID, new Dictionary<UUID, ADBBaseObject>());
                }
            }
            else
            {
                _TypeAttrSetting.Add(myTypeID.UUID, new Dictionary<AttributeUUID, Dictionary<UUID, ADBBaseObject>>());
                _TypeAttrSetting[myTypeID.UUID].Add(myAttrID.UUID, new Dictionary<UUID, ADBBaseObject>());
            }

            //we are here, so we have to add the setting and return it

            var settingValue = context.DBSettingsManager.GetSettingValue(mySettingUUID, context, TypesSettingScope.ATTRIBUTE, myTypeID, myAttrID).Value.Clone();

            _TypeAttrSetting[myTypeID.UUID][myAttrID.UUID].Add(mySettingUUID, settingValue);

            return settingValue;
        }
예제 #7
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; }));
            }
        }
예제 #8
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
            //}
        }
 public Warning_EdgeToNonExistingNode(DBObjectStream myStartingNode, GraphDBType myTypeOfDBO, TypeAttribute myEdge, IEnumerable<IError> myErrors)
 {
     StartingNode = myStartingNode;
     Errors = myErrors;
     Edge = myEdge;
     TypeOfDBO = myTypeOfDBO;
 }
예제 #10
0
        public Exceptional<Boolean> CheckUniqueConstraint(GraphDBType myGraphType, IEnumerable<GraphDBType> myParentTypes, Dictionary<AttributeUUID, IObject> toBeCheckedForUniqueConstraint)
        {
            var UniqueAttributes = myGraphType.GetAllUniqueAttributes(true, _DBContext.DBTypeManager);

            if (!UniqueAttributes.IsNullOrEmpty())
            {
                var dbObjectAttributes = (from aAttribute in toBeCheckedForUniqueConstraint where UniqueAttributes.Contains(aAttribute.Key) select aAttribute);

                if (dbObjectAttributes.Count() != 0)
                {
                    AAttributeIndex AttrIndex = null;

                    foreach (var PType in myParentTypes)
                    {
                        AttrIndex = PType.FindUniqueIndex();

                        if (AttrIndex != null)
                        {
                            var toBeCheckedIdxKey = GenerateIndexKeyForUniqueConstraint(toBeCheckedForUniqueConstraint, AttrIndex.IndexKeyDefinition, myGraphType);

                            if (AttrIndex.Contains(toBeCheckedIdxKey, PType, _DBContext))
                            {
                                return new Exceptional<Boolean>(new Error_UniqueConstrainViolation(PType.Name, AttrIndex.IndexName));
                            }
                        }
                    }
                }
            }

            return new Exceptional<Boolean>(true);
        }
예제 #11
0
        public override Exceptional<IObject> ExtractValue(DBObjectStream dbObjectStream, GraphDBType graphDBType, DBContext dbContext)
        {
            EdgeTypeListOfBaseObjects streams = new EdgeTypeListOfBaseObjects();

            foreach (var item in dbObjectStream.ObjectStreams)
                streams.Add(new DBString(item.Key + " " + item.Value.ToString()));

            return new Exceptional<IObject>(streams);
        }
        public override Exceptional<IObject> ExtractValue(DBObjectStream dbObjectStream, GraphDBType graphDBType, DBContext dbContext)
        {
            EdgeTypeListOfBaseObjects parentRevisions = new EdgeTypeListOfBaseObjects();

            foreach (var item in dbObjectStream.ParentRevisionIDs)
                parentRevisions.Add(new DBString(item.ToString()));

            return new Exceptional<IObject>(parentRevisions);
        }
예제 #13
0
        public AttributeIndex(string indexName, IndexKeyDefinition idxKey, GraphDBType correspondingType, UInt16 myAttributeIdxShards, string indexType = null, string indexEdition = DBConstants.DEFAULTINDEX, UInt64 myKeyCount = 0, UInt64 myValueCount = 0)
        {
            IndexName          = indexName;
            IndexEdition       = indexEdition;
            IndexKeyDefinition = idxKey;
            IndexRelatedTypeUUID = correspondingType.UUID;
            AttributeIdxShards = myAttributeIdxShards;

            _keyCount = myKeyCount;
            _valueCount = myValueCount;

            if (indexEdition == null)
            {
                IndexEdition = DBConstants.DEFAULTINDEX;
            }
            else
            {
                IndexEdition = indexEdition;
            }

            if (String.IsNullOrEmpty(indexType))
            {
                IndexType = VersionedHashIndexObject.Name;
            }
            else
            {
                IndexType = indexType;
            }

            #region Workaround for current IndexOperation of InOperator - just follow the IsListOfBaseObjectsIndex property

            // better approach, use a special index key for a set of base objects
            if (idxKey.IndexKeyAttributeUUIDs.Any(a =>
            {
                var typeAttr = correspondingType.GetTypeAttributeByUUID(a);
                if (typeAttr != null && (typeAttr.EdgeType is IBaseEdge))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }))
            {
                IsListOfBaseObjectsIndex = true;
            }
            else
            {
                IsListOfBaseObjectsIndex = false;
            }

            #endregion

            FileSystemLocation = (correspondingType.ObjectLocation + "Indices") + (IndexName + "#" + IndexEdition);
        }
예제 #14
0
        public static BasicType ConvertGraph2CSharp(TypeAttribute attributeDefinition, GraphDBType typeOfAttribute)
        {
            if (typeOfAttribute.IsUserDefined)
            {
                if (attributeDefinition.KindOfType != KindsOfType.SetOfReferences && attributeDefinition.KindOfType != KindsOfType.SingleReference)
                    throw new GraphDBException(new Error_ListAttributeNotAllowed(typeOfAttribute.Name));

                return BasicType.Reference;
            }

            else
            {

                if (attributeDefinition.KindOfType == KindsOfType.ListOfNoneReferences || attributeDefinition.KindOfType == KindsOfType.SetOfNoneReferences)
                    return BasicType.SetOfDBObjects;

                switch (typeOfAttribute.Name)
                {

                    case DBConstants.DBInteger:
                        return GraphInteger;

                    case DBConstants.DBInt32:
                        return GraphInt32;

                    case DBConstants.DBUnsignedInteger:
                        return GraphUnsignedInteger;

                    case DBConstants.DBString:
                        return GraphString;

                    case DBConstants.DBDouble:
                        return GraphDouble;

                    case DBConstants.DBDateTime:
                        return GraphDateTime;

                    case DBConstants.DBBoolean:
                        return GraphBoolean;

                    case "NumberLiteral":
                        return BasicType.Unknown;

                    case "StringLiteral":
                        return BasicType.Unknown;

                    case DBConstants.DBObject:
                        return BasicType.Reference;

                    default:
                        throw new GraphDBException(new Error_TypeDoesNotExist(typeOfAttribute.Name));

                }

            }
        }
예제 #15
0
        public override IEnumerable<Vertex> CreateVertex(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            var payload = new Dictionary<String, Object>();

            payload.Add("TYPE", myGraphDBType);
            payload.Add("ACTION", "CHANGE COMMENT");
            payload.Add("NEW COMMENT", NewComment);

            return new List<Vertex> { new Vertex(payload) };
        }
예제 #16
0
파일: DBObjectMR.cs 프로젝트: TheByte/sones
        public DBObjectMR(DBObjectStream myDBObject, GraphDBType myDBTypeStream, DBContext myTypeManager)
        {
            _ObjectUUID = myDBObject.ObjectUUID;
            _Attributes = new Dictionary<String, Object>();

            foreach (var _Attribute in myDBTypeStream.Attributes)
            {
                _Attributes.Add(_Attribute.Value.Name, myDBObject.GetAttribute(_Attribute.Key));
            }
        }
예제 #17
0
파일: BulkInsert.cs 프로젝트: ipbi/sones
        /// <summary>
        /// Create a new BulkInsert.
        /// </summary>
        /// <param name="myGraphDBSession">The DB Reference</param>
        /// <param name="myGraphFSSession">The FS reference</param>
        /// <param name="myType">The type of the ne DBObjects</param>
        public BulkInsert(IGraphDBSession myGraphDBSession, IGraphFSSession myGraphFSSession, String myType)
        {
            _GraphDBSession = myGraphDBSession;
            _GraphFSSession = myGraphFSSession;

            (_GraphFSSession.SessionToken.SessionInfo as FSSessionInfo).FSSettings.ReflushAllocationMap = false;

            _DBTransaction = _GraphDBSession.BeginTransaction(myLongRunning: true, myIsolationLevel: IsolationLevel.Serializable);
            _Type = ((DBContext)_DBTransaction.GetDBContext()).DBTypeManager.GetTypeByName(myType);
        }
예제 #18
0
파일: BulkInsert.cs 프로젝트: ipbi/sones
        /// <summary>
        /// Create a new BulkInsert.
        /// </summary>
        /// <param name="myGraphDBSession">The DB Reference</param>
        /// <param name="myGraphFSSession">The FS reference</param>
        /// <param name="myType">The type of the ne DBObjects</param>
        public BulkInsert(IGraphDBSession myGraphDBSession, IGraphFSSession myGraphFSSession, GraphDBType myType)
        {
            _GraphDBSession = myGraphDBSession;
            _GraphFSSession = myGraphFSSession;

            _Type = myType;

            (_GraphFSSession.SessionToken.SessionInfo as FSSessionInfo).FSSettings.ReflushAllocationMap = false;

            _DBTransaction = _GraphDBSession.BeginTransaction(myLongRunning: true, myIsolationLevel: IsolationLevel.Serializable);
        }
예제 #19
0
        /// <summary>
        /// Execute the renaming of the backwardedge of a given type.
        /// </summary>
        /// <param name="myDBContext"></param>
        /// <param name="myGraphDBType"></param>
        /// <returns></returns>
        public override Exceptional Execute(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            TypeAttribute Attribute = myGraphDBType.GetTypeAttributeByName(OldName);

            if (Attribute == null)
            {
                return new Exceptional(new Error_AttributeIsNotDefined(OldName));
            }

            return myGraphDBType.RenameBackwardedge(Attribute, NewName, myDBContext.DBTypeManager);
        }
예제 #20
0
        protected IEnumerable<Vertex> CreateRenameResult(String myAlterAction, String myFromString, String myToString, GraphDBType myType)
        {
            var payload = new Dictionary<String, Object>();

            payload.Add("TYPE",   myType);
            payload.Add("ACTION", myAlterAction);
            payload.Add("FROM",   myFromString);
            payload.Add("TO",     myToString);

            return new List<Vertex>(){new Vertex(payload)};
        }
예제 #21
0
 public override Exceptional<IObject> ExtractValue(DBObjectStream dbObjectStream, GraphDBType graphDBType, DBContext dbContext)
 {
     var myType = dbContext.DBTypeManager.GetTypeByUUID(dbObjectStream.TypeUUID);
     if (myType != null)
     {
         return new Exceptional<IObject>(new DBString(myType.Name));
     }
     else
     {
         return new Exceptional<IObject>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
     }
 }
예제 #22
0
        public override Exceptional<IObject> GetValueForAttribute(DBObjectStream aDBObject, DBContext dbContext, GraphDBType _Type)
        {
            #region ListOfDBObjects

            if (AttributeIDChain.LastAttribute.GetDBType(dbContext.DBTypeManager).IsUserDefined)
            {
                //userdefined
                //value = aSetNode.GetCorrespondigDBObjectUUIDs(aTaskNode.AttributeIDNodee, typeManager, dbObjectCache, mySessionToken);

                if (CollectionDefinition.CollectionType == CollectionType.SetOfUUIDs)
                {
                    var retVal = CollectionDefinition.TupleDefinition.GetAsUUIDEdge(dbContext, AttributeIDChain.LastAttribute);
                    if (!retVal.Success())
                    {
                        return new Exceptional<IObject>(retVal);
                    }
                    else
                    {
                        return new Exceptional<IObject>(retVal.Value);
                    }
                }
                else
                {
                    var edge = (IEdgeType)(CollectionDefinition.TupleDefinition.GetCorrespondigDBObjectUUIDAsList(_Type, dbContext, AttributeIDChain.LastAttribute.EdgeType.GetNewInstance(), AttributeIDChain.LastAttribute.GetDBType(dbContext.DBTypeManager)).Value);
                    return new Exceptional<IObject>(edge);
                }
            }
            else
            {
                //not userdefined

                var edge = GetBasicList(dbContext);
                if (edge.Failed())
                {
                    return new Exceptional<IObject>(edge);
                }

                // If the collection was declared as a SETOF insert
                if (CollectionDefinition.CollectionType == CollectionType.Set)
                {
                    edge.Value.Distinction();
                }

                return new Exceptional<IObject>(edge.Value);
            }

            #endregion
        }
        public override Exceptional<IObject> GetValueForAttribute(DBObjectStream aDBObject, DBContext dbContext, GraphDBType _Type)
        {
            #region Expression

            var validateResult = BinaryExpressionDefinition.Validate(dbContext, _Type);
            if (validateResult.Failed())
            {
                return new Exceptional<IObject>(validateResult);
            }

            var value = BinaryExpressionDefinition.SimpleExecution(aDBObject, dbContext);

            #endregion

            return new Exceptional<IObject>(value);
        }
예제 #24
0
        /// <summary>
        /// Execute the removal of attribute indices
        /// <seealso cref=" AAlterTypeCommand"/>
        /// </summary>        
        public override Exceptional Execute(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            var retExceptional = new Exceptional();

            foreach (var index in _IdxDropList)
            {
                var dropIdxExcept = myGraphDBType.RemoveIndex(index.Key, index.Value, myDBContext);

                if (!dropIdxExcept.Success())
                {
                    retExceptional.PushIExceptional(dropIdxExcept);
                }
            }

            return retExceptional;
        }
예제 #25
0
        /// <summary>
        /// Executes the removal of certain myAttributes.
        /// </summary>
        public override Exceptional Execute(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            foreach (String aAttributeName in _ListOfAttributes)
            {

                //Hack: remove myAttributes in DBObjects
                var aTempResult = myDBContext.DBTypeManager.RemoveAttributeFromType(myGraphDBType.Name, aAttributeName, myDBContext.DBTypeManager);

                if (aTempResult.Failed())
                {
                    return aTempResult;
                }
            }

            return Exceptional.OK;
        }
예제 #26
0
        public Exceptional<Tuple<String, TypeAttribute, IListOrSetEdgeType>> ApplyUpdateListAttribute(AAttributeAssignOrUpdateOrRemove myAttributeUpdateOrAssign, DBContext dbContext, DBObjectStream aDBObject, GraphDBType _Type)
        {
            if (myAttributeUpdateOrAssign is AttributeAssignOrUpdateList)
            {

            }
            else if (myAttributeUpdateOrAssign is AttributeRemoveList)
            {

            }
            else
            {
                return new Exceptional<Tuple<String, TypeAttribute, IListOrSetEdgeType>>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
            }

            return new Exceptional<Tuple<String, TypeAttribute, IListOrSetEdgeType>>(null as Tuple<String, TypeAttribute, IListOrSetEdgeType>);
        }
예제 #27
0
        public override Exceptional<ADBSettingsBase> Get(DBContext context, TypesSettingScope scope, GraphDBType type = null, TypeAttribute attribute = null)
        {
            switch (scope)
            {
                case TypesSettingScope.DB:
                    #region db

                    return new Exceptional<ADBSettingsBase>(context.SessionSettings.GetDBSetting(this.Name));

                    #endregion

                case TypesSettingScope.SESSION:
                    #region session

                    return new Exceptional<ADBSettingsBase>(context.SessionSettings.GetSessionSetting(this.Name));

                    #endregion

                case TypesSettingScope.TYPE:
                    #region type

                    if (type != null)
                    {
                        return new Exceptional<ADBSettingsBase>(context.SessionSettings.GetTypeSetting(this.Name, type.UUID));
                    }

                    return new Exceptional<ADBSettingsBase>(new Error_CouldNotGetSetting(this, scope));
                    #endregion

                case TypesSettingScope.ATTRIBUTE:
                    #region attribute

                    if ((type != null) && (attribute != null))
                    {
                        return new Exceptional<ADBSettingsBase>(context.SessionSettings.GetAttributeSetting(this.Name, type.UUID, attribute.UUID));
                    }

                    return new Exceptional<ADBSettingsBase>(new Error_CouldNotGetSetting(this, scope, type, attribute));
                    #endregion

                default:

                    return new Exceptional<ADBSettingsBase>(new Error_NotImplemented(new System.Diagnostics.StackTrace()));
            }
        }
예제 #28
0
        /// <summary>
        /// <seealso cref=" AAlterTypeCommand"/>
        /// </summary>        
        public override IEnumerable<Vertex> CreateVertex(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            var payload         = new Dictionary<String, Object>();
            var indicesReadouts = new List<Vertex>();

            payload.Add("TYPE", myGraphDBType.Name);

            if (_IdxDefinitionList.IsNotNullOrEmpty())
            {

                payload.Add("ACTION", "ADD INDICES");

                foreach (var idxDef in _IdxDefinitionList)
                {

                    var payloadPerIndex = new Dictionary<String, Object>();

                    payloadPerIndex.Add("NAME",      idxDef.IndexName);
                    payloadPerIndex.Add("EDITION",   idxDef.Edition);
                    payloadPerIndex.Add("INDEXTYPE", idxDef.IndexType);

                    if (idxDef.IndexAttributeDefinitions.Count == 1)
                    {
                        payloadPerIndex.Add("ATTRIBUTE", idxDef.IndexAttributeDefinitions[0].IndexAttribute);
                    }
                    else
                    {
                        String attributes = String.Empty;

                        idxDef.IndexAttributeDefinitions.ForEach(item => attributes += item.IndexAttribute + " ");
                        payloadPerIndex.Add("ATTRIBUTES", attributes);
                    }

                    indicesReadouts.Add(new Vertex(payloadPerIndex));

                }

                payload.Add("INDICES", indicesReadouts);

            }

            return new List<Vertex> { new Vertex(payload) };
        }
예제 #29
0
        public override Exceptional<IObject> GetValueForAttribute(DBObjectStream myDBObject, DBContext myDBContext, GraphDBType myGraphDBType)
        {
            if (AttributeIDChain.IsUndefinedAttribute)
            {
                return new Exceptional<IObject>(GraphDBTypeMapper.GetBaseObjectFromCSharpType(Value));
            }

            #region Simple value

            if (GraphDBTypeMapper.IsAValidAttributeType(AttributeIDChain.LastAttribute.GetDBType(myDBContext.DBTypeManager), AttributeAssignType, myDBContext, Value))
            {
                return new Exceptional<IObject>(GraphDBTypeMapper.GetGraphObjectFromType(AttributeAssignType, Value)); ;
            }
            else
            {
                return new Exceptional<IObject>(new Error_InvalidAttributeValue(AttributeIDChain.LastAttribute.Name, Value));
            }

            #endregion
        }
예제 #30
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
            //}
        }