statistical databases in theory and practice part ii: data models bo sundgren 2010
TRANSCRIPT
![Page 1: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/1.jpg)
Statistical databases in theory and practice
Part II: Data models
Bo Sundgren
2010
![Page 2: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/2.jpg)
Conceptual data model and relational data model in normalised form
PERSON
IdentifierHouseholdIdentifier*SexAgeEducationOccupationIncomeWealthHealth
ESTABLISHMENT
EstablishmentIdentifierOrganisationIdentifier*LocationKindOfActivityNumberOfEmployeesNetProfit
ORGANISATION
OrganisationIdentifierLocationOfHQ
BELONGS TO
HOUSEHOLD
IdentifierDwellingIdentifier*SizeStructureIncome
BELONGS TO
DWELLING
IdentifierLocationSizeStandardRent
LIVES IN
MIGRATIONEVENT
IdentifierPersonIdentifier*FromDwellingId*ToDwellingId*Time
OF
FROM TO
PERSONESTABLISH-
MENT
ORGANISATION
BELONGS TO
HOUSEHOLD
BELONGS TO
DWELLINGLIVES IN
MIGRATIONEVENT
OF
FROM TO
WORKS AT
EMPLOYMENT
EMPLOYMENT
PersonIdentifier*EstablishmentIdentifier*PercentOfFullTimeSalary
![Page 3: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/3.jpg)
Conceptual modelling
• Define concepts and relations between them• Conceptual models and data models• Visualise models graphically
![Page 4: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/4.jpg)
Rent-A-Video: first object graph
VideoFilm CustomerIsRentedBy
Rents
![Page 5: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/5.jpg)
Rent-A-Video: elaborated object graph
VideoFilm CustomerIsRentedBy
Rents
FilmTitle
Rep
rese
nts
IsRep
resented
By
FilmId
Title
Category
Price
Actor*
Story
NumberOfCopies=
NumberOfRents=
FilmId
CopyNr
Rented?
NumberOfRents
CustomerId
Name
Address
Discount
Rental
CustomerId
FilmId
CopyNr
RentalNr
RentalDate
AgreedReturnDate
Returned?
ActualReturnDate
![Page 6: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/6.jpg)
Rent-A-Video: further aspects
VideoFilm CustomerIsRentedBy
Rents
FilmTitle
Rep
rese
nts
IsRep
resented
By
IsRentedBy
Ren
ts
IsReservedBy
Res
erve
s
![Page 7: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/7.jpg)
Relations between two object types
• one-to-one, symbolised by “arrow-to-arrow”
• one-to-many, symbolised by “arrow-to-fork”
• many-to-one, symbolised by “fork-to-arrow”
• many-to-many, symbolised by “fork-to-fork”
Note: The relation is usually not a flow relation!
(But you should tell what kind of relation it is.)
![Page 8: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/8.jpg)
Object graphs: another example
PERSON
PersonId
HOUSEHOLD
HouseholdId
NumberOfPersons=
Income=
Sex
CO
NS
IST
S O
F
BE
LO
NG
S T
O
Income
Age
HomeMunicipality
PostalCode
HighestEducation
IS FATHER OF
IS MOTHER OF
![Page 9: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/9.jpg)
Different roles of concept modelling
• Clarifying a small number of related concepts• Information model for an application
– defining meaning– basis for data design
• Corporate information model– for more efficient communication between people– basis for system integration
![Page 10: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/10.jpg)
Concept model ---> Data model
FilmCopy CustomerIsRentedBy
Rents
FilmTitle
Re
pre
se
nts
IsR
ep
res
en
ted
By
FilmId
Title
Category
Price
Actor*
Story
NumberOfCopies=
NumberOfRents=
FilmId
CopyNr
Rented?
NumberOfRents
CustomerId
Name
Address
Discount
Rental
Rental date
AgreedReturnDate
Returned?
ActualReturnDate
CustomerId
FilmId
CopyNr
RentalNr
CopyNr Rented?FilmId
FilmId CopyNr CustomerId RentalNrRentals
FilmCopies
Name AddressCustomerIdCustomers
NumberOfRents
RentalDate
AgreedReturnDate
Returned?Actual
ReturnDate
Discount
FilmId Title Category Price StoryAgreed
ReturnDateReturned?
ActualReturnDate
ActorNameFilmIdActorsInFilms ActorsRoleInFilm
FilmTitles
![Page 11: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/11.jpg)
CopyNr Rented?FilmId
FilmId CopyNr CustomerId RentalNrRentals
FilmCopies
Name AddressCustomerIdCustomers
NumberOfRents
RentalDate
AgreedReturnDate
Returned?Actual
ReturnDate
Discount
FilmId Title Category Price StoryAgreed
ReturnDateReturned?
ActualReturnDate
ActorNameFilmIdActorsInFilms ActorsRoleInFilm
FilmTitles
![Page 12: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/12.jpg)
Conceptual model ---> Star/cube model
FilmCopy CustomerIsRentedBy
Rents
FilmTitle
Re
pre
se
nts
IsR
ep
res
en
ted
By
FilmId
Title
Category
Price
Actor*
Story
NumberOfCopies=
NumberOfRents=
FilmId
CopyNr
Rented?
NumberOfRents
CustomerId
Name
Address
Discount
Rental
Rental date
AgreedReturnDate
Returned?
ActualReturnDate
CustomerId
FilmId
CopyNr
RentalNr
OBJECT IN FOCUS
FilmTitle
Customer
PriceGroup
NumberOfRentsPerCopy
FilmId
Title
Category
NumberOfRents
CustomerId
Category
Area
Rental
Rental date
Delayed?
CustomerId
FilmId
RentalNr
FILMCATEGORY
CUSTOMER DIS-COUNT CATEGORY
Number of rentals of film copiesduring the year t by customer
discount category and film category
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
![Page 13: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/13.jpg)
Star model for Data Warehouse
OBJECT IN FOCUS
FilmTitle
Customer
PriceGroup
NumberOfRentsPerCopy
FilmId
Title
Category
NumberOfRents
CustomerId
Category
Area
Rental
Rental date
Delayed?
CustomerId
FilmId
RentalNr
![Page 14: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/14.jpg)
Multidimensional model (cube model)
FILMCATEGORY
CUSTOMER DIS-COUNT CATEGORY
Number of rentals of film copiesduring the year t by customer
discount category and film category
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
number ofrentals
![Page 15: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/15.jpg)
Part II: Extra material
Bo Sundgren
2010
![Page 16: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/16.jpg)
Concept modelling: Exercises
• B2B– The customers of companies are companies– Companies have employees (persons)
• B2C– The customers of companies are consumers (persons)– Companies have employees (persons)
• B2B+B2C– The customers of companies are companies or
consumers (persons)– Companies have employees (persons)
Hint: There are two basic object types, COMPANY and PERSON in all three examples
![Page 17: Statistical databases in theory and practice Part II: Data models Bo Sundgren 2010](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649f515503460f94c7482d/html5/thumbnails/17.jpg)
Illustrate the following three examples by:
• basic object graphs (micro-level)• relational data models (micro-level)• multidimensional cubes (hypercubes)• star models• relational data models (macro-level)