180 likes | 312 Views
What is a Quasi-Inverse?. Jordan Johnson May 29, 2008 TWIGS at UCSC. A. B. Background: Data Exchange. Given: Databases A, B Problem: Populate B with data from A. Background: Schemata. A, B specified by schemata S , T Mappings relate the schemata. S = { EmployeeDB: {
E N D
What is a Quasi-Inverse? Jordan Johnson May 29, 2008 TWIGS at UCSC
A B Background: Data Exchange • Given: Databases A, B • Problem: Populate B with data from A
Background: Schemata • A, B specified by schemata S, T • Mappings relate the schemata • S = { EmployeeDB: { • HrlyEmp(id, name, wage), • SalariedEmp(id, name, sal) • } } • T = { PersonnelDB: { • Emp(id, name, ssn) • } }
Background: A Mapping M = (S, T, ) where = { (id, nm, w): HrlyEmp(id, nm, w) (ssn): Emp(id, nm, ssn), (id, nm, s): SalariedEmp(id, nm, s) (ssn): Emp(id, nm, ssn) } are tuple generating dependencies specifying the mapping.
Background: what, more? • Mappings as data? • Operations on mappings: • compose [Madhavan/Halevy, 2003] • match/diff/etc [Bernstein, 2003] • invert [Fagin, 2006] • Well, only sometimes…
The problem with inverses… • Original must be injective. • S-T mapping • Defined w.r.t. schemata • Domain/range are DB instances
Our example again: (id, nm, w): HrlyEmp(id, nm, w) (ssn): Emp(id, nm, ssn), (id, nm, s): SalariedEmp(id, nm, s) (ssn): Emp(id, nm, ssn)
Other problematic mappings: • Projection: • {P(x, y) Q(x)} • Union: • {P(x) R(x), Q(x) R(x)} • Decomposition: • {P(x, y, z) Q(x, y) ^ R(y, z)}
Quasi-Inverse (of a function) • Given f : X -> Y, a function g is a quasi-inverse if: • g : Z -> X, whereran(f) Z Y, and • f g f = f
Quasi-Inverse (of a function) • Examples: • f(x) = x2 • g1(x) = sqrt(x) • g2(x) = -sqrt(x) • f(x) = x • g(x) = x + , where 0 1.
Features of Quasi-Inverses • Weaker conditions than for inverse • Still recovers some of the original • If an inverse f exists: • a single quasi-inverse g exists • g = f
Quasi-Inverse (of a mapping) • Problem: • What’s a good analogous quasi-inverse definition for schema mappings?
Quasi-Inverse (of a mapping) • Idea: • Parameterize the idea of “inverse” w.r.t. equivalence relations ~1, ~2on schema instances.
Quasi-Inverse: Preliminaries • S´ is a replica of S. • Instance I´ is a replica of I. • For mapping M = (S, S´, ), • Inst(M) = set of all (I1, I2) such that I1 and I2 are instances of S, S´ (resp.) and satisfy . • Id = (S, S´, id), where id containsR(x) -> R(x) for all R in S. • Note: I1 (Inst(Id)) I2 if I1´ I2.
Quasi-Inverse: Preliminaries • Note: M’ is an inverse of M if Inst(Id) = Inst(M’ · M). • For a binary relation D, let I1D[~1, ~2] I2 if there exist J1, J2 such that (I1, I2) ~(1,2) (J1, J2) and J1D J2.
Quasi-Inverse (of a mapping) • Formal definition: • Given a mapping M = (S, T, ),M´ = (T, S, ´) is a (~1, ~2)-inverse of M iffInst(Id)[~1, ~2] = Inst(M’ · M)[~1, ~2].
Quasi-Inverse (of a mapping) • Again, M = (S, S´, ). • Let Sol(M, I) be the set of solutions for instance I under M: all J such that (I, J) satisfy . • Let (I1~M I2) Sol(M, I1) = Sol(M, I2). • M’ is a quasi-inverse of M means:M’ is a (~M, ~M)-inverse of M.
Example Quasi-Inverses • Projection: • {P(x, y) Q(x)} • QI: {Q(x) z.P(x,z)} • Union: • {P(x) R(x), Q(x) R(x)} • QI: {R(x) P(x) Q(x)}