Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

33
Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses

Transcript of Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Page 1: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1

Chapter 5

Temporal Data Warehouses

Page 2: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 2

Fig. 5.1. Three different implementation types of slowly changing dimensions

(a) Type 1

(b) Type 2

(c) Type 3

Product

Size

101

102

Prod.number

...QB876

QD555

Name DescriptionSurr.key

...

...

Muesli

Olive Oil ...

...375

750

Product

Size

101

102

Prod.number

...QB876

QD555

Name DescriptionSurr.key

...

...

Muesli

Olive Oil ...

...375

750

Product

Current size

101

102

Prod.number

QB876

QD555

NameEffective

dateSurr.key

Muesli

Olive Oil

500

750

Original size

375

750

8/11/2006

7/10/2005

...

Description ...

......

...

Page 3: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 3

Fig. 5.2. Representing the temporal characteristics of real-world phenomena as events or as states

(a) Events

(b) States

1/09/04

Car accident

Time(day) ... 15/09/04 ......

1/04 4/04 ...

Project A

Time(month)

2/04 3/04 5/04 6/04 7/04 8/04 9/04 10/04

Project B

Page 4: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 4

Fig. 5.3. Temporal data types

SimpleTime

ComplexTime

Instant

Time

Interval InstantSet

IntervalSet

(total,exclusive)

cs

(total,exclusive)

Page 5: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 5

Fig. 5.4. Icons for the various synchronization relationships

meets

contains/inside

equals

starts

precedes

overlaps/intersects

covers/coveredBy

disjoint

finishes

succeeds

Page 6: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 6

Fig. 5.5. A conceptual schema for a temporal data warehouse

Product

Product numberNameDescription

Product groups

Category

Category nameDescription

LS

Store

Store numberNameAddressManager’s nameArea

Sales organization

Sales district

District nameRepresentativeContact info

Client

Client idFirst nameLast nameBirth dateProfessionSalary rangeAddress

Sales

Quantity Amount VT

LS

LS

VTSizeDistributor

LS

ResponsibleMax. amount

LS

VT

LS

District areaNo employees

LS

VT

Page 7: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 7

Fig. 5.6. Types of temporal support for a level

(a) Temporal level

(b) Temporal level with temporal

attributes

(c) Non-temporal level with temporal

attributes

Product

Product numberNameDescriptionSizeDistributor

LS Product

Product numberNameDescription

SizeDistributor

VT

LS Product

Product numberNameDescription

SizeDistributor

VT

Page 8: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 8

Fig. 5.7. A nontemporal relationship between temporal levels

Product

Product numberNameDescription

Pro

duct

gro

ups Category

Category nameDescription

VTResponsibleMax. amount

LS

SizeDistributor

LS

VT

Page 9: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 9

Fig. 5.8. An example of an incorrect analysis scenario when a nontemporal relationship between temporal levels changes

(a) (b)

Timet1

PProduct

Product-Category

CCategory

t2

P-C

Timet1

P

C C1

t2

P-C1

Page 10: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 10

Fig. 5.9. A temporal relationship between nontemporal levels

LS

Wor

k

Employee

Employee idEmployee namePosition...

Section

Section nameDescriptionActivity...

Page 11: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 11

Fig. 5.10. Links kept by a temporal relationship between nontemporal levels:

(a) before and (b) after deleting a section

(a) (b)

Timet1

EEmployee

Employee-Section

SSection

t2

E-S

Timet1

E

S1

t2

E-S1

Page 12: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 12

Fig. 5.11. A temporal relationship between temporal levels

Store

Store numberNameAddressManager’s nameArea S

ales

org

ani

zatio

n Sales district

District nameRepresentativeContact info

LS

LS

District areaNo employees

LS

VT

Page 13: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 13

Fig. 5.12. Instant and lifespan cardinalities between hierarchy levels

LS

Affi

liatio

n

Employee

Employee idEmployee namePosition...

Section

Section nameDescriptionActivity...LS

Wor

k LS

Page 14: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 14

Fig. 5.13. Schema for analysis of indemnities paid by an insurance company

Policy No...

Indemnities

Client

Client No...

Insurance policy

Coverage

LS

LS

Risk No...

RiskLS

Amount VT

Repair No...

Repair work

LS Event

Event No...

LS

Page 15: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 15

Fig. 5.14. Inclusion of loading time for measures

Category

Category nameDescription...

Product

Product numberProduct nameDescriptionSize... P

rodu

ct g

roup

s

Supplier

Supplier idSupplier nameAdress ...

Warehouse

WH numberWH nameAddressCity nameState name...

Inventory

Quantity CostLT

Page 16: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 16Fig. 5.15. Inclusion of valid time for measures

(a) Events

(b) States

Transaction type

IdName ...

Account

Account idAccount type...

Transactions

AmountVT

Client

Client idClient nameAddress...

Project

Project idProject nameObjectivesSize...

Employee

Employee idEmployee name Address...

Department

Department idDepartment name Manager...

Works

SalaryVT

Page 17: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 17

