From Reality to Databases: a One-to-Many Relationship Stefano Spaccapietra Database Laboratory Swiss...

Preview:

Citation preview

From Reality to Databases:

a One-to-Many Relationship

Stefano SpaccapietraDatabase Laboratory Swiss Federal Institute of Technology Lausanne (EPFL)

joint work with

Christine PARENT & Christelle VANGENOT

http://lbd.epfl.ch

2

Outline

Database design essentials

Multiple representation

Design alternatives

3

Database Terminology

Database design (data modeling) is the activity to elaborate a formal representation of relevant information about some subset of the real world that is of interest for users (applications) of the data.

The outcome of the database design process is the schema of the database.

The formalism used to express the schema is a data model.

Database design essentials

4

Data Model

A data model is a set of concepts and rules.

Relational data model: table/relation, attribute/column, tuple/row, primary key, foreign key, …

Entity-Relationship data model: entity, entity type, relationship, relationship type, attribute, role, cardinality, identifier, …

Object-oriented data model: object, class, attribute, reference attribute, is-a hierarchy, inheritance, …

Database design essentials

5

SpatioTemporal

Evolution of Data Models

Expressive power

Data Models

Codasyl

Relational

ObjectOriented

ER

Extended ER

UMLODMG

Multi-representation

Database design essentials

6

Database Design: the Analysis Phase

recognitionstructuring

A database is a representation of that part of reality we are interested in.

perception

Real World

Database design essentials

7

Database Design : the Definition Phase

description

Jean is a young man. He is married to Arlette, and owns a green Honda CRV.

Database design essentials

8

Fundamental Abstraction: Classification

Object class:Personproperties: - family name,

- first name - age, ...

From reality to representation:

Abstracting from details to think in more generic terms, e.g. in terms of object classes rather than individual objects.

Lisa Fred ….Dylan Anne ...Zoë

Database design essentials

9

The Database Schema

A schema is a collection of types.

The database will store instances of these types.

An instance is a set of values taken by the properties attached to the type.

Person CarOwns

Married-to

Database design essentials

10

Schema and Instances

Person HouseOwns0:n 1:1

Database design essentials

11

Attributes of an Object Type

atomic,

mandatory,

monovalued

complex, optional, multivalued

Employee

Emp# Ename telephones academic-achievements positions

degree year title start-date end-date salaries

date amount

year month

Database design essentials

12

Example of an ER schema

Department Item

Employee SupplierBoss-of

boss

subord.

Dname floor quantity Iname type

name salary Sname address

quantity R

E

Database design essentials

Assigned-to

Sells

Delivery

13

Non-determinism in Database Design A database design is about choosing a representation

The outcome is a partial subjective unfaithful

description

How do we introduce flexibility to support different ways of abstracting a representation from reality ?

Database design essentials

14

Multiple Classification

Car

Vintage Car

Collectible

Transport Mean

Vehicle

Land Vehicle

Ford

Imported GoodMovie Accessory

Multiple representation

15

Multiple Viewpoints

ROADCartographer

viewpoint

Multiple representation

Construction engineerviewpoint

Traffic managerviewpoint

16

Multiple Spatial Resolution

1:25'000 scale 1:50'000 scale

17

Multidimensional Representation Space

Classification

Space granularity

Viewpoint

TimeTime granularity……

two representations of the same object in the same viewpoint at two different resolution levels

Multiple representation

18

A Snapshot Database

Classification

Time

Viewpoint

Multiple representation

19

A Map

Classification

Space granularity

Viewpoint

Road Network

1:100'000 resolution

Multiple representation

20

Classification Dimension

students

facultiespersons

technicians

secretaries

• Current Status: refinement hierarchies

Person

Faculty TechnicianSecretary

StudentEmployee

faculties

technicians

secretaries

Is-a

Multiple representation

21

Limitation: Roles

car-owners companiespersons

Person Car-owner Company

Person-with-car Company-with-carintersectionclasses

partition constraint

Car-owner = Person-with-carCompany-with-car

Person-with-car Company-with-car = Ø

Multiple representation

22

A More Direct Representation

Car-owner

OR IS-ACar-owner CompanyPerson

MAY-BE-A MAY-BE-A

+ partition constraint

Intersection link

Multiple representation

23

Viewpoint Dimension

