1 iii) complex value databases. 2 introduction l relax the 1 normal form of the relational model ...
TRANSCRIPT
![Page 1: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/1.jpg)
1
III) COMPLEX VALUE DATABASES
![Page 2: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/2.jpg)
2
Introduction
Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)
Alternative Names: N1NF, NF2, and Nested Relations Models Three simultaneous innovating approaches:
INRIA 1981-1985: VERSO Database Machine (M. Scholl & S. Abiteboul & F. Bancillon & N. Bidoit & al)
University of Texas 1983: N1NF (P. Fisher & S. Thomas) IBM Heidelberg + Darmstand 1983-1986: DASDBS NF2 Relational
database (G. Jaeschke, H. Schek, P. Pistor, M. H. Scholl) No programming languages Only experimental prototypes
![Page 3: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/3.jpg)
3
A Model for Complex Values
Set of Atomic values: D = Di, where Di are atomic domains such as strings, integers, reals, etc.
Set of Attribute names A Set of Complex values:
each element v of D is a complex value if v1, v2, ..., vn are structured values and a1, a2, ..., an are attribute
names then [a1:v1, a2:v2, ..., an:vn] is a complex value, called tuple if v1, v2, ..., vn are structured values then {v1, v2, ..., vn} is a complex
value, called set NOTE: In N1NF Models the set and tuple value constructors can be
applied only alternatively is not possible to represent set of sets or tuples of tuples
![Page 4: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/4.jpg)
4
Complex Values: Examples
In the FineArt database we want to represent artists with their work From a relational perspective we have the multi-valued dependency:
Name ->-> ArtifactsArtifactsName StyleTitle
Live-Time Nationality
GuernicaPablo Picasso CubismSeated Woman
1881-1973 Spain
HaystacksClaude Monet ImpressionismWheatstacks
1840-1926 France
Solder of the firstDivision
KasimirMalevich
Geom.Abstract
The Woodcutter
1878-1935 Russia
AlbertoGiacometti
Surrealism 1901-1966 Swiss
The YellowChristPaul (Eugéne-Henri) Gauguin
ImpressionismTahitian Women
1848-1903 France
The WaitressEdouard Manet ImpressionismEm. Zola Portrait
1832-1883 France
![Page 5: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/5.jpg)
5
Complex Value Types
Set of Atomic types: STRING, INT, REAL Set of Attribute names A Set of types for Complex values:
each atomic type is a type if t1, t2, ..., tn are types and a1, a2, ..., an are attribute names then
[a1:t1, a2:t2, ..., an:tn] is a tuple type if t is a type then {t} is a set type
EXAMPLE: The type (sort) of the FINE-ART N1NF Relation is:
{[Name: STRING, Style: STRING, Artifacts: {[Title: STRING]}, Live-Time: STRING, Nationality: STRING]}
![Page 6: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/6.jpg)
6
Typing: DB vs. PL view
Types in PL: Part of the program Focus on variables and functions Used to avoid inconsistent computations Type checking is mainly a static activity (compiler)
Types in DB: Part of the schema Focus on data Used to check semantic integrity Type checking could be also a dynamic activity (run time)
NOTE: The conception of good constructs in DBPL is twofold: Support a type system for data modeling Support a data model for program typing
![Page 7: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/7.jpg)
7
Toward a Formalization of Complex Value Databases
A schema S is a triple (N, T, ) : N is a set of names (e.g., relation names) T is a set of types is a function from N to T
The Extension (Interpretation) I of a name n is the set of values
(instances) of sort (n)
A Database instance is a mapping of the schema S names n such
that for each n in S, I(n) is a set of values of sort (n)
![Page 8: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/8.jpg)
8
Complex value Query Languages: Algebra
Uses relation names + constants + new operations Basic Set Operations: Union, Intersection and Difference Constructive Operations: PowerSet, Tuple_create, Set_create Destructive Operations: Flatten, Tuple_destroy Restructuring Operations: Nest and Unnest Filtering Operations: Selection, Projection, Renaming Additional Operations: Cross Product, Join
![Page 9: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/9.jpg)
9
Complex Value Algebraic Operators
B
b1
b2
b1
b2
b1
PowerSet
B
b1
b2
Flatten
{[B:T]}
{{[B:T]}}
Join
A
a2
B
C Da1 c1
c2
d1
d2
d2
d3
c2
c3
E F
e1 f1
Product
{[E:T1, F:T2]}
{[A:T3, B:{[C:T4, D:T5]}]}
{[B:T]}
{{[B:T]}}
{[E:T1, F:T2, A:T3, B:{[C:T4, D:T5]}]}
B
b2B
B
C D
A
a2
B
C Da1 c1
c2
d1
d2
d2
d3
c2
c3
C D
E F
e1 f1
e1 f1
A
a2
B
C Da1 c1
c2
d1
d2
d2
d3
c2
c3
C D
A E
a2 e1
{[A:T1, E:T4]}
{[A:T1, B:{[C:T2, D:T3]}]}
A
a2
B
d2
d3
c2
c3
C D
E
e1
{[ A:T1, B:{[C:T2, D:T3]}, E:T4]}
B
b1
b2
b1
B
b2B
B
B
![Page 10: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/10.jpg)
10
Complex Value Algebraic Operators
A
a2
B
d2
d3
c2
c3
C D B
B
d2
d3
c2
c3
C D d2
d3
c2
c3
C DTuple_
destroyd2
d3
c2
c3
C DFlatten
PowerSet C Dc2 d2
d3c3
C D
C D
d2
d3
c2
c3
C D
Tuple_
createB
B
C Dc2 d2
d3c3
C D
Bd2
d3
c2
c3
C Dd2
d3
c2
c3
C D
{ [A:T1, B:{ [C:T2, D:T3] } ] } { [B:{ [C:T2, D:T3] } ] } { { [C:T2, D:T3] } } { [C:T2, D:T3] }
{ [C:T2, D:T3] } { [C:T2, D:T3] }
{ { [C:T2, D:T3] } }
{ [B: [C:T2, D:T3]] }
![Page 11: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/11.jpg)
11
Complex Value Query Examples
Find the artifacts of Impressionist artists
(Flatten(Tuple_destroy(Artifacts(Style=‘Impressionist’(FINEART)))))
ArtifactsName StyleTitle
Live-Time Nationality
HaystacksWheatstacks
Claude Monet Impressionism
...
1840-1926 France
The Yellow ChristTahitian Women
Paul (Eugéne-Henri) Gauguin
Impressionism
...
1848-1903 France
The WaitressEm. Zola Portrait
Edouard Manet Impressionism
...
1832-1883 France
... ... ... ... ..
![Page 12: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/12.jpg)
12
Complex Value Unnest & Nest
R1 = UnnestArtifacts(FINEART)
Name Style Title Live-Time NationalityPablo Picasso Cubism Guernica 1881-1973 SpainPablo Picasso Cubism Seated Woman 1881-1973 SpainClaude Monet Impressionism Haystacks 1840-1926 FranceClaude Monet Impressionism Wheatstacks 1840-1926 France
Kasimir Malevich Geom.Abstract
Solder of the 1 Div. 1878-1935 Russia
Kasimir Malevich Geom.Abstract
The Woodcutter 1878-1935 Russia
Alberto Giacometti Surrealism 1901-1966 SwissPaul Gauguin Impressionism The YellowChrist 1848-1903 FrancePaul Gauguin Impressionism Tahitian Women 1848-1903 France
Edouard Manet Impressionism The Waitress 1832-1883 FranceEdouard Manet Impressionism Em. Zola Portrait
... ... ... ... ..
![Page 13: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/13.jpg)
13
Complex Value Unnest & Nest
R2= Nest ArtWork=Name,Title,Live-Time,Nationality(R1)
ArtWorkStyleName Title Live-Time Nationality
Pablo Picasso Guernica 1881-1973 SpainCubismPablo Picasso Seated Woman 1881-1973 SpainClaude Monet Haystacks 1840-1926 France
Claude Monet Wheatstacks 1840-1926 FrancePaul Gauguin The Yellow Christ 1832-1883 FrancePaul Gauguin Tahitian Women 1832-1883 France
Edouard Manet The Waitress 1832-1883 France
Impressionism
Edouard Manet Em. Zola Portrait 1832-1883 FranceKasimir Malevich Solder of the 1 Div. 1878-1935 RussiaGeom.
Abstract Kasimir Malevich The Woodcutter 1878-1935 Russia
Surrealism Alberto Giacometti 1901-1966 Swiss... ... ... ... ..
![Page 14: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/14.jpg)
14
Complex Value Unnest & Nest
Unnest is the right inverse of nest, whereas unnest is in general not information preserving
Nest Artifacts=Title (Unnest Artifacts (FINEART))) FINEART
Unnest Artifacts (Nest Artifacts=Title ( R1))) = R1
Why? Grouped attributes may be empty
Remaining attributes may have the same values
![Page 15: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/15.jpg)
15
Complex Value Query Languages: Calculus
Relies on (first-order) relational calculus + quantification over set (second-order) + many sorted (complex value types)
Alphabet of constants D (complex values) + a set V of variable names + a set A of attribute names
Terms: constants of D (e.g. 1, [name: ”Vassilis”], etc.) variables of V (e.g., X, Y, Z, etc.) expressions of the form t.a where a an attribute of A and t a tuple term Positive Literals: R(t), t = t’, t t’, t < t’ Well Formed Formulas: and, not, exists, forall Query: {X | } where X is the only free variable in
Range Restrictions to formulae variables guarantee safety of calculus Set-type Variables + PowerSet result in more expressive power than
the relational calculus (equivalent to Datalog-Transitive Closure) THEOREME: The above complex value algebra and the safe calculus
have the same expressive power [Kupper, Abiteboul, Grumbach, Beeri]
![Page 16: 1 III) COMPLEX VALUE DATABASES. 2 Introduction l Relax the 1 Normal Form of the Relational Model Set-value attributes (e.g., set of tuples => Relations)](https://reader036.vdocuments.us/reader036/viewer/2022081908/56649ef55503460f94c09074/html5/thumbnails/16.jpg)
16
A Critic of Complex Value Databases
Compared to the Relational Model More Complex Attribute Values Typed Data Model Expressive Power of N1NF Languages
But No Object Identity (Data Sharing) No Programming Language (Extensibility, Flexibility)