Fig. 5.16. Usefulness of including both valid time and loading time

100

LT1

10 no sales

10 13 ...Time

(weeks) 11

5200 500

2012 14

LT2

Sales

Page 18: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 18

Fig. 5.17. A temporal data warehouse schema for an insurance company

Insurance type

Type idInsurance nameCategory...

Insurance object

Object idObject name ...

Insurance agency

Agency idAddress...

Frauddetection

AmountTT

Client

Client idClient nameAddress...

Page 19: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 19

Fig. 5.18. Usefulness of valid time, transaction time, and loading time

100 VT[2:5]

LT1

1 4 ...

Salary

Time(months) 2 83

LT2

200 VT[6:now]

TT1 TT2

Page 20: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 20

Fig. 5.19. An example of distribution of measures in the case of temporal relationships

(a) (c)(b)

SD2SD1

2535

1020 30

Time

SD1 SD2

Sales district of store S

Measure for store S

Measure distributed between sales districts

SD2SD1

3020

3020

Time

SD1 SD2

SD2SD1

3614

3020

Time

SD2SD1

Page 21: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 21

Fig. 5.20. Different temporal granularities in dimensions and measures

6 8 3Quantity sold

Time (week)

Store-Sales district

...

4 5 1

Time (month) Jan

S-SD S-SD1

Feb

Page 22: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 22

Fig. 5.21. Example of a coercion function for salary

20

1 3 6

1 2

Sources (month)

Salary

Data warehouse(quarter)

9

VT1

3

30 40

VT2 VT3

20Average salary 30 ?

LT

2

Page 23: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 23

Fig. 5.22. Metamodel of the temporally extended MultiDim model

/Name: string/Temporal: Boolean

Dimension

Criterion: string/Temporal: Boolean

Hierarchy

1..*

DimHierAgg

1

HierLevAgg

1..*

2..*

1..*

Name: stringTemSup: Temp [0..n]

Level

1..*

0..*

child parent

1

0..*

Additivity: AddType

Measure

LevAttrAgg

KeyAttrAgg

1

1..*

Name: stringSync: SyncRel

Fact relationship

1

0..*2..*

1..*MeasAgg

Generalization

AggregationComposition

Association

Derived attribute/

Identified0..*

Key

Connects

RoleName: string

Related

Name: stringType: DataTypeDerived: BooleanTempSup: Temp [0..n]

Attribute

xor

1

1

« enumeration »DataType

integerrealstringTDType...

« enumeration »TDType

InstantIntervalInstantSet...

« enumeration »SyncRel

meetsoverlapscontains...

« enumeration »AddType

additivesemiadditivenonadditive

MinInstChildCard: intMaxInstChildCard: intMinInstParentCard: intMaxInstParentCard: intMinLifespChildCard: intMaxLifespChildCard: intMinLifespParentCard: intMaxLifespParentCard: intDistrFactor: BooleanTempSup: Temp [0..n]Sync: SyncRel

« data type »Temp

Type: TempTypeDataType: TDTypeGran: Granularity

« enumeration »TempType

LSVTTTLT

« enumeration »Granularity

secminhour...

Page 24: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 24

Fig. 5.23. Mapping levels with temporal attributes

(a) ER schema (b) Object-relational representation

(c) ER schema (d) Object-relational representation

Product

Product numberNameDescriptionSize (1,n) Value VT FromDate ToDate ...

Product

FromDate ToDate

VT

Size*

ValuePId

1

2

Productnumber

QB876

QD555

...

...

... ...

...

...10

20

18

05/2002

09/2002

05/2002

08/2002

07/2003

now

Product

FromDate ToDate

VT*

Size*

ValuePId

1

2

Productnumber

QB876

QD555

...

...

... ...

...

...10

20

18

05/2002

09/2002

08/2003

05/2002

08/2002

07/2003

now

now

Product

Product numberNameDescriptionSize (1,n) Value VT (1,n) FromDate ToDate...

Page 25: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 25

Fig. 5.24. Mapping a temporal level

(a) ER schema (b) Object-relational representation

Product

LS (1,n)FromDate

ToDateProduct number NameDescriptionSize (1,n) Value VT (1,n) FromDate ToDate ...

Product

10

LS*

FromDate ToDate

VT*

Size*

ValuePId

1

2

3

Productnumber

...

...

...

...

QB876

QD555

QE666

20

15

18

25

18

05/2002 08/2002

07/200309/2002

07/2003 now

now05/2002

05/2002 08/2003

now09/2004

FromDate ToDate

now

now

08/2003

now

05/2002

09/2004

05/2002

05/2002

Page 26: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 26

Fig. 5.25. Mapping a hierarchy with a nontemporal relationship

(a) ER schema

(b) Object-relational representation

CategoryProduct (1,n)(1,1)

Product numberNameDescriptionSize (1,n) Value VT (1,n) FromDate ToDate

Category nameDescriptionResponsible (1,n) Name VT (1,n) FromDate ToDate

ProdCat

Product

10

VT*

Size*

ValuePId