Relational DBMS support (mostly non-updatable) views, but semantics is poor

Object-oriented DBMS have rich semantics but poor view mechanisms

Object-relational DBMS: ?

Object-oriented expressiveness augmented with intersection links, roles and revised inheritance rules will provide the best solution

Multiple representation

24

Space Granularity: Multi-resolution Cartographic Generalization is costly:

-> store the result for reuse

How do we express the linksbetween different representations ?-> update propagation

Multiple representation

25

Resolution Level 1 Resolution Level 2

Multiple Geometries for the Same Object

One possible solution : stamping spatial attributes with the spatial resolution

Spatial integrity constraints : Sinuosity (River.geometry[2]) = Sinuosity (River.geometry[1]) Length (River.geometry[2]) = Length (River.geometry[1])

River described as an area or as a

line

Rivermr geo

M

Multiple representation

26

Multiple Abstraction Levels:

Reformulation Replacing a group of objects with a new object

Example: a set of buildings close to each other is replaced with a built-up area

Multiple representation

27

Aggregation

Grouping of objects according to semantic and spatial relationships e.g., a set of buildings and

adjacent fields belonging to the same farmer grouped into a single object Farm

Derivation rules: Farm.geometry= Spatial Union

(Field.geometry,Building.geometry)

Aggregation constraint: the fields and the buildings composing

the same farm must belong to the same farmer and the fields must be adjacent.

Farm

Field Building

Composed

Composed

1,n1,n

Multiple representation

28

Cartographic Approximation

No 1-1 or n-1 mapping between ground and cartographic buildings

N-m relationship

5 ground buildings (1,2,3,4,5)

represented by

3 cartographic buildings (a,b,c)

A ground building can participate into 0 or 1  typify  relationship

GroundBuildin

g

Cartographic

Buildingtypify

t = ( {1,2,3,4,5} , {a,b,c} )

Multiple representation

29

Topological Relationships

Level 1

Level 2

At resolution level 1, the road is adjacent to the enbankment.

At resolution level 2, the embankment is no longer represented. The road is seen as adjacent to the building.

Embankment

Road

Near

M

M

M

Multiple representation

30

Hierarchical value domains

Describe the same property at different abstraction levels Hierarchical value domains for attributes (similar to classification hierarchies for objects)

cultivated area

rose iriscarnation

flower cereal oleaginous

corn barley rape sunflower

Multiple representation

31

Multidimensional Representation Space

Classification

Space granularity

Viewpoint

Time granularity

How is the representation space - presented to users?- implemented in Ddatabases?

Design alternatives

32

Possible Design Architectures

One single schema

One schema per (combination of ) coordinate(s) on dimension(s)

One schema per …… with an intrinsic schema

Design alternatives

33

A Single Schema

owner

landuseParcel

Building M

Cartographicbuilding

owner

landuse Parcel/use

agr/use

Parcel/ownerPlot

Castlecomposed

Typify

Road M along

near

on/under

Bridge

agr/owner

Design alternatives

34

A multi-resolution schema per viewpoint

Building M

Cartographicbuilding

agr/owner

owner

landuse

landuseParcel/use

agr/use

Parcel/owner

Building MPlot Castlecomposed

Typify

Road M along

near

Parcel

Bridge

on/under

owner

Viewpoint 1

Viewpoint 2

Design alternatives

35

A Schema Per Viewpoint and Resolution

Viewpoint AResolution 1

Design alternatives

inter-schemacorrespondences

Viewpoint AResolution 2

Viewpoint BResolution 2

Viewpoint BResolution 1

36

agr/use

A Schema Per Resolution and Viewpoint

Cartographicbuilding

on

Building

Road

Building

Castle

Plot

Bridge

Road

On / under

Parcel/use

near

Parcel Parcel/owneragr/owner

composed

Design alternatives

37

An Intrinsic Schema

Intrinsic schema : description of real world entities independently of any viewpoint

Intrinsic schema

schema Bschema A

Design alternatives

38

Murmur IST Project (2000-2002)

A conceptual data model supporting space, time, and multirepresentation (extension of MADS)

A corresponding query language (multirepresentation algebra)

Two application cases (cartographic, risk assessment)

A schema editor for visual data definition (DDL)

A query editor for visual data manipulation (DML), including intelligent zooming and temporal travelling

Implementation on a commercial GIS

Recommended