120 likes | 128 Views
Explore the concept of constraint databases where logical data representation is achieved through various atomic arithmetic and Boolean constraints, leading to a more abstract level of data modeling.
E N D
2. Constraint Databases Next level of data abstraction: Constraint level– finitely represents by constraints the logical level
2.1 Constraints Arithmetic Atomic Constraints Equality: u = v Inequality: u ≠ v Lower bound: u ≥ b Upper bound: – u ≥ b Order: u ≥ v Gap-order: u – v ≥ b where b ≥ 0 Difference: u – v ≥ b
Half-Addition: ± u ± v ≥ b where b ≥ 0 Addition: ± u ± v ≥ b Linear: c1x1 + ……+ cnxn ≥ b Polynomial: p( x1,……..,xn ) ≥ b Note: Instead of ≥ we can also use >
Boolean Atomic Constraints Boolean Algebra < D, Λ, V, ‘, 0, 1 > D – domain, 0 – zero element, 1 – one element. such that the following axioms hold:
Commutative: x V y = y V x x Λ y = y Λ x Distributive: x V ( y Λ z ) = ( x V y ) Λ ( x V z ) x Λ ( y V z ) = ( x Λ y ) V ( x Λ z ) Inverse: x V x’ = 1 x Λ x’ = 0 Zero and one element properties: x V 0 = x x Λ 1 = x 0 ≠ 1
Boolean equality constraints: T =B 0 Boolean inequality constraints: T ≠B 0 where T is a Boolean term built from domain elements and operations of the boolean algebra. Example: ( x’ Λ z ) V ( y Λ z ) V ( x Λ y’ Λ z’ ) =B 0
Constraint Formulas: • each atomic constraint • if F and G are formulas, then (F and G) is a formula and (F or G) is a formula. • if F is a formula, then (not F) is a formula.
Let F(x1,…,xn) be a formula with n rows, t = (c1,…,cn) a tuple with n constants. t satisfies F (t F) – substituting each xi by ci makes F true.
Interpretation of free Boolean algebra: Symbols are interpreted to be concrete operators or values. Example: D – all subsets of 1 Λ – intersection V – union ‘ – complement 0 – emptyset 1 – set of names of all animals {cat, dog, parrot,…} Question: What would be the meaning of the example Boolean constraint under this interpretation ?
Constants in constraints are also interpreted Example: Suppose we have the constraint b Λ m = 0 and we interpret b as {canary, parrot, falcon} m as {cat, dog} Question: Is the Boolean constraint true under this interpretation ?
2.2 The Constraint Data Model Constraint relation – a finite set of constraint tuples. Constraint tuples – tuples with variables and constraints that restrict the variables. Example: ( i, t : 0 ≤ i , i ≤ 24000, t = 0.15 i ) is a constraint tuple of Taxtable(Income, Tax). It means that the tax is 15% on any income below $24,000.
2.3 Data Abstraction Logical level – infinite relation r, tuple t Constraint level – finite relation R, constraint tuple C, t є r iff t |= C for some C є R Physical level – the way the data is actually stored in the computer system