// <summary> // Fixes the range of the restriction in accordance with <paramref name="range" />. // Member restriction must be complete for this operation. // </summary> internal override DomainBoolExpr FixRange(Set<Constant> range, MemberDomainMap memberDomainMap) { Debug.Assert(IsComplete, "Ranges are fixed only for complete scalar restrictions."); var newPossibleValues = memberDomainMap.GetDomain(RestrictedMemberSlot.MemberPath); BoolLiteral newLiteral = new ScalarRestriction(RestrictedMemberSlot, new Domain(range, newPossibleValues)); return newLiteral.GetDomainBoolExpression(memberDomainMap); }
internal void UpdateWhereClause(MemberDomainMap domainMap) { List <BoolExpression> boolExpressionList = new List <BoolExpression>(); foreach (BoolExpression atom in this.WhereClause.Atoms) { MemberRestriction asLiteral = atom.AsLiteral as MemberRestriction; IEnumerable <Constant> domain = domainMap.GetDomain(asLiteral.RestrictedMemberSlot.MemberPath); MemberRestriction memberRestriction = asLiteral.CreateCompleteMemberRestriction(domain); ScalarRestriction scalarRestriction = asLiteral as ScalarRestriction; bool flag = scalarRestriction != null && !scalarRestriction.Domain.Contains(Constant.Null) && !scalarRestriction.Domain.Contains(Constant.NotNull) && !scalarRestriction.Domain.Contains(Constant.Undefined); if (flag) { domainMap.AddSentinel(memberRestriction.RestrictedMemberSlot.MemberPath); } boolExpressionList.Add(BoolExpression.CreateLiteral((BoolLiteral)memberRestriction, domainMap)); if (flag) { domainMap.RemoveSentinel(memberRestriction.RestrictedMemberSlot.MemberPath); } } if (boolExpressionList.Count <= 0) { return; } this.m_whereClause = BoolExpression.CreateAnd(boolExpressionList.ToArray()); }
// <summary> // Fixes the range of the restriction in accordance with <paramref name="range" />. // Member restriction must be complete for this operation. // </summary> internal override DomainBoolExpr FixRange(Set <Constant> range, MemberDomainMap memberDomainMap) { Debug.Assert(IsComplete, "Ranges are fixed only for complete scalar restrictions."); var newPossibleValues = memberDomainMap.GetDomain(RestrictedMemberSlot.MemberPath); BoolLiteral newLiteral = new ScalarRestriction(RestrictedMemberSlot, new Domain(range, newPossibleValues)); return(newLiteral.GetDomainBoolExpression(memberDomainMap)); }
/// <summary> /// Takes in a JoinTreeNode and a Contition Property Map and creates an BoolExpression /// for the Condition Map. /// </summary> /// <param name="joinTreeNode"> </param> /// <param name="conditionMap"> </param> /// <returns> </returns> private static BoolExpression GetConditionExpression(MemberPath member, StorageConditionPropertyMapping conditionMap) { //Get the member for which the condition is being specified EdmMember conditionMember = (conditionMap.ColumnProperty != null) ? conditionMap.ColumnProperty : conditionMap.EdmProperty; var conditionMemberNode = new MemberPath(member, conditionMember); //Check if this is a IsNull condition MemberRestriction conditionExpression = null; if (conditionMap.IsNull.HasValue) { // for conditions on scalars, create NodeValue nodes, otherwise NodeType var conditionConstant = conditionMap.IsNull.Value ? Constant.Null : Constant.NotNull; if (MetadataHelper.IsNonRefSimpleMember(conditionMember)) { conditionExpression = new ScalarRestriction(conditionMemberNode, conditionConstant); } else { conditionExpression = new TypeRestriction(conditionMemberNode, conditionConstant); } } else { conditionExpression = new ScalarRestriction(conditionMemberNode, new ScalarConstant(conditionMap.Value)); } Debug.Assert(conditionExpression != null); return BoolExpression.CreateLiteral(conditionExpression, null); }