Uncertain Data Management Boolean c-tables
Antoine Amarilli1, Silviu Maniu2 November 21st, 2017
1Télécom ParisTech
2LRI
c-tables
Rememberc-tables:
Member./Booking id date teacher class room 2 2017-11-28 NULL1 UDM NULL2
3 2017-12-05 NULL1 UDM NULL2
4 2017-12-12 NULL1 UDM NULL2 ifNULL0is “UDM”
→ Variant:Only allowNULLsin theconditions
c-tables
Rememberc-tables:
Member./Booking id date teacher class room 2 2017-11-28 NULL1 UDM NULL2
3 2017-12-05 NULL1 UDM NULL2
4 2017-12-12 NULL1 UDM NULL2 ifNULL0is “UDM”
→ Variant:Only allowNULLsin theconditions
NULLs in conditions
•
Thepossible tuplesare exactly therows•
Each row may either bekeptordeleted→ Depends on thecondition
→ Finitenumber of possible worlds
→ at most2Nif we haveNrows
NULLs in conditions
•
Thepossible tuplesare exactly therows•
Each row may either bekeptordeleted→ Depends on thecondition
→ Finitenumber of possible worlds
→ at most2Nif we haveNrows
NULLs in conditions
•
Thepossible tuplesare exactly therows•
Each row may either bekeptordeleted→ Depends on thecondition
→ Finitenumber of possible worlds
→ at most2Nif we haveNrows
Example
Member./Booking id date teacher class room
2 2017-11-28 Antoine UDM C42 ifNULL1is “Antoine”
3 2017-12-05 Antoine UDM C42 ifNULL1is “Antoine”
4 2017-12-12 Antoine UDM C42 ifNULL1is “Antoine”
2 2017-11-28 Silviu UDM C42 ifNULL1is “Silviu”
3 2017-12-05 Silviu UDM C42 ifNULL1is “Silviu”
4 2017-12-12 Silviu UDM C42 ifNULL1is “Silviu”
Table of contents
Definitions
Boolean c-tables
Expressiveness
Boolean c-tables
WithBoolean c-tables, we impose:
•
the possible values of eachNULLi areTrueandFalseWe cansimplify notation
→ We write theNULLsasBoolean variablesxi
→ We replacexi=Trueby justxi
→ We replacexi=Falseby¬xi
→ We canrewrite:
• xi=xjto(xi∧xj)∨(¬xi∧ ¬xj)
• xi6=xjto(xi∧ ¬xj)∨(¬xi∧xj)
→ The conditions becomeBoolean expressions
Boolean c-tables
WithBoolean c-tables, we impose:
•
the possible values of eachNULLi areTrueandFalse We cansimplify notation→ We write theNULLsasBoolean variablesxi
→ We replacexi=Trueby justxi
→ We replacexi=Falseby¬xi
→ We canrewrite:
• xi=xjto(xi∧xj)∨(¬xi∧ ¬xj)
• xi6=xjto(xi∧ ¬xj)∨(¬xi∧xj)
→ The conditions becomeBoolean expressions
Boolean c-tables
WithBoolean c-tables, we impose:
•
the possible values of eachNULLi areTrueandFalse We cansimplify notation→ We write theNULLsasBoolean variablesxi
→ We replacexi=Trueby justxi
→ We replacexi=Falseby¬xi
→ We canrewrite:
• xi=xjto(xi∧xj)∨(¬xi∧ ¬xj)
• xi6=xjto(xi∧ ¬xj)∨(¬xi∧xj)
→ The conditions becomeBoolean expressions
Boolean c-tables
WithBoolean c-tables, we impose:
•
the possible values of eachNULLi areTrueandFalse We cansimplify notation→ We write theNULLsasBoolean variablesxi
→ We replacexi=Trueby justxi
→ We replacexi=Falseby¬xi
→ We canrewrite:
• xi=xjto(xi∧xj)∨(¬xi∧ ¬xj)
• xi6=xjto(xi∧ ¬xj)∨(¬xi∧xj)
Expressiveness
Theorem
We can always rewrite a c-table havingNULLsonly in conditions to a Boolean c-table.
Proof: Two steps:
1. We can pick theNULLsin afinite domain
2. We can rewrite anyfinite domaintoTrueandFalse
Expressiveness
Theorem
We can always rewrite a c-table havingNULLsonly in conditions to a Boolean c-table.
Proof:Two steps:
1. We can pick theNULLsin afinite domain
2. We can rewrite anyfinite domaintoTrueandFalse
Step 1: Reducing to a finite domain
•
We can choose amonginfinitely manyvalues for theNULLs•
However, the values only appear in theconditions:• NULLi=NULLj
• NULLi= “c”
• Boolean combinations
•
We call two assignments of values toNULLsequivalent if all conditions evaluate to thesameStep 1: Reducing to a finite domain
•
We can choose amonginfinitely manyvalues for theNULLs•
However, the values only appear in theconditions:• NULLi=NULLj
• NULLi= “c”
• Boolean combinations
•
We call two assignments of values toNULLsequivalent if all conditions evaluate to thesameStep 1: Reducing to a finite domain (example)
→ Call two assignments of values toNULLsequivalent if all conditions evaluate to thesame.
Consider the following:
•
NULL1 =NULL2•
NULL2 = “c”→ E.g.:The assignment(a,d)isequivalentto(b,d)
→ What are the possibleassignments?
• (c,c)
→ true,true
• (x,c)withx6=c
→ false,true
• (x,x)withx6=c
→ true, false
• (y,x)withx6=candy6=x
→ false, false
Step 1: Reducing to a finite domain (example)
→ Call two assignments of values toNULLsequivalent if all conditions evaluate to thesame.
Consider the following:
•
NULL1 =NULL2•
NULL2 = “c”→ E.g.:The assignment(a,d)isequivalentto(b,d)
→ What are the possibleassignments?
• (c,c)
→ true,true
• (x,c)withx6=c
→ false,true
• (x,x)withx6=c
→ true, false
• (y,x)withx6=candy6=x
→ false, false
Step 1: Reducing to a finite domain (example)
→ Call two assignments of values toNULLsequivalent if all conditions evaluate to thesame.
Consider the following:
•
NULL1 =NULL2•
NULL2 = “c”→ E.g.:The assignment(a,d)isequivalentto(b,d)
→ What are the possibleassignments?
• (c,c)
→ true,true
• (x,c)withx6=c
→ false,true
• (x,x)withx6=c
→ true, false
• (y,x)withx6=candy6=x
→ false, false
Step 1: Reducing to a finite domain (example)
→ Call two assignments of values toNULLsequivalent if all conditions evaluate to thesame.
Consider the following:
•
NULL1 =NULL2•
NULL2 = “c”→ E.g.:The assignment(a,d)isequivalentto(b,d)
→ What are the possibleassignments?
• (c,c)
→ true,true
• (x,c)withx6=c
→ false,true
• (x,x)withx6=c
→ true, false
• (y,x)withx6=candy6=x
→ false, false
Step 1: Reducing to a finite domain (example)
→ Call two assignments of values toNULLsequivalent if all conditions evaluate to thesame.
Consider the following:
•
NULL1 =NULL2•
NULL2 = “c”→ E.g.:The assignment(a,d)isequivalentto(b,d)
→ What are the possibleassignments?
• (c,c)
→ true,true
• (x,c)withx6=c
→ false,true
• (x,x)withx6=c
→ true, false
• (y,x)withx6=candy6=x
→ false, false
Step 1: Reducing to a finite domain (example)
→ Call two assignments of values toNULLsequivalent if all conditions evaluate to thesame.
Consider the following:
•
NULL1 =NULL2•
NULL2 = “c”→ E.g.:The assignment(a,d)isequivalentto(b,d)
→ What are the possibleassignments?
• (c,c)
→ true,true
• (x,c)withx6=c
→ false,true
• (x,x)withx6=c
Step 1: Reducing to a finite domain (concluding)
•
Consider allconstantsthat appear:C•
ConsiderNdifferent valuesV, whereNis the number ofNULLs→ Gives ourdomainD ··=C t V Lemma
For any c-table withNULLsonly in conditions, its set of possible worlds is the same:
•
under the standard semantics•
whenNULLsrange over the finiteD.→ Forsimplicity, let’spadDto have exactly2kvalues for somek
Step 1: Reducing to a finite domain (concluding)
•
Consider allconstantsthat appear:C•
ConsiderNdifferent valuesV, whereNis the number ofNULLs→ Gives ourdomainD ··=C t V
Lemma
For any c-table withNULLsonly in conditions, its set of possible worlds is the same:
•
under the standard semantics•
whenNULLsrange over the finiteD.→ Forsimplicity, let’spadDto have exactly2kvalues for somek
Step 1: Reducing to a finite domain (concluding)
•
Consider allconstantsthat appear:C•
ConsiderNdifferent valuesV, whereNis the number ofNULLs→ Gives ourdomainD ··=C t V Lemma
For any c-table withNULLsonly in conditions, its set of possible worlds is the same:
•
under the standard semantics•
whenNULLsrange over the finiteD.→ Forsimplicity, let’spadDto have exactly2kvalues for somek
Step 1: Reducing to a finite domain (concluding)
•
Consider allconstantsthat appear:C•
ConsiderNdifferent valuesV, whereNis the number ofNULLs→ Gives ourdomainD ··=C t V Lemma
For any c-table withNULLsonly in conditions, its set of possible worlds is the same:
•
under the standard semantics•
whenNULLsrange over the finiteD.Forsimplicity, let’s to have exactly values for some
Step 2: Rewriting to Boolean variables
•
Thedomainhas size2k•
Write itsvaluesinbinary•
Encode eachNULLi to variablesxi1, . . . ,xik→ Can wetranslatethe conditions?
Step 2: Rewriting to Boolean variables
•
Thedomainhas size2k•
Write itsvaluesinbinary•
Encode eachNULLi to variablesx1i, . . . ,xik→ Can wetranslatethe conditions?
Step 2: Rewriting to Boolean variables
•
Thedomainhas size2k•
Write itsvaluesinbinary•
Encode eachNULLi to variablesx1i, . . . ,xik→ Can wetranslatethe conditions?
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x17=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL76=001→ negatethe above
•
NULL7=NULL8→ x17=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL76=001→ negatethe above
•
NULL7=NULL8→ x17=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL76=001→ negatethe above
•
NULL7=NULL8→ x17=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL7 6=001→ negatethe above
•
NULL7=NULL8→ x17=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL7 6=001→ negatethe above
•
NULL7=NULL8→ x17=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL7 6=001→ negatethe above
•
NULL7 =NULL8→ x17=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL7 6=001→ negatethe above
•
NULL7 =NULL8→ x71=x18andx27 =x82andx37=x38
•
NULL76=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL7 6=001→ negatethe above
•
NULL7 =NULL8→ x71=x18andx27 =x82andx37=x38
•
NULL7 6=NULL8→ negatethe above
Step 2: Rewriting to Boolean variables (example)
•
NULL7 =001→ x71=0andx27=0andx37=1
→ ¬x71∧ ¬x27∧x37
•
NULL7 6=001→ negatethe above
•
NULL7 =NULL8→ x71=x18andx27 =x82andx37=x38
•
NULL7 6=NULL8→ negatethe above
Concluding
1. We have moved to afinite domain (without changing the relation)
2. We haverewrittento Boolean variables (we changed the relation)
→ Itsufficesto study Boolean c-tables
Concluding
1. We have moved to afinite domain (without changing the relation)
2. We haverewrittento Boolean variables (we changed the relation)
→ Itsufficesto study Boolean c-tables
Concluding
1. We have moved to afinite domain (without changing the relation)
2. We haverewrittento Boolean variables (we changed the relation)
→ Itsufficesto study Boolean c-tables
Table of contents
Definitions
Boolean c-tables
Expressiveness
Strong representation system
•
Are Boolean c-tables astrong representation system for relational algebra? ...→ Yes!
→ c-tablesare a strong representation system
→ NULLswill neverappearby themselves outside of conditions
Strong representation system
•
Are Boolean c-tables astrong representation system for relational algebra? ...→ Yes!
→ c-tablesare a strong representation system
→ NULLswill neverappearby themselves outside of conditions
Strong representation system
•
Are Boolean c-tables astrong representation system for relational algebra? ...→ Yes!
→ c-tablesare a strong representation system
→ NULLswill neverappearby themselves outside of conditions
Capturing all uncertain relations
•
Fix afiniteset ofpossible tuples•
Apossible world: a subset of thepossible tuples•
Anfinite uncertain relation:(finite) set ofpossible worldsBooking date teacher room 21 Antoine Saphir 21 Silviu Saphir 21 Silviu C47 28 Antoine Saphir 28 Antoine C47 28 Silviu Saphir
Booking date teacher room 21 Antoine Saphir 21 Silviu Saphir 21 Silviu C47 28 Antoine Saphir 28 Antoine C47 28 Silviu Saphir
→ Can we capture allfinite uncertain relations?
Capturing all uncertain relations
•
Fix afiniteset ofpossible tuples•
Apossible world: a subset of thepossible tuples•
Anfinite uncertain relation:(finite) set ofpossible worlds Bookingdate teacher room 21 Antoine Saphir 21 Silviu Saphir 21 Silviu C47 28 Antoine Saphir 28 Antoine C47 28 Silviu Saphir
Booking date teacher room 21 Antoine Saphir 21 Silviu Saphir 21 Silviu C47 28 Antoine Saphir 28 Antoine C47 28 Silviu Saphir
→ Can we capture allfinite uncertain relations?
Capturing all uncertain relations
•
Fix afiniteset ofpossible tuples•
Apossible world: a subset of thepossible tuples•
Anfinite uncertain relation:(finite) set ofpossible worlds Bookingdate teacher room 21 Antoine Saphir 21 Silviu Saphir 21 Silviu C47 28 Antoine Saphir 28 Antoine C47 28 Silviu Saphir
Booking date teacher room 21 Antoine Saphir 21 Silviu Saphir 21 Silviu C47 28 Antoine Saphir 28 Antoine C47 28 Silviu Saphir
Capturing finite uncertain relations
•
Make multiplecopiesof possible worlds so there are2k possible worlds•
Write eachpossible worldin binary00 v w a d b e c f
01 v w a d b e c f
10 v w a d b e c f
11 v w a d b e c f
Capturing finite uncertain relations
•
Make multiplecopiesof possible worlds so there are2k possible worlds•
Write eachpossible worldin binary 00v w a d b e c f
01 v w a d b e c f
10 v w a d b e c f
11 v w a d b e c f
Capturing finite uncertain relations
•
Make multiplecopiesof possible worlds so there are2k possible worlds•
Write eachpossible worldin binary 00v w a d b e c f
01 v w a d b e c f
10 v w a d b e c f
11 v w a d b e c f
Numbering tuples
For eachtuple, write thepossible worldswhere it appears
00 v w a d b e c f
01 v w a d b e c f
10 v w a d b e c f
11 v w a d b e c f
v w
a d 00 01 10 11
b e 01
c f 01 10 11
Numbering tuples
For eachtuple, write thepossible worldswhere it appears 00
v w a d b e c f
01 v w a d b e c f
10 v w a d b e c f
11 v w a d b e c f
v w
a d 00 01 10 11
b e 01
c f 01 10 11
Numbering tuples
For eachtuple, write thepossible worldswhere it appears 00
v w a d b e c f
01 v w a d b e c f
10 v w a d b e c f
11 v w a d b e c f
v w
a d 00 01 10 11
b e 01
Making a condition
•
Create onenon-Boolean variable→ chooses the world
•
Obtain anon-Booleanc-tablev w
a d 00 01 10 11
b e 01
c f 01 10 11
v w
a d x=00∨x=01∨x=10∨x=11
b e x=01
c f x=01∨x=10∨x=11
Making a condition
•
Create onenon-Boolean variable→ chooses the world
•
Obtain anon-Booleanc-table v wa d 00 01 10 11
b e 01
c f 01 10 11
v w
a d x=00∨x=01∨x=10∨x=11
b e x=01
c f x=01∨x=10∨x=11
Making a condition
•
Create onenon-Boolean variable→ chooses the world
•
Obtain anon-Booleanc-table v wa d 00 01 10 11
b e 01
c f 01 10 11
v w
a d x=00∨x=01∨x=10∨x=11
b e x=01
c f x=01∨x=10∨x=11
Making a Boolean c-table
Use theprevious trickto rewrite to aBoolean c-table
v w
a d x=00∨x=01∨x=10∨x=11
b e x=01
c f x=01∨x=10∨x=11
v w
a d ¬x1∧ ¬x2∨ ¬x1∧x2∨x1∧ ¬x2∨x1∧x2
b e ¬x1∧x2
c f ¬x1∧x2∨x1∧ ¬x2∨x1∧x2
Making a Boolean c-table
Use theprevious trickto rewrite to aBoolean c-table
v w
a d x=00∨x=01∨x=10∨x=11
b e x=01
c f x=01∨x=10∨x=11
v w
a d ¬x1∧ ¬x2∨ ¬x1∧x2∨x1∧ ¬x2∨x1∧x2
b e ¬x1∧x2
c f ¬x1∧x2∨x1∧ ¬x2∨x1∧x2
Making a Boolean c-table
Use theprevious trickto rewrite to aBoolean c-table
v w
a d x=00∨x=01∨x=10∨x=11
b e x=01
c f x=01∨x=10∨x=11
v w
a d ¬x1∧ ¬x2∨ ¬x1∧x2∨x1∧ ¬x2∨x1∧x2
b e ¬x1∧x2
c f ¬x ∧x ∨x ∧ ¬x ∨x ∧x
Conclusion We have studied:
•
First:•Codd tableswithNULLs
• v-tableswithnamedNULLs
• c-tableswithnamedNULLsandconditions
•
Then:• c-tables withNULLsonly in conditions• Booleanc-tables: Boolean variables We have shown:
→ Anyc-tablewithNULLsonly in conditions rewritesto a Boolean c-table
→ Boolean c-tablescaptureall finiteuncertain relations
→ Boolean c-tables are astrong representation system
→ c-tables are astrong representation system
Conclusion We have studied:
•
First:•Codd tableswithNULLs
• v-tableswithnamedNULLs
• c-tableswithnamedNULLsandconditions
•
Then:• c-tables withNULLsonly in conditions• Booleanc-tables: Boolean variables
We have shown:
→ Anyc-tablewithNULLsonly in conditions rewritesto a Boolean c-table
→ Boolean c-tablescaptureall finiteuncertain relations
→ Boolean c-tables are astrong representation system
→ c-tables are astrong representation system
Conclusion We have studied:
•
First:•Codd tableswithNULLs
• v-tableswithnamedNULLs
• c-tableswithnamedNULLsandconditions
•
Then:• c-tables withNULLsonly in conditions• Booleanc-tables: Boolean variables We have shown:
→ Anyc-tablewithNULLsonly in conditions rewritesto a Boolean c-table
→ Boolean c-tablescaptureall finiteuncertain relations
→ Boolean c-tables are astrong representation system
→ c-tables are astrong representation system
References i
Abiteboul, S., Hull, R., and Vianu, V. (1995).
Foundations of Databases.
Addison-Wesley.
http://webdam.inria.fr/Alice/pdfs/all.pdf. Suciu, D., Olteanu, D., Ré, C., and Koch, C. (2011).
Probabilistic Databases.
Morgan & Claypool.
Unavailable online.