Example #1
0
 /// <summary>
 /// Creates a new DBObject of a given GraphType inserts its UUID into all indices of the given GraphType.
 /// </summary>
 /// <param name="myGraphDBType">The GraphType of the DBObject to create</param>
 /// <param name="myDBObjectAttributes">A dictionary of attributes for the new DBObject</param>
 /// <param name="myExtractSettings">Special values which should be set to a object</param>
 /// <returns>The UUID of the new DBObject</returns>
 public Exceptional<DBObjectStream> CreateNewDBObject(GraphDBType myGraphDBType, Dictionary<String, IObject> myDBObjectAttributes, Dictionary<String, IObject> myUndefAttributes, Dictionary<ASpecialTypeAttribute, Object> mySpecialTypeAttributes, SessionSettings mySessionSettings, Boolean myCheckUniqueness)
 {
     Dictionary<AttributeUUID, IObject> _attrs = myDBObjectAttributes.ToDictionary(key => myGraphDBType.GetTypeAttributeByName(key.Key).UUID, value => value.Value);
     return CreateNewDBObjectStream(myGraphDBType, _attrs, myUndefAttributes, mySpecialTypeAttributes, mySessionSettings, myCheckUniqueness);
 }
Example #2
0
        /// <summary>
        /// Creates a new DBObject of a given GraphType inserts its UUID into all indices of the given GraphType.
        /// </summary>
        /// <param name="myGraphDBType">The GraphType of the DBObject to create</param>
        /// <param name="myDBObjectAttributes">A dictionary of attributes for the new DBObject</param>
        /// <param name="mySpecialTypeAttributes">Special values which should be set to a object</param>
        /// <param name="myCheckUniqueness">check for unique constraints</param> 
        /// <returns>The UUID of the new DBObject</returns>
        public Exceptional<DBObjectStream> CreateNewDBObjectStream(GraphDBType myGraphDBType, Dictionary<AttributeUUID, IObject> myDBObjectAttributes, Dictionary<String, IObject> myUndefAttributes, Dictionary<ASpecialTypeAttribute, Object> mySpecialTypeAttributes, SessionSettings mySessionSettings, Boolean myCheckUniqueness)
        {
            #region Input validation

            if (myGraphDBType == null)
                return new Exceptional<DBObjectStream>(new Error_ArgumentNullOrEmpty("The parameter myGraphType must not be null!"));

            if (myDBObjectAttributes == null)
                return new Exceptional<DBObjectStream>(new Error_ArgumentNullOrEmpty("The parameter myDBObjectAttributes must not be null!"));

            #endregion

            #region Check uniqueness

            if (myCheckUniqueness)
            {

                var parentTypes = _DBContext.DBTypeManager.GetAllParentTypes(myGraphDBType, true, false);
                var CheckVal = _DBContext.DBIndexManager.CheckUniqueConstraint(myGraphDBType, parentTypes, myDBObjectAttributes);

                if (CheckVal.Failed())
                    return new Exceptional<DBObjectStream>(CheckVal);

            }

            #endregion

            #region Create a new DBObjectStream

            DBObjectStream        _NewDBObjectStream               = null;
            ObjectUUID            _NewObjectUUID                   = null;
            ASpecialTypeAttribute _SpecialTypeAttribute_UUID_Key   = new SpecialTypeAttribute_UUID();
            Object                _SpecialTypeAttribute_UUID_Value = null;

            #region Search for an user-defined ObjectUUID

            if (mySpecialTypeAttributes != null)
            {
                if (mySpecialTypeAttributes.TryGetValue(_SpecialTypeAttribute_UUID_Key, out _SpecialTypeAttribute_UUID_Value))
                {

                    // User-defined ObjectUUID of type UInt64
                    var _ValueAsUInt64 = _SpecialTypeAttribute_UUID_Value as UInt64?;
                    if (_ValueAsUInt64 != null)
                        _NewObjectUUID = new ObjectUUID(_ValueAsUInt64.Value);

                    // User-defined ObjectUUID of type String or anything else...
                    else
                    {

                        var _String = _SpecialTypeAttribute_UUID_Value.ToString();
                        if (_String == null || _String == "")
                            return new Exceptional<DBObjectStream>(new Error_InvalidAttributeValue(SpecialTypeAttribute_UUID.AttributeName, _String));

                        _NewObjectUUID = new ObjectUUID(_SpecialTypeAttribute_UUID_Value.ToString());

                    }

                    mySpecialTypeAttributes[_SpecialTypeAttribute_UUID_Key] = _NewObjectUUID;

                }
            }

            #endregion

            // If _NewObjectUUID == null a new one will be generated!
            _NewDBObjectStream                = new DBObjectStream(_NewObjectUUID, myGraphDBType, myDBObjectAttributes);
            _NewDBObjectStream.ObjectLocation = new ObjectLocation(_NewDBObjectStream.ObjectPath, _NewDBObjectStream.ObjectUUID.ToString());

            #endregion

            #region Check for duplicate ObjectUUIDs... maybe resolve duplicates!

            var _DBObjectStreamAlreadyExistsResult = ObjectExistsOnFS(_NewDBObjectStream);

            if (_DBObjectStreamAlreadyExistsResult.Failed())
                return new Exceptional<DBObjectStream>(_DBObjectStreamAlreadyExistsResult);

            while (_DBObjectStreamAlreadyExistsResult.Value == Trinary.TRUE)
            {

                if (_NewObjectUUID != null)
                    return new Exceptional<DBObjectStream>(new Error_DBObjectCollision(_NewDBObjectStream));

                _NewDBObjectStream                = new DBObjectStream(ObjectUUID.NewUUID, myGraphDBType, myDBObjectAttributes);
                _NewDBObjectStream.ObjectLocation = new ObjectLocation(_NewDBObjectStream.ObjectPath, _NewDBObjectStream.ObjectUUID.ToString());

                _DBObjectStreamAlreadyExistsResult = ObjectExistsOnFS(_NewDBObjectStream);

                if (_DBObjectStreamAlreadyExistsResult.Failed())
                    return new Exceptional<DBObjectStream>(_DBObjectStreamAlreadyExistsResult);

            }

            #endregion

            #region Check for ExtractSetting attributes unlike UUID

            if (mySpecialTypeAttributes != null && mySpecialTypeAttributes.Any())
            {
                foreach (var _SpecialAttribute in mySpecialTypeAttributes)
                {
                    // Skip SpecialTypeAttribute_UUID!
                    if (!(_SpecialAttribute.Key is SpecialTypeAttribute_UUID))
                    {
                        var result = _SpecialAttribute.Key.ApplyTo(_NewDBObjectStream, _SpecialAttribute.Value);
                        if (result.Failed())
                        {
                            return new Exceptional<DBObjectStream>(result);
                        }
                    }
                }
            }

            #endregion

            // Flush new DBObject
            var flushResult = FlushDBObject(_NewDBObjectStream);

            if (flushResult.Failed())
                return new Exceptional<DBObjectStream>(flushResult);

            #region Check for existing object - might be removed at some time

            //var exists = ObjectExistsOnFS(_NewDBObjectStream);

            //if (exists.Failed())
            //    return new Exceptional<DBObjectStream>(exists);

            //if (exists.Value != Trinary.TRUE)
            //{
            //    return new Exceptional<DBObjectStream>(new Error_UnknownDBError("DBObject with path " + _NewDBObjectStream.ObjectLocation + " does not exist."));
            //}

            #endregion

            #region Add UUID of the new DBObject to all indices of myGraphType

            foreach (var _GraphDBType in _DBContext.DBTypeManager.GetAllParentTypes(myGraphDBType, true, false))
            {
                foreach (var _AAttributeIndex in _GraphDBType.GetAllAttributeIndices(false))
                {
                    //Find out if the dbobject carries all necessary attributes
                    if (_NewDBObjectStream.HasAtLeastOneAttribute(_AAttributeIndex.IndexKeyDefinition.IndexKeyAttributeUUIDs, _GraphDBType, mySessionSettings))
                    {
                        //valid dbo for idx
                        _AAttributeIndex.Insert(_NewDBObjectStream, _GraphDBType, _DBContext);
                    }
                }
            }

            #endregion

            #region add undefined attributes to the object

            if (!myUndefAttributes.IsNullOrEmpty())
            {
                foreach (var item in myUndefAttributes)
                {
                    var addExcept = _NewDBObjectStream.AddUndefinedAttribute(item.Key, item.Value, this);

                    if (addExcept.Failed())
                    {
                        return new Exceptional<DBObjectStream>(addExcept);
                    }
                }
            }

            #endregion

            return new Exceptional<DBObjectStream>(_NewDBObjectStream);
        }
