Problemresearch
Schema mapping composition
Also called second-order tgds, composing schema mappings.
Given mappings from A to B and from B to C, find one mapping from A to C with the same meaning; it may need second-order dependencies.
Schema mapping composition takes a schema mapping from schema A to schema B and one from B to C, and asks for a single mapping from A to C that relates exactly the pairs of instances linked through some instance of B. The problem is to find a language that can always write this mapping down and an algorithm that builds it. For source-to-target tgds the answer is a larger language, the second-order tgds. This page is about combining mappings. The data exchange problem is about using one mapping to build a target instance, and composition is one of the operations that manage mappings before data exchange runs.
In plain words
A company moves its data from an old design to a new one, and later the new design changes again. Each step has a set of rules that says how data in one design becomes data in the next. It would be simpler to have one set of rules from the oldest design straight to the newest.
When each step only copies and joins known values, the two rule sets can be merged by plugging one into the other. The trouble starts when the first step invents placeholder values and the second step tests them, for example by asking whether a placeholder equals a known value. The merged rule must then talk about the placeholders themselves. Ordinary rules cannot do that, so the merged rule needs a richer form that names functions which produce the placeholders.
Definition
Semantics. A mapping from to is identified with its set of pairs that satisfy its dependencies. The composition is
Set semantics holds. The intermediate instance may be any instance over .
The problem. Given and , each given by a finite set of source-to-target tgds , find a finite set of dependencies from to in some fixed language whose pairs are exactly .
Second-order tgds. A second-order tgd, or SO tgd, has the form
where the are function symbols, each is a conjunction of source atoms and of equalities between terms built from the variables and the , and each is a conjunction of target atoms over such terms. A pair satisfies it if there are functions on the values of and that make all clauses true.
Membership. The decision task is: given , is it in ? Its complexity is measured in data complexity, with the mappings fixed.
Variants
- Full first mapping. is given by full tgds, with no existential variables. Then the composition is again given by source-to-target tgds.
- GAV with GAV. Both mappings are full. Then the composition is given by full tgds, and the result is again a GAV mapping.
- General source-to-target tgds. The composition may need SO tgds.
- SO tgds as the input language. Both mappings are given by SO tgds. The composition is again an SO tgd.
- Target dependencies. The results above are stated for mappings with source-to-target dependencies only, and target tgds or egds in or make the problem harder.
- Inversion. The other basic operator on mappings, which asks for a mapping from B back to A.
Examples
Full first mapping. Let be and be . The composition is
If is in the composition, the instance holds a Hop fact for each Flight fact, so this tgd holds. In the other direction, if the tgd holds, take to be exactly the Hop copy of the Flight facts. Then holds and each pair of Hop facts comes from a pair of Flight facts, so holds.
A composition that needs a function. Let be , each employee reports to some manager. Let be and . The composition is given by the SO tgd
The function names the manager that invents. Take .
| in the composition | reason | |
|---|---|---|
| yes | , from | |
| no | the only choice is , which needs | |
| yes | ||
| yes |
No finite set of source-to-target tgds defines this composition (theorem, Fagin, Kolaitis, Popa and Tan). The second clause tests whether the invented manager equals the employee, and a first-order tgd has no name for the invented value.
Known algorithms
- Unfolding for a full first mapping. For each tgd of , replace each body atom by the body of a tgd of whose head has an atom , with the equalities , in all combinations. The result is a set of source-to-target tgds.
- Composition of SO tgds (Fagin, Kolaitis, Popa and Tan). First skolemize : replace each existential variable of a tgd by a term with a new function symbol, see skolemization. Then unfold as above: each body atom of a clause of is replaced by the body of a clause of that makes it, together with the equalities between the terms. The functions of both mappings are put under one . Applied to the Emp example, the clause meets and gives , which simplifies to the second clause above.
- Simplification. When a function symbol occurs in the head of one clause only, never in a body, and always with the list of all universal variables of that clause as its arguments, it can be put back as an existential variable. If this works for all function symbols, the result is a set of first-order tgds.
- The chase with SO tgds. To use a composed mapping for data exchange, chase the source instance with the SO tgd: each term gets one labeled null, reused at each place where the same term occurs. The result is a universal solution.
Bounds
All bounds are in data complexity unless stated.
- Upper bound. For mappings given by source-to-target tgds, and more generally by SO tgds, membership in the composition is in NP (theorem, Fagin, Kolaitis, Popa and Tan). The certificate is the values of the functions on the terms that the clauses use, which are polynomially many.
- Lower bound. There are mappings and given by source-to-target tgds whose composition has an NP-complete membership problem (theorem, same paper). One such pair is in the Reductions section. Each first-order property has a polynomial-time check, so such a composition is not definable in first-order logic unless P = NP.
- Full first mapping. The composition is given by source-to-target tgds, so membership takes polynomial time.
- Data exchange with an SO tgd. The chase builds a universal solution in polynomial time, and certain answers of unions of conjunctive queries take polynomial time (theorem, same paper).
- Size of the result. If a clause of has body atoms and each atom can be made by up to clauses of , the unfolding gives up to clauses for it. So the composed mapping can be exponentially larger than the input mappings.
Reductions
- From 3-colorability. Let have and . Let be and . Let be and . For a graph , let hold its nodes and edges, and with no Mono facts. Then is in the composition if and only if is 3-colorable. If is a 3-coloring, works. In the other direction, each node has a Color fact whose color is in , choose one for each node, and an edge with one color at both ends would force a Mono fact. So membership is NP-complete.
- SO tgds and composition. Each set of source-to-target tgds is an SO tgd, by skolemization. The SO tgds are the smallest class that contains the source-to-target tgds and is closed under conjunction and composition (theorem, Fagin, Kolaitis, Popa and Tan). So SO tgds are the right language for this problem, not only a sufficient one.
- Composition and certain answers. If defines , data exchange from to with has the same solutions as the two steps in sequence, so it gives the same certain answers.
Applications
- Schema evolution. A mapping from a source to a database, followed by a mapping from the old to the new design of the database, composes into a mapping from the source to the new design.
- Chains of mappings. Systems where each peer has a mapping only to its neighbors answer a query along a path of mappings, and composition replaces the path by one mapping.
- Mapping management. Composition and inversion are the basic operators of tools that store, combine and reuse schema mappings.
- Data exchange. A composed SO tgd can run directly with the chase, with no need to build the intermediate instance.
References
- Ronald Fagin, Phokion G. Kolaitis, Lucian Popa and Wang-Chiew Tan, Composing schema mappings: second-order dependencies to the rescue, ACM TODS 30(4), 2005, pages 994-1055, the semantics of composition, second-order tgds, closure under composition, NP-complete compositions and the chase with second-order tgds
- Marcelo Arenas, Pablo Barceló, Leonid Libkin and Filip Murlak, Foundations of Data Exchange, Cambridge University Press, 2014, the part on metadata management, the chapter on mapping composition
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 00291E Edit this page History Report an error Markdown