xml data exchange
TRANSCRIPT
![Page 1: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/1.jpg)
XML Data Exchange
![Page 2: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/2.jpg)
Relational Data Exchange Settings
Data Exchange Setting: (σ, τ,Σ )
σ: Source schema.
τ : Target schema.
Σ : Set of rules that specify relationship between the target
and the source (source-to-target dependencies).
- Source-to-target dependency:
ψτ (x, z) :– ϕσ(x, y).
- ϕσ(x, y): conjunction of atomic formulas over σ.
- ψτ (x, z): conjunction of atomic formulas over τ .
1
![Page 3: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/3.jpg)
Example: Relational Data Exchange Setting
• σ = Book(Title,AName ,Aff )
• τ = Writer(Name,BTitle,Year)
• Σ = Writer(x2, x1, z1) :– Book(x1, x2, y1).
2
![Page 4: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/4.jpg)
Relational Data Exchange Problem
• Given a source instance S, find a target instance T such
that (S, T ) satisfies Σ .
- (S, T ) satisfies ψτ (x, z) :– ϕσ(x, y) if whenever S satisfies
ϕσ(a, b), there is a tuple c such that T satisfies ψτ (a, c).
- T is called a solution for S.
• Previous example:
S:
Book Title AName Aff
Algebra Hungerford U. Washington
Real Analysis Royden Stanford
3
![Page 5: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/5.jpg)
Relational Data Exchange Problem
Possible solutions:
T1:
Writer Name BTitle Year
Hungerford Algebra 1974
Royden Real Analysis 1988
T2:
Writer Name BTitle Year
Hungerford Algebra ⊥1
Royden Real Analysis ⊥2
4
![Page 6: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/6.jpg)
Query Answering
• Q is a query over target schema.
What does it mean to answer Q?
certain(Q,S) =⋂
T is a solution for S
⋂
R∈POSS(T )
Q(R)
• Previous example:
- certain(∃y∃zWriter(x, y, z), I) = {Hungerford, Royden}
5
![Page 7: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/7.jpg)
XML Documents
db
book book
@title“Algebra”
@title“Real Analysis”
author author
@name @aff @name @aff“Hungerford” “U. Washington” “Royden” “Stanford”
6
![Page 8: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/8.jpg)
XML Documents
db
book book
@title“Algebra”
@title“Real Analysis”
author author
@name @aff @name @aff“Hungerford” “U. Washington” “Royden” “Stanford”
db → book+
DTD : book → author+
author → ε
6
![Page 9: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/9.jpg)
XML Documents
db
book book
@title“Algebra”
@title“Real Analysis”
author author
@name @aff @name @aff“Hungerford” “U. Washington” “Royden” “Stanford”
db → book+
DTD : book → author+ book → @title
author → ε author → @name, @aff
6
![Page 10: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/10.jpg)
XML Data Exchange Settings
• Instead of source and target relational schemas, we have
source and target DTDs.
• But what are the source-to-target dependencies?
To define them, we use tree patterns.
If a certain pattern is found in the source, another pattern
has to be found in the target.
7
![Page 11: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/11.jpg)
Tree Patterns: Example
db
book
author
@name“Hungerford”
. . .book
@titlex
author
@namey
8
![Page 12: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/12.jpg)
Tree Patterns: Example
db
book
@title“Algebra”
author
@name @aff“Hungerford” “U. Washington”
. . .book
@titlex
author
@namey
8
![Page 13: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/13.jpg)
Tree Patterns: Example
db
book
“Real Analysis”author
@name @aff“Royden” “Stanford”
@title
. . .book
@titlex
author
@namey
8
![Page 14: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/14.jpg)
Tree Patterns: Example
db
book
“Real Analysis”author
@name @aff“Royden” “Stanford”
@title
. . .book
@titlex
author
@namey
Collect tuples (x, y): (Algebra, Hungerford), (Real Analysis, Royden)
8
![Page 15: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/15.jpg)
Tree Patterns
• Example: book(@title = x)[author(@name = y)].
• Language also includes wildcard (matching more than one
symbol) and descendant operator //.
9
![Page 16: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/16.jpg)
XML Source-to-target Dependencies
• Source-to-target dependency (STD):
ψτ (x, z) :– ϕσ(x, y),
where ϕσ(x, y) and ψτ (x, z) are tree-patterns over the
source and target DTDs, resp.
• Example:
:–
writer
@namey
work
@titlex z
@year
book
@titlex
author
@namey
10
![Page 17: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/17.jpg)
XML Data Exchange Settings
XML Data Exchange Setting: (Dσ,Dτ ,Σ )
Dσ: Source DTD.
Dτ : Target DTD.
Σ : Set of XML source-to-target dependencies.
Each constraint in Σ is of the form ψτ (x, z) :– ϕσ(x, y).
- ϕσ(x, y): tree-pattern over Dσ.
- ψτ (x, z): tree-pattern over Dτ .
11
![Page 18: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/18.jpg)
Example: XML Data Exchange Setting
• Source DTD:
db → book+
book → author+ book → @title
author → ε author → @name, @aff
• Target DTD:
bib → writer+
writer → work+ writer → @name
work → ε work → @title, @year
• Σ :
writer(@name = y)[work(@title = x,@year = z)] :–
book(@title = x)[author(@name = y)].
12
![Page 19: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/19.jpg)
XML Data Exchange Problem
• Given a source tree T , find a target tree T ′ such that
(T, T ′) satisfies Σ .
- (T, T ′) satisfies ψτ (x, z) :– ϕσ(x, y) if whenever T satisfies
ϕσ(a, b), there is a tuple c such that T ′ satisfies ψτ (a, c).
- T ′ is called a solution for T .
13
![Page 20: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/20.jpg)
XML Data Exchange Problem
Let T be our original tree:
db
book book
@title“Algebra”
@title“Real Analysis”
author author
@name @aff @name @aff“Hungerford” “U. Washington” “Royden” “Stanford”
14
![Page 21: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/21.jpg)
XML Data Exchange Problem
A solution for T :
bib
@year“1988”
writer writer
@name
@title
work work
@title
@name
@year
“Hungerford”
“Algebra”
“Royden”
“Real Analysis”“1974”
15
![Page 22: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/22.jpg)
XML Data Exchange Problem
Another solution for T :
bib
@year“⊥2”
writer writer
@name
@title
work work
@title
@name
@year
“Hungerford”
“Algebra”
“Royden”
“Real Analysis”“⊥1”
16
![Page 23: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/23.jpg)
Consistency of XML Data Exchange Settings
• What if we have target DTD
bib → writer+
writer → novelist∗, poet∗ writer → @name
novelist → work+
poet → work+
work → ε work → @title, @year
in our previous example?
• The setting becomes inconsistent!
- There are no T conforming to Dσ and T ′ conforming to Dτ such
that (T, T ′) satisfies Σ .
17
![Page 24: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/24.jpg)
Consistency of XML Data Exchange Settings
• An XML data exchange setting is inconsistent if it does not
admit solutions for any given source tree. Otherwise it is
consistent.
• A relational data exchange setting is always consistent.
• An XML data exchange setting is not always consistent.
- What is the complexity of checking whether a setting is consistent?
18
![Page 25: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/25.jpg)
Bad News: General Case
Theorem Checking if an XML data exchange setting is
consistent necessarily takes exponential time.
Complexity-theoretic statement: EXPTIME-complete.
But the parameter is the size of the DTDs and constraints –
typically not very large. Hence 2O(n) is not too bad.
19
![Page 26: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/26.jpg)
Good News: Consistency for Commonly used DTDs
DTDs that commonly occur in practice tend to be simple. In
fact more than 50% of regular expressions are of this form:
ℓ → ℓ1, . . . , ℓm,
where all the ℓi’s are distinct, and ℓ is one of the following: ℓ,
or ℓ∗, or ℓ+, or ℓ?
For example, book → title, author+, chapter∗, publisher?
Theorem For non-recursive DTDs that only have these rules,
checking if an XML data exchange setting is consistent is
solvable in time O(
(‖Dσ‖ + ‖Dτ‖) · ‖Σ ‖2)
.
20
![Page 27: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/27.jpg)
Query Answering in XML Data Exchange
• Decision to make: what is our query language?
• XML query languages such as XQuery take XML trees and
produce XML trees.
- This makes it hard to talk about certain answers.
• For now we use a query language that produces tuples of
values.
21
![Page 28: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/28.jpg)
Conjunctive Tree Queries
• Query language CTQ// is defined by
Q := ϕ | Q ∧Q | ∃xQ,
where ϕ ranges over tree-patterns.
• By disallowing descendant // we obtain restriction CTQ.
22
![Page 29: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/29.jpg)
Example: Conjunctive Tree Query
List all pairs of authors that have written articles with the same title.
Q(x, y) :=
∧@namex
work
@titlez
writer
@namey
work
@titlez
writer
∃z ( )
23
![Page 30: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/30.jpg)
Computing Certain Answers
• Semantics: as in the relational case.
certain(Q,T ) =⋂
T ′ is a solution for T
Q(T ′).
• Given data exchange setting (Dσ,Dτ ,Σ ) and query Q:
PROBLEM: CertAnsw(Q).
INPUT: Tree T conforming to Dσ and tuple a.
QUESTION: Is a ∈ certain(Q, T )?
24
![Page 31: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/31.jpg)
Computing Certain Answers: General Picture
It is not even clear if the problem is solvable.
Good news For every XML data exchange setting and
CTQ//-query Q, th problem CertAnsw(Q) is solvable in
exponential time.
More precisely, it is in coNP.
Not so good news Sometimes exponential time is
“unavoidable”: There exist an XML data exchange setting and a
CTQ//-query Q such that CertAnsw(Q) is coNP-complete.
We want to find cases that admit fast algorithms.
25
![Page 32: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/32.jpg)
Computing Certain Answers: Eliminating bad cases
Suppose one of the following is allowed in tree patterns over the target
in STDs:
• descendant operator //, or
• wildcard , or
• patterns that do not start at the root.
Then one can find source and target DTDs (in fact, very simple
DTDs) and a CTQ-query Q such that CertAnsw(Q) must take
exponential time.
A more precise statement: is coNP-complete.
26
![Page 33: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/33.jpg)
Fully specified constraints
• We disallow the three features that make query answering
hard.
• This gives us fully-specified STDs:
We impose restrictions on tree patterns over target DTDs:
- no descendant relation //; and
- no wildcard ; and
- all patterns start at the root.
No restrictions imposed on tree patterns over source DTDs.
• Subsume non-relational data exchange handled by IBM.
27
![Page 34: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/34.jpg)
An efficient case
• Recall relational data exchange and conjunctive queries:
then certain(Q,S) = certain(Q,CanSol(S)).
• Idea: given a source tree T , compute a solution T ⋆ for T
such that
certain(Q,T ) = remove null tuples(Q(T ⋆)).
• T ⋆ is a canonical solution for T .
• We compute T ⋆ in two steps:
- We use STDs to compute a canonical pre-solution cps(T ) from T .
- Then we use target DTD to compute T ⋆ from cps(T ).
28
![Page 35: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/35.jpg)
Example: XML Data Exchange Setting
• Source DTD:
r → A∗, B∗
A → ε A → @ℓ
B → ε B → @ℓ
• Target DTD:
r → (C,D)∗
C → ε C → @m
D → E
E → ε E → @n
• Σ :
r[C(@m = x)] :– A(@ℓ = x),
r[C(@m = x)] :– B(@ℓ = x).
29
![Page 36: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/36.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@m @ℓ
C
@m
r
“1”
C
r
A
x x
30
![Page 37: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/37.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C
r
A
x x@m
30
![Page 38: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/38.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C
r
A
x x@m
30
![Page 39: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/39.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C
r
A
x x@m
30
![Page 40: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/40.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C A
x x@m
r
30
![Page 41: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/41.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C A
x x@m
r
30
![Page 42: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/42.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C A
x x@m
r
30
![Page 43: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/43.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C A
x x@m
r
30
![Page 44: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/44.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C A
x x@m
r
30
![Page 45: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/45.jpg)
Example: Computing Canonical Pre-solution
r
A B
@ℓ @ℓ“1” “2”
r
A B
@ℓ @ℓ“1” “2”
:–
@m @ℓ
C
@m
r
“2”
C
r
x
B
x
:–
@ℓ
C
@m
r
“1”
C A
x x@m
r
30
![Page 46: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/46.jpg)
Example: Computing Canonical Pre-solution
Canonical pre-solution:
C
@m“1”
C
@m“2”
r
Not yet a solution: it does not conform to the target DTD.
31
![Page 47: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/47.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
r → (C,D)∗
32
![Page 48: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/48.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
r → (C,D)∗
32
![Page 49: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/49.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
r → (C,D)∗
32
![Page 50: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/50.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
D → E
32
![Page 51: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/51.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
D → E
32
![Page 52: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/52.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
E → @n
32
![Page 53: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/53.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
E → @n
32
![Page 54: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/54.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
D → E
32
![Page 55: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/55.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
D → E
32
![Page 56: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/56.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
E → @n
32
![Page 57: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/57.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
E → @n
32
![Page 58: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/58.jpg)
Example: Computing Canonical Solution
C
@m“1”
DC
r
D
EE
@n@n“⊥1” “⊥2”
@m“2”
E → @n
32
![Page 59: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/59.jpg)
Does this always work?
Depends on regular expressions in target DTDs.
• class of good regular expressions.
- Examples: (A|B)∗, A,B+, C∗, D?, (A∗|B∗), (C,D)∗.
- bad: A, (B|C).
- exact definition: quite involved.
33
![Page 60: XML Data Exchange](https://reader031.vdocuments.net/reader031/viewer/2022021815/5868cfd91a28ab12578bcb19/html5/thumbnails/60.jpg)
Does this always work? cont’d
• For target DTDs only using good regular expressions:
- There exists a solution for a tree T iff there exists a canonical
solution T ⋆ for T .
- Previous algorithm computes canonical solution T ⋆ for T in
polynomial time.
- certain(Q,T ) = remove null tuples(Q(T ⋆)), for every
CTQ//-query.
• Complexity: polynomial time.
34