Example #3
0
        private IObject GetDbos(IDChainDefinition myIDChainDefinition, DBObjectStream myDBObjectStream, DBContext dbContext, SessionSettings mySessionToken, DBObjectCache dbObjectCache)
        {
            if (myIDChainDefinition.LastAttribute.IsBackwardEdge)
            {
                var contBackwardExcept = myDBObjectStream.ContainsBackwardEdge(myIDChainDefinition.LastAttribute.BackwardEdgeDefinition, dbContext, dbObjectCache, myIDChainDefinition.LastAttribute.GetRelatedType(dbContext.DBTypeManager));

                if (contBackwardExcept.Failed())
                    throw new GraphDBException(contBackwardExcept.IErrors);

                if (contBackwardExcept.Value)
                {
                    var beStream = dbObjectCache.LoadDBBackwardEdgeStream(myIDChainDefinition.LastType, myDBObjectStream.ObjectUUID).Value;
                    if (beStream.ContainsBackwardEdge(myIDChainDefinition.LastAttribute.BackwardEdgeDefinition))
                        return beStream.GetBackwardEdges(myIDChainDefinition.LastAttribute.BackwardEdgeDefinition);
                    else
                        return null;
                }
                else
                {
                    return null;
                }
            }
            else
            {
                if (myIDChainDefinition.LastAttribute.KindOfType == KindsOfType.SpecialAttribute)
                {
                    return myDBObjectStream.GetAttribute(myIDChainDefinition.LastAttribute.UUID, myIDChainDefinition.LastAttribute.GetRelatedType(dbContext.DBTypeManager), dbContext);
                }
                else
                {
                    return myDBObjectStream.GetAttribute(myIDChainDefinition.LastAttribute.UUID);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Removes a DBObject.
        /// </summary>
        /// <param name="myGraphType">The Type of the DBObject that is to be removed.</param>
        /// <param name="myDBObject">The UUID of the DBObject.</param>
        public Exceptional RemoveDBObject(GraphDBType myTypeOfDBObject, DBObjectStream myDBObject, DBObjectCache myDBObjectCache, SessionSettings myToken)
        {
            #region Input exceptions

            if (myTypeOfDBObject == null)
            {
                return new Exceptional(new Error_ArgumentNullOrEmpty("myTypeOfDBObject"));
            }
            if (myDBObject == null)
            {
                return new Exceptional(new Error_ArgumentNullOrEmpty("myUUID"));
            }

            #endregion

            #region Data

            ObjectLocation myDBObjectLocation;

            #endregion

            // Get DBObject path
            myDBObjectLocation = myDBObject.ObjectLocation;

            #region remove from attributeIDX

            foreach (var anIndex in myTypeOfDBObject.GetAllAttributeIndices(false))
            {
                anIndex.Remove(myDBObject, myTypeOfDBObject, _DBContext);
            }

            #endregion

            #region remove from fs

            #region Remove DBOBJECTSTREAM

            var _RemoveObjectExceptional = _IGraphFSSession.RemoveObjectIfExists(myDBObjectLocation, DBConstants.DBOBJECTSTREAM);
            if (_RemoveObjectExceptional.Failed())
            {
                return _RemoveObjectExceptional;
            }

            #endregion

            #region Remove DBBACKWARDEDGESTREAM

            _RemoveObjectExceptional = _IGraphFSSession.RemoveObjectIfExists(myDBObjectLocation, DBConstants.DBBACKWARDEDGESTREAM);
            if (_RemoveObjectExceptional.Failed())
            {
                return _RemoveObjectExceptional;
            }

            #endregion

            #region Remove UNDEFATTRIBUTESSTREAM

            _RemoveObjectExceptional = _IGraphFSSession.RemoveObjectIfExists(myDBObjectLocation, DBConstants.UNDEFATTRIBUTESSTREAM);
            if (_RemoveObjectExceptional.Failed())
            {
                return _RemoveObjectExceptional;
            }

            #endregion

            #endregion

            return Exceptional.OK;
        }
Example #5
0
        private Exceptional<Boolean> GetComplexMatch(IEnumerable<Tuple<GraphDBType, AAttributeIndex>> myIDX, Dictionary<DBObjectStream, AOperationDefinition> operands, DBObjectCache dbObjectCache, IDChainDefinition primIDNode, IDChainDefinition operandIDNode, DBContext dbContext, TypesOfAssociativity associativity, ref IExpressionGraph resultGraph, SessionSettings mySessionToken)
        {
            LevelKey primLevelKey = CreateLevelKey(primIDNode, dbContext.DBTypeManager);
            LevelKey operandLevelKey = CreateLevelKey(operandIDNode, dbContext.DBTypeManager);

            foreach (var aIDX in myIDX)
            {
                if (aIDX.Item2.IsUUIDIndex)
                {
                    #region UUID idx

                    var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(aIDX.Item2.IndexRelatedTypeUUID);

                    foreach (var aOperand in operands)
                    {

                        foreach (var _ObjectUUIDs in ((UUIDIndex)aIDX.Item2).GetAllUUIDs(currentIndexRelatedType, dbContext))
                        {
                            var DBObjectStream = dbObjectCache.LoadDBObjectStream(aIDX.Item1, _ObjectUUIDs);
                            if (DBObjectStream.Failed())
                            {
                                return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                            }

                            if (IsValidDBObjectStreamForBinExpr(DBObjectStream.Value, primIDNode.LastAttribute, dbContext.DBTypeManager))
                            {
                                var aCtype = GraphDBTypeMapper.ConvertGraph2CSharp(primIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);
                                IObject dbos = GetDbos(primIDNode, DBObjectStream.Value, dbContext, mySessionToken, dbObjectCache);

                                Exceptional<AOperationDefinition> tempResult;
                                if (aCtype == BasicType.SetOfDBObjects)
                                {
                                    tempResult = this.SimpleOperation(new TupleDefinition(aCtype, dbos, primIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager)), aOperand.Value, TypesOfBinaryExpression.Complex);
                                }
                                else
                                {
                                    tempResult = this.SimpleOperation(new ValueDefinition(aCtype, dbos), aOperand.Value, TypesOfBinaryExpression.Complex);

                                }

                                if (tempResult.Failed())
                                    return new Exceptional<bool>(tempResult);

                                var tempOperatorResult = ((ValueDefinition)tempResult.Value);

                                if ((Boolean)tempOperatorResult.Value.Value)
                                {
                                    switch (associativity)
                                    {
                                        case TypesOfAssociativity.Neutral:
                                        case TypesOfAssociativity.Left:

                                            IntegrateInGraph(aOperand.Key, resultGraph, operandLevelKey, dbContext, dbObjectCache);

                                            break;
                                        case TypesOfAssociativity.Right:

                                            IntegrateInGraph(DBObjectStream.Value, resultGraph, primLevelKey, dbContext, dbObjectCache);

                                            break;
                                        default:

                                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                    }
                                }
                            }
                        }
                    }

                    #endregion
                }
                else
                {
                    return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                }
            }

            return new Exceptional<bool>(true);
        }
Example #6
0
        private ValueDefinition GetCorrectValueDefinition(TypeAttribute typeAttribute, GraphDBType graphDBType, ValueDefinition myValueDefinition, DBContext dbContext, SessionSettings mySessionsInfos)
        {
            if (typeAttribute.IsBackwardEdge)
            {
                return GetCorrectValueDefinition(dbContext.DBTypeManager.GetTypeByUUID(typeAttribute.BackwardEdgeDefinition.TypeUUID).GetTypeAttributeByUUID(typeAttribute.BackwardEdgeDefinition.AttrUUID), graphDBType, myValueDefinition, dbContext, mySessionsInfos);
            }
            else
            {
                if (typeAttribute is ASpecialTypeAttribute && typeAttribute.UUID == SpecialTypeAttribute_UUID.AttributeUUID)
                {
                    //var uuid = SpecialTypeAttribute_UUID.ConvertToUUID(atomValue.Value.Value.ToString(), graphDBType, mySessionsInfos, dbContext.DBTypeManager);

                    //if (uuid.Failed())
                    //{
                    //    throw new GraphDBException(uuid.Errors);
                    //}
                    //return new AtomValue(new DBReference(uuid.Value));
                    return new ValueDefinition(new DBReference(ObjectUUID.FromString(myValueDefinition.Value.Value.ToString())));
                }
                else if (!typeAttribute.GetDBType(dbContext.DBTypeManager).IsUserDefined)
                {
                    return new ValueDefinition(GraphDBTypeMapper.GetADBBaseObjectFromUUID(typeAttribute.DBTypeUUID, myValueDefinition.Value));
                }
                else
                {
                    throw new GraphDBException(new Error_InvalidAttributeValue(typeAttribute.Name, myValueDefinition.Value));
                }
            }
        }
Example #7
0
        /// <summary>
        /// This method checks and integrates a DBObjectStream into the result graph.
        /// </summary>
        /// <param name="myData">The DataContainer.</param>
        /// <param name="myTypeManager">The TypeManager of the database.</param>
        /// <param name="myQueryCache">The current query cache.</param>
        /// <param name="myTypeOfBinExpr">The kind of the binary expression.</param>
        /// <param name="myResultGraph">The resulting IExpressionGraph.</param>
        /// <param name="myDBObjectStream">The DBObjectStream.</param>
        private Exceptional<object> CheckAndIntegrateDBObjectStream(DataContainer myData, DBContext myTypeManager, DBObjectCache myQueryCache, TypesOfBinaryExpression myTypeOfBinExpr, IExpressionGraph myResultGraph, DBObjectStream myDBObjectStream, LevelKey myLevelKey, SessionSettings mySessionToken)
        {
            //get the operand
            var operand = GetOperand(myData.IDChainDefinitions.Item1, myData.Extraordinaries.Item1, myTypeManager, myDBObjectStream, myQueryCache, mySessionToken);

            if(operand == null)
            {
                return new Exceptional<object>();
            }

            if (operand.Failed())
            {
                return new Exceptional<object>(operand);
            }

            Exceptional<AOperationDefinition> tempSimpleOperationResult;

            switch (myTypeOfBinExpr)
            {

                case TypesOfBinaryExpression.LeftComplex:

                    tempSimpleOperationResult = this.SimpleOperation(operand.Value, ((AOperationDefinition)myData.Operands.Item1), myTypeOfBinExpr);

                    break;
                case TypesOfBinaryExpression.RightComplex:

                    tempSimpleOperationResult = this.SimpleOperation(((AOperationDefinition)myData.Operands.Item1), operand.Value, myTypeOfBinExpr);

                    break;

                case TypesOfBinaryExpression.Complex:
                case TypesOfBinaryExpression.Atom:
                default:

                    throw new ArgumentException();
            }

            if (tempSimpleOperationResult.Failed())
            {
                return new Exceptional<object>(tempSimpleOperationResult);
            }

            var tempOperatorResult = ((ValueDefinition)tempSimpleOperationResult.Value);

            if ((Boolean)tempOperatorResult.Value.Value)
            {
                IntegrateInGraph(myDBObjectStream, myResultGraph, myLevelKey, myTypeManager, myQueryCache);
            }
            //else
            //{
            //    /// We need to add an empty level in case, the DBO should not be integerated. Otherwise the select does not know, either the level was never touched or
            //    /// not added due to an expression
            //    ExcludeFromGraph(myDBObjectStream, myResultGraph, myLevelKey, myTypeManager, myQueryCache);
            //}

            return new Exceptional<object>();
        }
Example #8
0
        /// <summary>
        /// Extracts data for a binary expression
        /// </summary>
        /// <param name="myComplexValue">The complex part of the binary expression.</param>
        /// <param name="mySimpleValue">The simple/atomic part of the expression.</param>
        /// <param name="errors">The list of errors.</param>
        /// <param name="typeOfBinExpr">The kind of the binary expression</param>
        /// <returns>A data tuple.</returns>
        private Exceptional<DataContainer> ExtractData(AExpressionDefinition myComplexValue, AExpressionDefinition mySimpleValue, ref TypesOfBinaryExpression typeOfBinExpr, DBObjectCache myDBObjectCache, SessionSettings mySessionToken, DBContext dbContext, Boolean aggregateAllowed)
        {
            #region data

            //the complex IDNode (sth. like U.Age or Count(U.Friends))
            IDChainDefinition complexIDNode = null;

            //the value that is on the opposite of the complex IDNode
            AExpressionDefinition simpleValue = null;

            //a complex IDNode may result in a complexValue (i.e. Count(U.Friends) --> 3)
            AExpressionDefinition complexValue = null;

            //reference to former myComplexValue
            AExpressionDefinition extraordinaryValue = null;

            #endregion

            #region extraction

            if (myComplexValue is IDChainDefinition)
            {
                #region IDNode

                #region Data

                complexIDNode = (IDChainDefinition)myComplexValue;
                var validateResult = complexIDNode.Validate(dbContext, false);
                if (validateResult.Failed())
                {
                    return new Exceptional<DataContainer>(validateResult);
                }

                if (complexIDNode.Any(id => id is ChainPartFuncDefinition))
                {
                    if (complexIDNode.Edges.IsNullOrEmpty())
                    {
                        #region parameterless function

                        var fcn = (complexIDNode.First(id => id is ChainPartFuncDefinition) as ChainPartFuncDefinition);

                        // somes functions (aggregates) like SUM are not valid for where expressions, though they are not resolved
                        if (fcn.Function == null)
                            return new Exceptional<DataContainer>(new Error_FunctionDoesNotExist(fcn.FuncName));

                        Exceptional<FuncParameter> pResult = fcn.Function.ExecFunc(dbContext);
                        if (pResult.Failed())
                        {
                            return new Exceptional<DataContainer>(pResult);
                        }

                        //simpleValue = new AtomValue(fcn.Function.TypeOfResult, ((FuncParameter)pResult.Value).Value); //the new simple value extraced from the function
                        simpleValue = new ValueDefinition(((FuncParameter)pResult.Value).Value);
                        typeOfBinExpr = TypesOfBinaryExpression.Unknown; //we do not know if we are left or right associated
                        complexIDNode = null; //we resolved it... so it's null

                        #endregion
                    }
                    else
                    {
                        //extraordinaryValue = (complexIDNode.First(id => id is ChainPartFuncDefinition) as ChainPartFuncDefinition);
                        extraordinaryValue = complexIDNode;

                        if (mySimpleValue is ValueDefinition)
                        {
                            simpleValue = mySimpleValue;
                        }
                    }
                }
                else
                {
                    if(mySimpleValue is ValueDefinition)
                    {
                        try
                        {
                            if (complexIDNode.IsUndefinedAttribute)
                            {
                                throw new GraphDBException(new Error_AttributeIsNotDefined(complexIDNode.UndefinedAttribute));
                            }

                            simpleValue = GetCorrectValueDefinition(complexIDNode.LastAttribute, complexIDNode.LastType, ((ValueDefinition)mySimpleValue), dbContext, mySessionToken);
                        }
                        catch (FormatException)
                        {
                            return new Exceptional<DataContainer>(new Error_DataTypeDoesNotMatch(complexIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager).Name, ((ValueDefinition)mySimpleValue).Value.ObjectName));
                        }
                    }
                    else
                    {
                        if (mySimpleValue is TupleDefinition)
                        {
                            ((TupleDefinition)mySimpleValue).ConvertToAttributeType(complexIDNode.LastAttribute, dbContext);

                            simpleValue = mySimpleValue;
                        }
                        //else if (mySimpleValue is TupleNode)
                        //{
                        //    var simpleValE = (mySimpleValue as TupleNode).GetAsTupleValue(dbContext, complexIDNode.LastAttribute);
                        //    if (!simpleValE.Success())
                        //    {
                        //        return new Exceptional<DataContainer>(simpleValE);
                        //    }
                        //    simpleValue = simpleValE.Value;
                        //}
                        else
                        {
                            //return new Exceptional<DataContainer>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                        }
                    }
                }

                #endregion

                #endregion
            }
            else if (myComplexValue is TupleDefinition)
            {
                #region TupleSetNode

                complexValue = ((TupleDefinition)myComplexValue);
                simpleValue = mySimpleValue;
                typeOfBinExpr = TypesOfBinaryExpression.Atom;

                #endregion
            }
            else if (myComplexValue is AggregateDefinition)
            {
                #region AggregateNode

                if (aggregateAllowed)
                {
                    if (((AggregateDefinition)myComplexValue).ChainPartAggregateDefinition.Parameters.Count != 1)
                    {
                        return new Exceptional<DataContainer>(new Error_ArgumentException("An aggregate must have exactly one expression."));
                    }

                    if (!(((AggregateDefinition)myComplexValue).ChainPartAggregateDefinition.Parameters[0] is IDChainDefinition))
                    {
                       return new Exceptional<DataContainer>(new Error_ArgumentException("An aggregate must have exactly one IDNode."));
                    }

                    #region Data

                    complexIDNode = (((AggregateDefinition)myComplexValue).ChainPartAggregateDefinition.Parameters[0] as IDChainDefinition);

                    if (complexIDNode == null)
                    {
                        return new Exceptional<DataContainer>(new Error_InvalidIDNode("Only single IDNodes are currently allowed in aggregates!"));
                    }

                    #endregion

                    #region values

                    simpleValue = mySimpleValue;
                    extraordinaryValue = myComplexValue;

                    #endregion
                }
                else
                {
                    return new Exceptional<DataContainer>(new Error_AggregateNotAllowed(((AggregateDefinition)myComplexValue).ChainPartAggregateDefinition));
                }
                #endregion
            }
            else
            {
                return new Exceptional<DataContainer>(new Error_NotImplementedExpressionNode(myComplexValue.GetType()));
            }

            #endregion

            return new Exceptional<DataContainer>(new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(complexIDNode, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(simpleValue, complexValue), new Tuple<AExpressionDefinition, AExpressionDefinition>(extraordinaryValue, null)));
        }
Example #9
0
        /// <param name="data">The DataContainer.</param>
        /// <param name="dbContext">The TypeManager of the database.</param>
        /// <param name="queryCache">The current query cache.</param>
        /// <param name="typeOfBinExpr">The type of the binary expression.</param>
        /// <param name="idx">The index for the complex part.</param>
        /// <param name="errors">A list of errors.</param>
        /// <param name="resultGraph">The IExpressionGraph that serves as result.</param>
        /// <returns>True if the method succeeded</returns>
        private Exceptional<Boolean> MatchData(DataContainer data, DBContext dbContext, DBObjectCache dbObjectCache, TypesOfBinaryExpression typeOfBinExpr, IEnumerable<Tuple<GraphDBType, AAttributeIndex>> idx, IExpressionGraph resultGraph, SessionSettings mySessionToken)
        {
            #region data

            LevelKey myLevelKey = CreateLevelKey(data.IDChainDefinitions.Item1, dbContext.DBTypeManager);

            #endregion

            foreach (var aIDX in idx)
            {

                //this is only for such type(DBVertex) that have no AAttributeIndex
                if (aIDX.Item2 == null)
                {
                    continue;
                }

                #region Execution

                if (aIDX.Item2.IsUUIDIndex && (data.IDChainDefinitions.Item1.LastAttribute != dbContext.DBTypeManager.GetUUIDTypeAttribute()))
                {
                    #region UUID idx - check ALL DBOs

                    var IndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(aIDX.Item2.IndexRelatedTypeUUID);

                    var idxKeyValues = (aIDX.Item2).GetAllValues(IndexRelatedType, dbContext);
                    if (idxKeyValues.CountIs(0))
                    {
                        continue;
                    }

                    var uuids = idxKeyValues.Aggregate((elem, aggrresult) => aggrresult.Union(elem));

                    var result = IntegrateUUID(data, dbContext, dbObjectCache, typeOfBinExpr, resultGraph, mySessionToken, myLevelKey, dbObjectCache.LoadListOfDBObjectStreams(aIDX.Item1, uuids));
                    if (result.Failed())
                    {
                        return new Exceptional<bool>(result);
                    }

                    if (resultGraph.ContainsLevelKey(myLevelKey))
                    {
                        #region clean lower levels

                        if (Type == TypesOfOperators.AffectsLowerLevels)
                        {
                            CleanLowerLevel(myLevelKey, dbContext, dbObjectCache, resultGraph);
                        }

                        #endregion

                    }
                    else
                    {
                        resultGraph.AddEmptyLevel(myLevelKey);
                    }

                    #endregion
                }
                else
                {

                    #region Get operationValue and type

                    var operationValue = (AOperationDefinition)data.Operands.Item1;

                    #endregion

                    #region Attribute index

                    if (aIDX.Item2.IndexKeyDefinition.IndexKeyAttributeUUIDs.Count > 1)
                    {
                        return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), "Currently it is not implemented to use compound indices."));
                    }

                    var interestingUUIDsByIdx = IndexSingleOperation(aIDX.Item2, operationValue, data.IDChainDefinitions.Item1.LastAttribute.UUID, typeOfBinExpr, dbContext);

                    #region integrate in graph

                    var runMT = DBConstants.RunMT;

                    if (runMT)
                    {
                        Parallel.ForEach(dbObjectCache.LoadListOfDBObjectStreams(data.IDChainDefinitions.Item1.LastType, interestingUUIDsByIdx), aDBO =>
                        {
                            IntegrateInGraph(aDBO.Value, resultGraph, myLevelKey, dbContext, dbObjectCache);
                        }
                        );
                    }
                    else
                    {
                        foreach (var aDBO in dbObjectCache.LoadListOfDBObjectStreams(data.IDChainDefinitions.Item1.LastType, interestingUUIDsByIdx))
                        {
                            IntegrateInGraph(aDBO.Value, resultGraph, myLevelKey, dbContext, dbObjectCache);
                        }
                    }

                    #endregion

                    if (resultGraph.ContainsLevelKey(myLevelKey))
                    {
                        #region clean lower levels

                        if (Type == TypesOfOperators.AffectsLowerLevels)
                        {
                            CleanLowerLevel(myLevelKey, dbContext, dbObjectCache, resultGraph);
                        }

                        #endregion

                    }
                    else
                    {
                        resultGraph.AddEmptyLevel(myLevelKey);
                    }

                    #endregion
                }

                #endregion
            }

            return new Exceptional<bool>(true);
        }