Productnumber

...

...

...

1

2

QB876

QD555

CategoryRef

C1

C218

20

FromDate

08/200205/2002

08/2003

09/2002

05/2002

ToDate

now

07/2003

now

Page 27: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 27

Fig. 5.26. Various cardinalities for temporal relationships linking nontemporal levels

(a)

(c)

(b)

LS

Wor

k

Employee

Employee idEmployee namePosition...

Section

Section nameDescriptionActivity...

Wor

k

Employee

Employee idEmployee namePosition...

Section

Section nameDescriptionActivity...

LS

LS

Employee

Employee idEmployee namePosition...

Section

Section nameDescriptionActivity...

Wor

k LS

Page 28: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 28

Fig. 5.27. Mapping the schema given in Fig. 5.26a into the ER model

SectionEmployee (1,1) (1,n)

LS (1,n) FromDate ToDate

Employee idEmployee namePosition...

Section nameDescriptionActivity...

Works

Page 29: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 29

Fig. 5.28. Various object-relational representations of temporal links

(a) One-to-many cardinalities

(b) One-to-many cardinalities

(c) Many-to-many cardinalities

Works

S1

S1

LS*SectionRef

Empl.Ref

E1

E2 05/2002

FromDate ToDate

now

now

08/2002

07/2003

05/2002

WId

1

2

Employee

05/2002

S1

S1

FromDate ToDate

LS*

InSection

SectionRef

EId

1

2

Empl.id

E2244

E2345 ...

...

...

now

now

08/2002

07/2003

05/2002

Employee

05/2002

S1

S2

S1

FromDate ToDate

LS*

InSection*

SectionRef

EId

1

2

Empl.id

E2244

E2345 ...

...

...

now

now

06/2003

08/2002

07/2003

05/2002

09/2002

Page 30: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 30

Fig. 5.29. Mapping a temporal relationship between temporal levels

(a) MultiDim schema

(b) Object-relational representation

Store

Store numberNameAddressManager’s nameArea S

ales

org

ani

zatio

n Sales district

RepresentativeContact info

LS

LS

LS

VTDistrict nameDistrict areaNo employees

LS

SalesDistrict

LS*DId

A

B

District name

Ixelles

Forest

...

...

...

FromDate ToDate

05/2002 08/2003

10/2004 now

now05/2002

Store

A

B

B

B

LS*

SalesOrganization*

DistrictRef

LS*SId

1

2

3

Storenumber

QB876

QE666

QD555

...

...

...

...

FromDate ToDate

05/2002

10/2004

09/2002

05/2002

05/2002 now

now

09/2004

now

08/2002

FromDate ToDate

now

now

now

05/2002

05/2002

05/2002

09/2004

08/2003

Page 31: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 31

Fig. 5.30. Mapping of the fact relationship shown in Fig. 5.5

(a) ER representation

(c) Object-relational representation

(b) Relational table for the Quantity measure

Quantity (1,n) Value VT (1,n)Amount (1,n) Value VT (1,n)

Sales

Sales

Client fkey

Product fkey

Storefkey Quantity VT

C1

C1

C1

C1

...

C1

P1

P1

P1

P1

...

P1

... ... ...

S2

S2

S2

S1

S1 100

100

200

50

80

05/2002

06/2002

07/2002

07/2002

05/2002C1 P1 S1

150 06/2002

Sales

10000 05/2002

15000

18000

06/2002

07/2002

10005/2002

150

07/2002

06/2002

2000005/2002

5000

07/2002

06/2002

200 05/2002

80

06/2002

07/2002

50

...

VT*

Quantity*

Value VT*

Amount*

Value

ClientRef

C1

ProductRef

StoreRef

C1

...

P1 S1

P1 S2

... ... ... ... ...

SId

1

2

...

Page 32: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 32

Fig. 5.31. Approaches to measure aggregation in the presence of temporal relationships

(a) Excerpt from the schema shown in Fig. 5.5

Store

Store numberNameAddressManager’s nameArea

Sales district

District nameRepresentativeContact info

Sales

Quantity Amount VT

LS

LS

LSDistrict areaNo employees

LS

VT

Sal

es o

rga

niza

tion

Page 33: Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 1 Chapter 5 Temporal Data Warehouses.

Copyright © 2008 Elzbieta Malinowski & Esteban Zimányi 33

Fig. 5.31. Approaches to measure aggregation in the presence of temporal relationships

(b) Tables for the parent-child and fact relationships

(e) Eder and Koncilia’s aggregation

(c) Sales districts and the measure Quantity for stores S1, S2, and S3

(d) Traditional temporal aggregation

StoreRef Quantity Amount FromDate ToDate

StoreRef SDRef FromDate ToDate

Sales

Store_SD

5 8 4 6 4 3S1

SD SD1

S2 2 4 5 4 8 7

SD SD1

S3 5 4 3 7 6 9

SD SD2

SD2 7 6 9

SD 12 16 12

SD1 10 12 10

SD2 5 4 3 7 6 9

SD1 7 12 9 10 12 10