6-Calculus

6-Calculus - CS273 - Data and Knowledge Bases Xifeng Y Xif...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
CS273 - Data and Knowledge Bases Xifeng Yan Computer Science niversity of California at Santa Barbara University of California at Santa Barbara
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Department of Computer Science RELATIONAL CALCULUS Relational algebra is a procedural language, giving the operations to retrieve the data from the database. Relational calculus isa declarative (nonprocedural) query language, indicating the properties of the data to retrieve from the database. Tuple Relational Calculus (TRC) - variables represent tuples omain elational alculus RC) ariables present omains Domain Relational Calculus (DRC) - variables represent domains SQL is declarative, based on tuple relational calculus! CS273: Data and Knowledge Bases | University of California at Santa Barbara 2 slides by courtesy of Y. Chen with modifications
Background image of page 2
Department of Computer Science Outline Tuple Relational Calculus (TRC) Expressions Expressing Relational Algebra Operators Safety Domain Relational Calculus (DRC) CS273: Data and Knowledge Bases | University of California at Santa Barbara 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Department of Computer Science TUPLE RELATIONAL CALCULUS (TRC) {T | cond(T)} "The set of all tuples T that satisfy the condition cond". Formal specification {T 1 .a 1 , T 2 .a 2 , . .., T n .a n | cond(T 1 , . .., T n , T n+1 , . .., T n+m )} here where T i - tuple variables a i - attributes dicates attributes to be projected T i .a j - indicates attributes to be projected cond - is a formula constructed out of atom s, specifying selection (and possibly, join conditions) CS273: Data and Knowledge Bases | University of California at Santa Barbara 4
Background image of page 4
Department of Computer Science ATOM ATOM r(T) where T is a tuple variable and r is a relation T i .a T j .b where  {<, , =, , >, } here c is a constant T i .a c where c is a constant CS273: Data and Knowledge Bases | University of California at Santa Barbara 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Department of Computer Science ATOMIC FORMULA A formula is composed of atoms using the following rules: 1. An atom is a formula. Its truth value is given by the truth value of e atom the atom. 2. Let F, F 1 and F 2 be formulas, T be a tuple variable, then the following are formulas : Formula Truth Value (F) TRUE when F is TRUE . not (F) T RUE when F is FALSE . () F 1 and F 2 T RUE when F 1 and F 2 are TRUE . F 1 or F 2 T RUE when F 1 or F 2 are TRUE . xists T) F T RUE if there exists at least one alue for T such that F is RUE or (exists T) F value for T such that F is TRUE for T. (forall T) F T RUE when F is TRUE for all values for T. CS273: Data and Knowledge Bases | University of California at Santa Barbara 6
Background image of page 6
Department of Computer Science VALID TRC EXPRESSION free variable is not explicitly global variable Free vs. Bound Variables quantified bound variable is declared through local variable quantification and its scope is the quantified formula A valid TRC expression T1 T2 … Tn | F(T1 T2 … Tn) } { T1, T2, , Tn | F(T1, T2, Tn) } has only the tuple variables appearing to the left of the vertical bar (|) free in F. Any other variable appearing in F must be bound.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 35

6-Calculus - CS273 - Data and Knowledge Bases Xifeng Y Xif...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online