Example #10
0
        private Exceptional<Boolean> MatchComplexData(TypesOfAssociativity associativity, DataContainer data, DBContext dbContext, DBObjectCache dbObjectCache, TypesOfBinaryExpression typeOfBinExpr, IEnumerable<Tuple<GraphDBType, AAttributeIndex>> leftIndices, IEnumerable<Tuple<GraphDBType, AAttributeIndex>> rightIndices, ref List<GraphDBError> errors, ref IExpressionGraph result, SessionSettings mySessionToken)
        {
            #region data

            Dictionary<DBObjectStream, AOperationDefinition> operandsLeft = null;
            Dictionary<DBObjectStream, AOperationDefinition> operandsRight = null;

            #endregion

            #region handle extraordinaries

            if (data.Extraordinaries.Item1 != null)
            {
                #region left extraordinary
                //there is something like a function or so

                operandsLeft = new Dictionary<DBObjectStream, AOperationDefinition>();

                //we have to calculate the real operand.
                //TODO: try to use attribute idx instead of uuid idx

                foreach (var aLeftIDX in leftIndices)
                {
                    AAttributeIndex currentLeftIdx = null;

                    #region get UUID idx
                    if (!(aLeftIDX.Item2.IsUUIDIndex))
                    {
                        currentLeftIdx = aLeftIDX.Item1.GetUUIDIndex(dbContext);
                    }
                    else
                    {
                        currentLeftIdx = aLeftIDX.Item2;
                    }

                    #endregion

                    var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(currentLeftIdx.IndexRelatedTypeUUID);

                    foreach (var aObjectUUIDs_Left in currentLeftIdx.GetAllValues(currentIndexRelatedType, dbContext))
                    {
                        foreach (var aObjectUUID_Left in aObjectUUIDs_Left)
                        {
                            var leftDBObject = dbObjectCache.LoadDBObjectStream(aLeftIDX.Item1, aObjectUUID_Left);
                            if (leftDBObject.Failed())
                            {
                                throw new NotImplementedException();
                            }

                            if (IsValidDBObjectStreamForBinExpr(leftDBObject.Value, data.IDChainDefinitions.Item1.LastAttribute, dbContext.DBTypeManager))
                            {
                                var oper = GetOperand(data.IDChainDefinitions.Item1, data.Extraordinaries.Item1, dbContext, leftDBObject.Value, dbObjectCache, mySessionToken);
                                if (oper.Failed())
                                    return new Exceptional<bool>(oper);

                                if (oper != null)
                                {
                                    operandsLeft.Add(leftDBObject.Value, oper.Value);
                                }
                            }
                        }
                    }
                }

                //from now on the binary expression is right complex, because there are atom values on the left
                typeOfBinExpr = TypesOfBinaryExpression.RightComplex;

                #endregion
            }

            if (data.Extraordinaries.Item2 != null)
            {
                #region right extraordinary
                //there is something like a function or so
                operandsRight = new Dictionary<DBObjectStream, AOperationDefinition>();

                foreach (var aRightIDX in rightIndices)
                {
                    AAttributeIndex currentRightIdx = null;

                    #region get UUID idx
                    //we have to calculate the real operand.
                    //TODO: try to use attribute idx instead of uuid idx

                    if (!(aRightIDX.Item2.IsUUIDIndex))
                    {
                        currentRightIdx = aRightIDX.Item1.GetUUIDIndex(dbContext);
                    }
                    else
                    {
                        currentRightIdx = aRightIDX.Item2;
                    }

                    #endregion

                    var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(currentRightIdx.IndexRelatedTypeUUID);

                    foreach (var aObjectUUIDs_Right in currentRightIdx.GetAllValues(currentIndexRelatedType, dbContext))
                    {
                        foreach (var aObjectUUID_Right in aObjectUUIDs_Right)
                        {
                            var rightDBObject = dbObjectCache.LoadDBObjectStream(aRightIDX.Item1, aObjectUUID_Right);
                            if (rightDBObject.Failed())
                            {
                                throw new NotImplementedException();
                            }

                            if (IsValidDBObjectStreamForBinExpr(rightDBObject.Value, data.IDChainDefinitions.Item2.LastAttribute, dbContext.DBTypeManager))
                            {
                                var oper = GetOperand(data.IDChainDefinitions.Item2, data.Extraordinaries.Item2, dbContext, rightDBObject.Value, dbObjectCache, mySessionToken);
                                if (oper.Failed())
                                    return new Exceptional<bool>(oper);

                                if (oper != null)
                                {
                                    operandsRight.Add(rightDBObject.Value, oper.Value);
                                }
                            }
                        }
                    }
                }

                if (typeOfBinExpr == TypesOfBinaryExpression.RightComplex)
                {
                    typeOfBinExpr = TypesOfBinaryExpression.Atom;
                }

                #endregion
            }

            #endregion

            switch (typeOfBinExpr)
            {
                case TypesOfBinaryExpression.Atom:

                    #region atom

                    switch (associativity)
                    {
                        case TypesOfAssociativity.Unknown:
                        case TypesOfAssociativity.Neutral:
                            GetComplexAtom(dbContext, operandsLeft, operandsRight, data.IDChainDefinitions.Item1, dbObjectCache, ref result);
                            GetComplexAtom(dbContext, operandsRight, operandsLeft, data.IDChainDefinitions.Item2, dbObjectCache, ref result);
                            break;

                        case TypesOfAssociativity.Left:

                            GetComplexAtom(dbContext, operandsLeft, operandsRight, data.IDChainDefinitions.Item1, dbObjectCache, ref result);

                            break;
                        case TypesOfAssociativity.Right:

                            GetComplexAtom(dbContext, operandsRight, operandsLeft, data.IDChainDefinitions.Item2, dbObjectCache, ref result);

                            break;

                        default:
                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                    }

                    #endregion

                    break;
                case TypesOfBinaryExpression.LeftComplex:

                    #region Left complex

                    GetComplexMatch(leftIndices, operandsRight, dbObjectCache, data.IDChainDefinitions.Item1, data.IDChainDefinitions.Item2, dbContext, associativity, ref result, mySessionToken);

                    #endregion

                    break;
                case TypesOfBinaryExpression.RightComplex:

                    #region Right complex

                    GetComplexMatch(rightIndices, operandsLeft, dbObjectCache, data.IDChainDefinitions.Item2, data.IDChainDefinitions.Item1, dbContext, associativity, ref result, mySessionToken);

                    #endregion

                    break;
                case TypesOfBinaryExpression.Complex:

                    #region Complex

                    LevelKey leftLevelKey = CreateLevelKey(data.IDChainDefinitions.Item1, dbContext.DBTypeManager);
                    LevelKey rightLevelKey = CreateLevelKey(data.IDChainDefinitions.Item2, dbContext.DBTypeManager);
                    GraphDBType leftGraphDBType = data.IDChainDefinitions.Item1.LastType;
                    GraphDBType rightGraphDBType = data.IDChainDefinitions.Item2.LastType;

                    #region exception

                    if (leftIndices.CountIsGreater(1) || rightIndices.CountIsGreater(1))
                    {
                        return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                    }

                    #endregion

                    var leftIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(leftIndices.First().Item2.IndexRelatedTypeUUID);
                    var rightIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(rightIndices.First().Item2.IndexRelatedTypeUUID);

                    foreach (var ObjectUUIDs_left in leftIndices.First().Item2.GetAllValues(leftIndexRelatedType, dbContext))
                    {
                        foreach (var aLeftUUID in ObjectUUIDs_left)
                        {
                            var leftDBObject = dbObjectCache.LoadDBObjectStream(leftIndices.First().Item1, aLeftUUID);
                            if (leftDBObject.Failed())
                            {
                                return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                            }

                            if (IsValidDBObjectStreamForBinExpr(leftDBObject.Value, data.IDChainDefinitions.Item1.LastAttribute, dbContext.DBTypeManager))
                            {

                                foreach (var ObjectUUIDs_right in rightIndices.First().Item2.GetAllValues(rightIndexRelatedType, dbContext))
                                {
                                    foreach (var aRightUUID in ObjectUUIDs_right)
                                    {

                                        var rightDBObject = dbObjectCache.LoadDBObjectStream(rightIndices.First().Item1, aRightUUID);
                                        if (rightDBObject.Failed())
                                        {
                                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                        }

                                        if (IsValidDBObjectStreamForBinExpr(rightDBObject.Value, data.IDChainDefinitions.Item2.LastAttribute, dbContext.DBTypeManager))
                                        {
                                            //everything is valid

                                            var leftType = GraphDBTypeMapper.ConvertGraph2CSharp(data.IDChainDefinitions.Item1.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);
                                            var rightType = GraphDBTypeMapper.ConvertGraph2CSharp(data.IDChainDefinitions.Item2.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);

                                            AOperationDefinition leftValue;
                                            AOperationDefinition rightValue;

                                            if (data.IDChainDefinitions.Item1.LastAttribute.KindOfType == KindsOfType.SetOfReferences
                                                || data.IDChainDefinitions.Item1.LastAttribute.KindOfType == KindsOfType.ListOfNoneReferences || data.IDChainDefinitions.Item1.LastAttribute.KindOfType == KindsOfType.SetOfNoneReferences)
                                                leftValue = new TupleDefinition(leftType, leftDBObject.Value.GetAttribute(data.IDChainDefinitions.Item1.LastAttribute.UUID), data.IDChainDefinitions.Item1.LastAttribute.GetDBType(dbContext.DBTypeManager));
                                            else
                                                leftValue = new ValueDefinition(leftType, leftDBObject.Value.GetAttribute(data.IDChainDefinitions.Item1.LastAttribute.UUID, data.IDChainDefinitions.Item1.LastAttribute.GetRelatedType(dbContext.DBTypeManager), dbContext));

                                            if (data.IDChainDefinitions.Item2.LastAttribute.KindOfType == KindsOfType.SetOfReferences
                                                || data.IDChainDefinitions.Item2.LastAttribute.KindOfType == KindsOfType.ListOfNoneReferences || data.IDChainDefinitions.Item2.LastAttribute.KindOfType == KindsOfType.SetOfNoneReferences)
                                                rightValue = new TupleDefinition(rightType, rightDBObject.Value.GetAttribute(data.IDChainDefinitions.Item2.LastAttribute.UUID), data.IDChainDefinitions.Item2.LastAttribute.GetDBType(dbContext.DBTypeManager));
                                            else
                                                rightValue = new ValueDefinition(rightType, rightDBObject.Value.GetAttribute(data.IDChainDefinitions.Item2.LastAttribute.UUID, data.IDChainDefinitions.Item2.LastAttribute.GetRelatedType(dbContext.DBTypeManager), dbContext));

                                            var tempSimpleOperationResult = this.SimpleOperation(leftValue, rightValue, typeOfBinExpr);
                                            if (tempSimpleOperationResult.Failed())
                                                return new Exceptional<bool>(tempSimpleOperationResult);

                                            var tempOperatorResult = tempSimpleOperationResult.Value;

                                            if ((Boolean)(tempOperatorResult as ValueDefinition).Value.Value)
                                            {
                                                //found sth that is really true

                                                #region insert into graph

                                                switch (associativity)
                                                {
                                                    case TypesOfAssociativity.Neutral:
                                                    case TypesOfAssociativity.Left:

                                                        IntegrateInGraph(leftDBObject.Value, result, leftLevelKey, dbContext, dbObjectCache);

                                                        break;
                                                    case TypesOfAssociativity.Right:

                                                        IntegrateInGraph(rightDBObject.Value, result, rightLevelKey, dbContext, dbObjectCache);

                                                        break;
                                                    case TypesOfAssociativity.Unknown:

                                                        if (Type == TypesOfOperators.AffectsLowerLevels)
                                                        {
                                                            result.AddNodesWithComplexRelation(leftDBObject, leftLevelKey, rightDBObject, rightLevelKey, dbObjectCache, 1);
                                                        }
                                                        else
                                                        {
                                                            result.AddNodesWithComplexRelation(leftDBObject, leftLevelKey, rightDBObject, rightLevelKey, dbObjectCache, 0);
                                                        }

                                                        break;
                                                    default:

                                                        return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                                }

                                                #endregion
                                            }
                                        }
                                    }
                                }

                                #region clean lower levels

                                if (Type == TypesOfOperators.AffectsLowerLevels)
                                {
                                    switch (associativity)
                                    {
                                        case TypesOfAssociativity.Neutral:
                                        case TypesOfAssociativity.Left:

                                            CleanLowerLevel(leftLevelKey, dbContext, dbObjectCache, result);

                                            break;
                                        case TypesOfAssociativity.Right:

                                            CleanLowerLevel(rightLevelKey, dbContext, dbObjectCache, result);

                                            break;
                                        case TypesOfAssociativity.Unknown:

                                            CleanLowerLevel(leftLevelKey, dbContext, dbObjectCache, result);
                                            CleanLowerLevel(rightLevelKey, dbContext, dbObjectCache, result);

                                            break;
                                        default:

                                            return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                                    }
                                }

                                #endregion
                            }
                        }
                    }

                    #endregion

                    break;
                default:

                    return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
            }

            return new Exceptional<bool>(true);
        }
