Download presentation
Presentation is loading. Please wait.
1
1 2. Constraint Databases Next level of data abstraction: Constraint level – finitely represents by constraints the logical level
2
2 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
3
3 Half-Addition: ± u ± v ≥ b where b ≥ 0 Addition: ± u ± v ≥ b Linear: c 1 x 1 + ……+ c n x n ≥ b Polynomial: p( x 1,……..,x n ) ≥ b Note: Instead of ≥ we can also use >
4
4 Boolean Atomic Constraints Boolean Algebra D – domain, 0 – zero element, 1 – one element. such that the following axioms hold:
5
5 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
6
6 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
7
7 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.
8
8 Let F(x 1,…,x n ) be a formula with n rows, t = (c 1,…,c n ) a tuple with n constants. t satisfies F (t F) – substituting each x i by c i makes F true.
9
9 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 ?
10
10 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 ?
11
11 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.
12
12 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.