Esempio n. 1
0
        public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager)
        {
            if (workingBase is DBTypeAttribute)
            {

                var workingTypeAttribute = (workingBase as DBTypeAttribute).GetValue();
                if (workingTypeAttribute.TypeCharacteristics.IsBackwardEdge)
                {
                    return true;
                }
                else if (workingTypeAttribute.GetDBType(typeManager).IsUserDefined)
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            else
            {
                return false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Writes all paths included in the HashSet. Every object is represented via a given attribute.
        /// 
        /// example path between fry and morbo (attribute is "Name") 
        /// 
        /// output:
        /// Fry -> Leela -> Lrrr -> Morbo
        /// </summary>
        /// <param name="myPaths">An HashSet which contains Lists of UUIDs</param>
        /// <param name="myTypeManager">The type manager to load the DBObjects</param>
        /// <param name="myTypeAttribute">The Type Attribute</param>
        /// <param name="myAttribute">The Attribute which shall be used for output.</param>
        public static void ShowDBObjects(HashSet<List<ObjectUUID>> myPaths, DBTypeManager myTypeManager, TypeAttribute myTypeAttribute, String myAttribute, DBObjectCache myObjectCache)
        {
            var attributeUUID = myTypeAttribute.GetRelatedType(myTypeManager).GetTypeSpecificAttributeByName(myAttribute).UUID;

            foreach (var path in myPaths)
            {

                var pathString = new StringBuilder();
                Exceptional<DBObjectStream> currentDBObject;

                foreach (var _ObjectUUID in path)
                {
                    //load from DB
                    currentDBObject = myObjectCache.LoadDBObjectStream(myTypeAttribute.GetRelatedType(myTypeManager), _ObjectUUID);
                    if (currentDBObject.Failed())
                    {
                        throw new NotImplementedException();
                    }

                    pathString.Append(currentDBObject.Value.GetAttribute(attributeUUID) + " -> ");
                }

                ////_Logger.Info(pathString.ToString());
                pathString.Remove(0, pathString.Length);

            }
        }
Esempio n. 3
0
        /// <summary>
        /// Writes an DBObject into log
        /// </summary>
        /// <param name="myObjectUUID">The UUID of the Object</param>
        /// <param name="myTypeManager">The corresponding type manager</param>
        /// <param name="myTypeAttribute">The type attribute</param>
        public static void ShowDBObject(ObjectUUID myObjectUUID, DBTypeManager myTypeManager, TypeAttribute myTypeAttribute, DBObjectCache myObjectCache)
        {
            var currentDBObject = myObjectCache.LoadDBObjectStream(myTypeAttribute.GetRelatedType(myTypeManager), myObjectUUID);

            if (currentDBObject.Failed())
                throw new NotImplementedException();
        }
Esempio n. 4
0
        public DBTypeManager(DBTypeManager dBTypeManager)
        {
            _DBContext                                      = dBTypeManager._DBContext;
            _UserID                                         = dBTypeManager._UserID;
            _DatabaseRootPath                               = dBTypeManager._DatabaseRootPath;
            _IGraphFSSession                                = dBTypeManager._IGraphFSSession;
            _ObjectLocationsOfAllUserDefinedDatabaseTypes   = dBTypeManager._ObjectLocationsOfAllUserDefinedDatabaseTypes;

            _SystemTypes                                    = dBTypeManager._SystemTypes;
            _BasicTypes                                     = dBTypeManager._BasicTypes;
            _GUIDTypeAttribute                              = dBTypeManager._GUIDTypeAttribute;

            //TODO: As soon as we have serialized Indices we can recomment these sections
            #region As soon as we have serialized Indices we can recomment these sections

            //_UserDefinedTypes                               = dBTypeManager._UserDefinedTypes;
            //_TypesNameLookUpTable                           = dBTypeManager._TypesNameLookUpTable;

            foreach (GraphDBType ptype in _SystemTypes.Values)
                _TypesNameLookUpTable.Add(ptype.Name, ptype);

            foreach (GraphDBType ptype in _BasicTypes.Values)
                _TypesNameLookUpTable.Add(ptype.Name, ptype);

            LoadUserDefinedDatabaseTypes(false);

            #endregion
        }
Esempio n. 5
0
 public DBObjectCache(DBTypeManager myTypeManager, DBObjectManager objectManager, long myMaxElements)
 {
     _typeManager = myTypeManager;
     _DBObjectManager = objectManager;
     _cachedDBObjectStreams = new Dictionary<TypeUUID, ConcurrentDictionary<ObjectUUID, WeakReference>>();
     _cachedBackwardEdges = new Dictionary<TypeUUID, ConcurrentDictionary<ObjectUUID, WeakReference>>();
     _maxElements = myMaxElements;
     _currentElements = 0;
 }
Esempio n. 6
0
 public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager)
 {
     if (workingBase != null)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 7
0
 public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager)
 {
     if ((workingBase is DBTypeAttribute) && (workingBase as DBTypeAttribute).GetValue().EdgeType is EdgeTypeWeighted)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 8
0
        public LevelKey(IEnumerable<EdgeKey> myEdgeKey, DBTypeManager myTypeManager)
        {
            _edges = new List<EdgeKey>();

            foreach (var aEdgeKey in myEdgeKey)
            {
                if (aEdgeKey.AttrUUID != null && aEdgeKey.AttrUUID != UndefinedTypeAttribute.AttributeUUID)
                {
                    var attribute = aEdgeKey.GetTypeAndAttributeInformation(myTypeManager).Item2;

                    if (attribute.GetDBType(myTypeManager).IsUserDefined || attribute.IsBackwardEdge)
                    {
                        _edges.Add(aEdgeKey);
                        _level++;

                        AddHashCodeFromSingleEdge(ref _hashcode, aEdgeKey);
                    }
                    else
                    {
                        if (_level == 0)
                        {
                            var newEdgeKey = new EdgeKey(aEdgeKey.TypeUUID, null);
                            _edges.Add(newEdgeKey);

                            AddHashCodeFromSingleEdge(ref _hashcode, newEdgeKey);

                            break;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    if (_level == 0)
                    {
                        _edges.Add(aEdgeKey);

                        AddHashCodeFromSingleEdge(ref _hashcode, aEdgeKey);

                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
Esempio n. 9
0
 public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager)
 {
     if (workingBase is DBInt64)
     {
         return true;
     }
     else if ((workingBase is DBTypeAttribute) && (workingBase as DBTypeAttribute).GetValue().GetDBType(typeManager).UUID == DBInt64.UUID)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 10
0
 public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager)
 {
     if (workingBase != null)
     {
         if ((workingBase is DBTypeAttribute) && (workingBase as DBTypeAttribute).GetValue().GetDBType(typeManager).IsUserDefined)
         {
             return false;
         }
         else
         {
             return true;
         }
     }
     else
     {
         return false;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// This will create a new dbContext, based on <paramref name="dbContext"/> reusing all shared data
        /// </summary>
        /// <param name="dbContext"></param>
        public DBContext(DBContext dbContext)
        {
            #region Immutable objects

            _DBPluginManager = dbContext.DBPluginManager;
            _DBSettingsManager = dbContext.DBSettingsManager;
            _IGraphFSSession = dbContext._IGraphFSSession;

            #endregion

            _SessionSettings = new DBSessionSettings(dbContext.SessionSettings);
            _DBObjectManager = new ObjectManagement.DBObjectManager(this, _IGraphFSSession);

            //
            _DBIndexManager = new Indices.DBIndexManager(_IGraphFSSession, this);

            _DBTypeManager = new DBTypeManager(dbContext.DBTypeManager);

            _DBObjectCache = _DBObjectManager.GetSimpleDBObjectCache(this);
        }
Esempio n. 12
0
        public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager)
        {
            if (workingBase != null)
            {
                if (workingBase is DBTypeAttribute)
                {
                    if ((workingBase as DBTypeAttribute).GetValue().GetDBType(typeManager).IsUserDefined)
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
            else
            {
                return false;
            }

            throw new NotImplementedException();
        }
Esempio n. 13
0
 private bool IsValidDBObjectStreamForBinExpr(DBObjectStream DBObjectStream, TypeAttribute myTypeAttribute, DBTypeManager myDBTypeManager)
 {
     if (DBObjectStream.HasAttribute(myTypeAttribute.UUID, myTypeAttribute.GetRelatedType(myDBTypeManager)) || myTypeAttribute.IsBackwardEdge)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 14
0
 private Dictionary<TypeAndAttributeDefinition, IObject> ExtractDefinedAttributes(Dictionary<string, Tuple<TypeAttribute, IObject>> attrsForResult, DBTypeManager myTypeManager)
 {
     return attrsForResult.Where(item => !(item.Value.Item1 is UndefinedTypeAttribute)).ToDictionary(key => new TypeAndAttributeDefinition(key.Value.Item1, key.Value.Item1.GetDBType(myTypeManager)), value => value.Value.Item2);
 }
Esempio n. 15
0
        public void AddAttribute(TypeAttribute myTypeAttribute, DBTypeManager myDBTypeManager, Boolean validate)
        {
            if (validate)
            {

                HashSet<UInt16> occupiedIDs = new HashSet<UInt16>();

                #region validate attributes

                CheckAttributeAgainstOthers(_Attributes, ref myTypeAttribute, ref occupiedIDs);

                #endregion

                #region validate superType

                var parentLookUpAttributes = myDBTypeManager.GetTypeByUUID(this.ParentTypeUUID).AttributeLookupTable;

                CheckAttributeAgainstOthers(parentLookUpAttributes, ref myTypeAttribute, ref occupiedIDs);
                CheckAttributeAgainstOthers(_Attributes, ref myTypeAttribute, ref occupiedIDs);

                #endregion

                #region validate subtypes

                var attributesOfSubtypes = GetAttributesOfSubtypes(myDBTypeManager);

                CheckAttributeAgainstOthers(attributesOfSubtypes, ref myTypeAttribute, ref occupiedIDs);
                CheckAttributeAgainstOthers(parentLookUpAttributes, ref myTypeAttribute, ref occupiedIDs);
                CheckAttributeAgainstOthers(_Attributes, ref myTypeAttribute, ref occupiedIDs);

                #endregion

                //now we can be shure to add the attribute
                _Attributes.Add(myTypeAttribute.UUID, myTypeAttribute);
                _TypeAttributeLookupTable.Add(myTypeAttribute.UUID, myTypeAttribute);

            }

            else
            {
                _Attributes.Add(myTypeAttribute.UUID, myTypeAttribute);
                _TypeAttributeLookupTable.Add(myTypeAttribute.UUID, myTypeAttribute);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// add an mandatory attribute to type
        /// </summary>
        /// <param name="myAttrib"></param>        
        public void AddMandatoryAttribute(AttributeUUID myAttribID, DBTypeManager myTypeManager)
        {
            List<GraphDBType> SubTypes = myTypeManager.GetAllSubtypes(this, false);

            foreach (var Types in SubTypes)
            {
                Types.AddMandatoryAttribute(myAttribID, myTypeManager);
            }

            _MandatoryAttributes.Add(myAttribID);
        }
Esempio n. 17
0
 /// <summary>
 /// This will validate the function to a working base.
 /// </summary>
 /// <param name="workingBase">The working base. Might be null for type independent function calls like CURRENTDATE().</param>
 /// <param name="typeManager"></param>
 /// <returns></returns>
 public abstract bool ValidateWorkingBase(IObject myWorkingBase, DBTypeManager myTypeManager);
Esempio n. 18
0
        public List<AttributeUUID> GetAllUniqueAttributes(Boolean includeCurrentType, DBTypeManager myTypeManager)
        {
            List<AttributeUUID> result = new List<AttributeUUID>();

            foreach (var aParentType in myTypeManager.GetAllParentTypes(this, includeCurrentType, false))
            {
                result.AddRange(aParentType._UniqueAttributes);
            }

            return result;
        }
Esempio n. 19
0
        public Exceptional<Boolean> ChangeMandatoryAttributes(List<string> myAttribs, DBTypeManager myTypeManager)
        {
            TypeAttribute TypeAttr = null;

            DropMandatoryAttributes(myTypeManager);
            foreach (var attribs in myAttribs)
            {
                TypeAttr = GetTypeAttributeByName(attribs);
                if (TypeAttr == null)
                {
                    return new Exceptional<bool>(new Error_AttributeIsNotDefined(this.Name, attribs));
                }
                else
                {
                    AddMandatoryAttribute(TypeAttr.UUID, myTypeManager);
                    foreach (var attribID in GetParentMandatoryAttr(myTypeManager))
                    {
                        AddMandatoryAttribute(TypeAttr.UUID, myTypeManager);
                    }
                }
            }

            var FlushExcept = myTypeManager.FlushType(this);

            if (FlushExcept.Failed())
                return new Exceptional<Boolean>(FlushExcept);

            return new Exceptional<Boolean>(true);
        }
Esempio n. 20
0
        /// <summary>
        /// generate a output result
        /// </summary>
        /// <param name="mySetting">the setting</param>
        /// <param name="myReadOutList">list of dbreadouts</param>
        private Vertex GenerateResult(ADBSettingsBase mySetting, DBTypeManager typeManager)
        {
            var Setting = new Dictionary<String, Object>();
            Setting.Add("Name", mySetting.Name);
            Setting.Add("ID", mySetting.ID);
            Setting.Add("Type", typeManager.GetTypeByUUID(mySetting.Type).Name);
            Setting.Add("Desc", mySetting.Description);
            Setting.Add("Default", mySetting.Default);
            Setting.Add("Value", mySetting.Value);

            return new Vertex(Setting);
        }
Esempio n. 21
0
        /// <summary>
        /// generates an output for a function 
        /// </summary>
        /// <param name="myFunc">the function</param>
        /// <param name="myFuncName">function name</param>
        /// <param name="myTypeManager">type manager</param>
        /// <returns>a list of readouts which contains the information</returns>
        private Vertex GenerateOutput(ABaseFunction myFunc, String myFuncName, DBTypeManager myTypeManager)
        {
            var Func = new Dictionary<String, Object>();

            Func.Add("Name",        myFuncName);
            Func.Add("Description", myFunc.GetDescribeOutput());

            #region Add function parameters

            var parameters = new Dictionary<String, Object>();
            foreach (var param in myFunc.GetParameters())
            {
                if (param.VariableNumOfParams)
                {
                    GraphDBType[] myArray = { myTypeManager.GetTypeByName(param.DBType.ObjectName) };
                    parameters.Add(param.Name, myArray);
                }
                else
                {
                    parameters.Add(param.Name, myTypeManager.GetTypeByName(param.DBType.ObjectName));
                }
            }

            Func.Add("Parameters", new Edge(null, new Vertex(parameters)));

            #endregion

            return new Vertex(Func);
        }
Esempio n. 22
0
        public Exceptional<Boolean> DropMandatoryAttributes(DBTypeManager myTypeManager)
        {
            List<GraphDBType> SubTypes = myTypeManager.GetAllSubtypes(this, false);

            if (GetMandatoryAttributesUUIDs(myTypeManager) != null)
            {
                foreach (var type in SubTypes)
                {
                    foreach (var attrib in _MandatoryAttributes)
                    {
                        if (type._MandatoryAttributes.Contains(attrib))
                            type._MandatoryAttributes.Remove(attrib);
                    }
                }

                _MandatoryAttributes.Clear();

                var FlushExcept = myTypeManager.FlushType(this);

                if (FlushExcept.Failed())
                    return new Exceptional<Boolean>(FlushExcept);
            }

            return new Exceptional<Boolean>(true);
        }
Esempio n. 23
0
        private LevelKey CreateLevelKey(IDChainDefinition myIDChainDefinition, DBTypeManager myTypeManager)
        {
            if (myIDChainDefinition.Level == 0)
            {
                return new LevelKey(new List<EdgeKey>() { new EdgeKey(myIDChainDefinition.Edges[0].TypeUUID, null) }, myTypeManager);
            }
            else
            {
                if (myIDChainDefinition.Last() is ChainPartFuncDefinition)
                {
                    // the funtion in the last idnode part processes the last attribute

                    if (myIDChainDefinition.Level == 1)
                    {
                        return new LevelKey(new List<EdgeKey>() { new EdgeKey(myIDChainDefinition.Edges[0].TypeUUID, null) }, myTypeManager);
                    }
                    else
                    {
                        return new LevelKey(myIDChainDefinition.Edges.Take(myIDChainDefinition.Level - 1), myTypeManager);
                    }
                }
                else
                {
                    return new LevelKey(myIDChainDefinition.Edges.Take(myIDChainDefinition.Level), myTypeManager);
                }
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Get the return type of this methods. Default is null - neither attribute nor function is valid on this methods.
 /// </summary>
 /// <param name="myWorkingBase"></param>
 /// <param name="myTypeManager"></param>
 /// <returns></returns>
 public virtual IObject GetReturnType(IObject myWorkingBase, DBTypeManager myTypeManager)
 {
     return null;
 }
Esempio n. 25
0
        private IEnumerable<Exceptional<DBObjectStream>> GetReferenceObjects(DBObjectStream myStartingDBObject, TypeAttribute interestingAttributeEdge, GraphDBType myStartingDBObjectType, DBTypeManager myDBTypeManager)
        {
            if (interestingAttributeEdge.GetDBType(myDBTypeManager).IsUserDefined || interestingAttributeEdge.IsBackwardEdge)
            {
                switch (interestingAttributeEdge.KindOfType)
                {
                    case KindsOfType.SingleReference:

                        yield return LoadDBObjectStream(interestingAttributeEdge.GetDBType(myDBTypeManager), ((ASingleReferenceEdgeType)myStartingDBObject.GetAttribute(interestingAttributeEdge.UUID)).GetUUID());

                        break;

                    case KindsOfType.SetOfReferences:

                        if (interestingAttributeEdge.IsBackwardEdge)
                        {
                            //get backwardEdge
                            var beStream = LoadDBBackwardEdgeStream(myStartingDBObjectType, myStartingDBObject.ObjectUUID);

                            if (beStream.Failed())
                            {
                                throw new GraphDBException(new Error_ExpressionGraphInternal(null, String.Format("Error while trying to get BackwardEdge of the DBObject: \"{0}\"", myStartingDBObject.ToString())));
                            }

                            if (beStream.Value.ContainsBackwardEdge(interestingAttributeEdge.BackwardEdgeDefinition))
                            {
                                foreach (var aBackwardEdgeObject in LoadListOfDBObjectStreams(interestingAttributeEdge.BackwardEdgeDefinition.TypeUUID, beStream.Value.GetBackwardEdgeUUIDs(interestingAttributeEdge.BackwardEdgeDefinition)))
                                {
                                    yield return aBackwardEdgeObject;
                                }
                            }
                        }
                        else
                        {
                            foreach (var aDBOStream in LoadListOfDBObjectStreams(interestingAttributeEdge.GetDBType(myDBTypeManager), ((ASetOfReferencesEdgeType)myStartingDBObject.GetAttribute(interestingAttributeEdge.UUID)).GetAllReferenceIDs()))
                            {
                                yield return aDBOStream;
                            }
                        }

                        break;

                    case KindsOfType.SetOfNoneReferences:
                    case KindsOfType.ListOfNoneReferences:
                    default:
                        throw new GraphDBException(new Error_ExpressionGraphInternal(new System.Diagnostics.StackTrace(true), String.Format("The attribute \"{0}\" has an invalid KindOfType \"{1}\"!", interestingAttributeEdge.Name, interestingAttributeEdge.KindOfType.ToString())));
                }
            }
            else
            {
                throw new GraphDBException(new Error_ExpressionGraphInternal(new System.Diagnostics.StackTrace(true), String.Format("The attribute \"{0}\" is no reference attribute.", interestingAttributeEdge.Name)));
            }

            yield break;
        }
Esempio n. 26
0
        public Exceptional<ResultType> DropUniqueAttributes(DBTypeManager myTypeManager)
        {
            #region Remove old unique index and attributes

            var mayBeUniqueIdx = FindUniqueIndex();

            if (mayBeUniqueIdx != null)
            {
                var RemoveIdxExcept = RemoveIndex(mayBeUniqueIdx.IndexName, mayBeUniqueIdx.IndexEdition, myTypeManager);

                if (RemoveIdxExcept.Failed())
                {
                    return new Exceptional<ResultType>(RemoveIdxExcept);
                }

                foreach (var attrUUID in mayBeUniqueIdx.IndexKeyDefinition.IndexKeyAttributeUUIDs)
                {
                    foreach (var type in myTypeManager.GetAllSubtypes(this, false))
                    {
                        var RemoveUniqueExcept = type.RemoveUniqueAttribute(attrUUID, myTypeManager);

                        if (RemoveUniqueExcept.Failed())
                            return new Exceptional<ResultType>(RemoveUniqueExcept);
                    }
                }
                _UniqueAttributes.Clear();
            }

            #endregion

            var FlushExcept = myTypeManager.FlushType(this);

            if (FlushExcept.Failed())
                return new Exceptional<ResultType>(FlushExcept);

            return new Exceptional<ResultType>(ResultType.Successful);
        }
Esempio n. 27
0
        /// <summary>
        /// Removes an attribute of the given type.
        /// </summary>
        /// <param name="targetClass">The target type.</param>
        /// <param name="myAttributeName">The attribute name, referencing the deprecated attribute.</param>
        /// <returns>True, if the attribute was successfully removed. Else, false.(it didnt exist)</returns>
        public Exceptional<ResultType> RemoveAttributeFromType(String targetClass, String attributeName, DBTypeManager myTypeManager)
        {
            #region INPUT EXCEPTIONS

            if (String.IsNullOrEmpty(targetClass))
                return new Exceptional<ResultType>(new Error_ArgumentNullOrEmpty(targetClass));

            if (String.IsNullOrEmpty(attributeName))
                return new Exceptional<ResultType>(new Error_ArgumentNullOrEmpty(attributeName));

            #endregion

            #region Data

            GraphDBType aType = GetTypeByName(targetClass);

            #endregion

            #region check if type exists

            if (aType == null)
                return new Exceptional<ResultType>(new Error_TypeDoesNotExist(targetClass));

            #endregion

            TypeAttribute Attribute = aType.GetTypeAttributeByName(attributeName);

            Exceptional<ResultType> retVal = null;

            if (Attribute != null)
            {
                //Check for other attributes that reference this one (i.e. as BackwardEdge)

                var referncedBy = GetBackwardReferencesForAttribute(Attribute);
                if (referncedBy.Count > 0)
                {
                    return new Exceptional<ResultType>(new Error_DropOfAttributeNotAllowed(Attribute.GetRelatedType(this).Name, attributeName, referncedBy.ToDictionary(key => key, value => value.GetRelatedType(this))));
                }

                if (Attribute.GetRelatedType(this) != aType)
                {
                    return new Exceptional<ResultType>(new Error_DropOfDerivedAttributeIsNotAllowed(Attribute.GetRelatedType(this).Name, attributeName));
                }
                retVal = RemoveAttributeOfType(aType, Attribute.UUID);
            }
            else
            {
                retVal = new Exceptional<ResultType>(new Error_AttributeIsNotDefined(attributeName));
            }

            return retVal;
        }
Esempio n. 28
0
        private LevelKey GetBackwardLevelKey(LevelKey mylevelKey, EdgeKey edgeKey, DBTypeManager myTypeManager)
        {
            if (mylevelKey.Level == 1)
            {
                return new LevelKey(new List<EdgeKey> { edgeKey }, myTypeManager);
            }
            else
            {
                List<EdgeKey> newEdges = new List<EdgeKey>();

                newEdges.AddRange(mylevelKey.Edges.Take(mylevelKey.Level - 2));
                newEdges.Add(edgeKey);

                return new LevelKey(newEdges, myTypeManager);
            }

            throw new NotImplementedException();
        }
Esempio n. 29
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
        /// <param name="DatabaseRootPath">The database root path.</param>
        public DBContext(IGraphFSSession graphFSSession, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, Boolean myRebuildIndices, DBPluginManager myDBPluginManager, DBSessionSettings sessionSettings = null)
        {
            _DBPluginManager    = myDBPluginManager;

            _DBTypeManager      = new TypeManagement.DBTypeManager(graphFSSession, myDatabaseRootPath, myUserID, myDBSettings, this);
            _DBSettingsManager  = new DBSettingsManager(_DBPluginManager.Settings, myDBSettings, graphFSSession, new ObjectLocation(myDatabaseRootPath.Name, DBConstants.DBSettingsLocation));
            _DBObjectManager    = new DBObjectManager(this, graphFSSession);
            _DBIndexManager     = new DBIndexManager(graphFSSession, this);
            _SessionSettings    = sessionSettings;
            _DBObjectCache      = _DBObjectManager.GetSimpleDBObjectCache(this);
            _IGraphFSSession    = graphFSSession;

            //init types
            var initExcept = _DBTypeManager.Init(graphFSSession, myDatabaseRootPath, myRebuildIndices);

            if (initExcept.Failed())
            {
                throw new GraphDBException(initExcept.IErrors);
            }
        }
Esempio n. 30
0
        private LevelKey GetForwardLevelKey(LevelKey mylevelKey, EdgeKey edgeKey, DBTypeManager myTypeManager)
        {
            if (mylevelKey.Level == 0)
            {
                return new LevelKey(new List<EdgeKey> { edgeKey }, myTypeManager);
            }
            else
            {
                List<EdgeKey> newEdges = new List<EdgeKey>();

                newEdges.AddRange(mylevelKey.Edges);
                newEdges.Add(edgeKey);

                return new LevelKey(newEdges, myTypeManager);
            }
        }