Example #11
0
        private Exceptional<object> IntegrateUUID(DataContainer data, DBContext dbContext, DBObjectCache dbObjectCache, TypesOfBinaryExpression typeOfBinExpr, IExpressionGraph resultGraph, SessionSettings mySessionToken, LevelKey myLevelKey, IEnumerable<Exceptional<DBObjectStream>> myDBObjects)
        {
            foreach (var aDBO in myDBObjects)
            {
                if (aDBO.Failed())
                {
                    return new Exceptional<object>(aDBO);
                }

                if (IsValidDBObjectStreamForBinExpr(aDBO.Value, data.IDChainDefinitions.Item1.LastAttribute, dbContext.DBTypeManager))
                {
                    //check and integrate
                    var result = CheckAndIntegrateDBObjectStream(data, dbContext, dbObjectCache, typeOfBinExpr, resultGraph, aDBO.Value, myLevelKey, mySessionToken);
                    if(!result.Success())
                    {
                        return new Exceptional<object>(result);
                    }
                }
            }

            return new Exceptional<object>();
        }
Example #12
0
        /// <summary>
        /// This method extracts an IOperationValue out of a DBObjectStream.
        /// </summary>
        /// <param name="myIDChainDefinition">The corresponding IDNode.</param>
        /// <param name="myExtraordinary">Sth extraordinary like an aggregate or function call.</param>
        /// <param name="dbContext">The TypeManager of the database.</param>
        /// <param name="myDBObjectStream">The DBObjectStream.</param>
        /// <returns>An IOperationValue.</returns>
        private Exceptional<AOperationDefinition> GetOperand(IDChainDefinition myIDChainDefinition, AExpressionDefinition myExtraordinary, DBContext dbContext, DBObjectStream myDBObjectStream, DBObjectCache dbObjectCache, SessionSettings mySessionToken)
        {
            var aCtype = GraphDBTypeMapper.ConvertGraph2CSharp(myIDChainDefinition.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);
            IObject dbos = GetDbos(myIDChainDefinition, myDBObjectStream, dbContext, mySessionToken, dbObjectCache);

            if (dbos == null)
            {
                return null;
            }

            AOperationDefinition operand = null;

            if (myExtraordinary != null)
            {
                #region extraordinary

                if (myExtraordinary is AggregateDefinition)
                {
                    System.Diagnostics.Debug.Assert(false);

                    //var aggrNode = ((AggregateDefinition)myExtraordinary).ChainPartAggregateDefinition;

                    //aggrNode.Validate(dbContext);

                    ////result of aggregate
                    //var pResult = aggrNode.Aggregate.Aggregate(dbos, myIDChainDefinition.LastAttribute, dbContext);
                    //if (pResult.Failed())
                    //    return new Exceptional<AOperationDefinition>(pResult);

                    //aCtype = aggrNode.Aggregate.TypeOfResult;
                    //operand = new ValueDefinition(aggrNode.Aggregate.TypeOfResult, pResult.Value);
                }
                else
                {
                    if (myExtraordinary is IDChainDefinition)
                    {
                        var chainFunc = (myExtraordinary as IDChainDefinition).First(id => id is ChainPartFuncDefinition) as ChainPartFuncDefinition;

                        chainFunc.Validate(dbContext);

                        var func = chainFunc.Function;
                        func.CallingAttribute = myIDChainDefinition.LastAttribute;
                        func.CallingObject = dbos;
                        //result of function

                        var pResult = chainFunc.Execute(myIDChainDefinition.LastAttribute.GetDBType(dbContext.DBTypeManager), myDBObjectStream, myIDChainDefinition.Reference.Item1, dbContext);
                        if (pResult.Failed())
                            return new Exceptional<AOperationDefinition>(pResult);

                        //aCtype = funcCallNode.Function.TypeOfResult;
                        //aCtype = ((FuncParameter)pResult.Value).TypeOfOperatorResult;
                        operand = new ValueDefinition(((FuncParameter)pResult.Value).Value);
                        aCtype = (operand as ValueDefinition).Value.Type;
                    }
                    else
                    {
                    return new Exceptional<AOperationDefinition>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                    }
                }

                #endregion
            }
            else
            {
                #region simple

                if (aCtype == BasicType.SetOfDBObjects)
                {
                    operand = new TupleDefinition(aCtype, dbos, myIDChainDefinition.LastAttribute.GetDBType(dbContext.DBTypeManager));
                }
                else
                {
                    if (dbos is AListOfBaseEdgeType)
                    {
                        operand = new TupleDefinition(aCtype, dbos, myIDChainDefinition.LastAttribute.GetDBType(dbContext.DBTypeManager));
                    }
                    else if (dbos is ADBBaseObject)
                    {
                        operand = new ValueDefinition(dbos as ADBBaseObject);
                    }
                    else
                    {
                        operand = new ValueDefinition(aCtype, dbos);
                    }
                }

                #endregion
            }
            return new Exceptional<AOperationDefinition>(operand);
        }
Example #13
0
 public DBSessionSettings(SessionSettings anotherSettings)
     : base(anotherSettings.GetAllSettings())
 {
 }