Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice ... · MBDS course : « From data bases to...

Preview:

Citation preview

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)1

www.mbds-fr.org

MBDS course :

« From data bases to big data »

(7 lectures)

Professor Serge Miranda

Dept of Computer Science

University of Nice Sophia Antipolis (member of UCA)

Director of MBDS Master degree

(www.mbds-fr.org)

www.mbds-fr.org

Date’s manifesto on object-relational data model

(third manifesto on future data bases)

(Lecture 4)

Professor Serge Miranda

Departement of Computer Science

Université of Nice Sophia Antipolis (UCA)

Director of MBDS Master degree (www.mbds-fr.org)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)4

CONTENTS

1. Object paradigm and data bases

2. Object-oriented data model ?

➢Objects ?

➢Consensus on object properties

➢« RICE » properties of object systems

3. Object-relational data models

➢Two basic approachs

➢TABLE (ans SQL) centrics : Second Manifesto by M.Stonebraker

➢DOMAIN centrics : Third Manifesto by Chris date

➢ Examples : 2D DATA store and THESAURUS

4. TIPS Researchs

Short Seminar 1 : The second DB manifesto by M.Stonebraker

Short Seminar 2 : Object middleware and Universal access (Microsoft)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)5

DATA MODEL ?

➢Three families of DATA models :

➢Computing(IMS, DBTG…)

➢Mathematics (Relational/SQL, Category/ NO SQL, Linear Algebra. ML & DL)

➢Semantics(OBJECT, semantic nets)

DATA MODEL

DATA STRUCTURES

Structure-based operators

(algebra)

Integrity rules

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)6

Codd’s data model and (relational data model)

➢« CODD’s relational data model »

➔ Prerequisite to SQL2

➢« DATE’s object-relational data

model ( 3rd manifesto) »

➔ Prerequisite to SQL3

(and ODMG)

➢DATA STRUCTURES of CODD’srelational model

➢« VALUES » (value paradigm)

➢« DOMAINS » (semantical data type)

➢ « RELATIONS »

➢Attributes/PK/FK

➢Dual formal definition (SET or PREDICATE)

➢Example of CODD’s relational data model on PILOT relation ?

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)7

DATA BASE market & standards

(Stonebraker 96 & Gartner)

DATA

PROCESSING

SQL

No SQL

Simple Complex (graphs,..)

R-DBMS

SQL3Mobiquitous &

Big Data systems

ODMG CAD

OR-DBMS

OO-DBMSFile System

(Office automation)

(1) (2)

(3)

SQL2Production Decision

2010 2020

(1) 10 G dollars

20% of cont. Growing rate

(2) 2x (3) 2x (1)!

(3) 1/100 x (1)

1/100 x (1)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)8

TIPS properties for STRUCTURED DATA stores

T

I

P

S

Transactions (with ACID properties)

No-procedural Interface (SQL)

Persistency (virtual paged memory)

Structuration (Schema)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)9

TOP DOWN approach of structureddata stores

➢2 Phases for DB management 1. SCHEMA DEFINITION (UML, Codd&Date, etc)

2. DB Creation with a DBMS Engine and SQL standard

➢TRANSACTION-oriented applications (OLTP : On-Line Transaction Processing)➢TIPS properties

➢ACID properties

➢Decision–support applications (OLCP : On-Line Complex Processing) with SQL extensions➢DATAWAREHOUSE

➢DATA MINING

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)10

Structured-data store evolution

➢Huge data bases (cf BIG DATA) :

➢Petabytes DB (10**15 )

➢Exabytes(10**18),

➢Then Zetta bytes (10**21), Yotta bytes (10**24) and …Google(10**99)

➢SERVER scalability

➢SCALE UP (SMP, Cluster, MPP)

➢SCALE OUT

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)11

DATA variety to be integrated

➢Stronger-structured data (schema)

➢Embedded objects

➢USER-DEFINED DATA TYPES/FUNCTIONS (extensible ADT)

➢Bottom up compatibility

➢Semi-structured and unstructured DATA

➢BLOBS – Binary Large Objects – (video,..) and CLOBS (Character LOB)

➢WEB data

➢Open DATA

➢Semantical links (hyper links)

➢New interfaces : multimedia-content based, neural nets (voice interface)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)12

Hybrid Object–Relational (OR) data model ?

➢OR DM extending… the relational data model

➢Formal unique relational basis

➢Multiple object data models (some consensus on properties)

➔ Enrich relational data model properties with specific

consensus object properties

« OBJECT »

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)14

Object concepts

➢OBJECTS ?

➢ Object definitions

➢ Object integration : Hybrid Object-relational data model

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)15

Weakness of relational data models

➢Operators separated from data

➢Stored procedures

➢Lack of hidden attributes

➢Atomic domains

➢Limitations to normalized relations (3NF)

➢Limitations to hierarchys and graphs representation (transitive closure)

➢Complex objects

➢Transaction focus with decision-support inadequacies

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)16

Evolution of Computer Science and OBJECTS

PLOS

PL

AI

File systems DBMS

1965

1970

OS : Operating « SERVICES » ?

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)17

Evolution of computing : OS and DBMS

1970

R-DBMSOS FS

OS services DBMS services

Physical resource managementSwapping algorithms (pagedmemory)

SECURITY Privacy protectionConcurrency Control(semaphors, Locking, deadlock,... )

MODELS(" process ") ...no programming language

(TIPS properties) :

(P) Persistance (Page) managementLRU ++

(T) SECURITY & Transaction support(ACID) DATA INTEGRITY

(S) DATA Structuration/Schema thru data models

(I) User Interface (SQL)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)18

Evolution of computing and OBJECTS

PL

AI OS

DBMS

1980-1990

OBJECTS

OS

DBMS

AI

PL

1990

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)19

Computing future : Towards mobiquitous DATA spaces

? ? ?

2030

" It is hard to predict ..especially the future" N.Boehr

« SERVICES » ?

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)20

Data computing and objects

DATA PROCESSING

Objects

Communication

SQL(Structured data management)

PL(Structured programming)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)21

Object approach and application development

INTERFACE

APPLICATION

DBMS

DB

Object integration

PB : IMPEDANCE MISMATCH

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)22

Waves of distributed computing

CLOUD

CLIENT SERVER

File systems

•Distributed objects

•Web Services

•SQL server

•Groupware

•TP Monitor

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)23

Software evolution towardsmiddleware for distributed computing

Middleware

DBMS

OS

• Tight coupling (Corba, RPC)

• Loose coupling(REST, web services)

• TIPS

• IP

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)24

OBJECT duality

Encapsulated

OBJECT (PL)

-Specificoperators(Methods)

-Inheritance

BLACK BOX

Structured

OBJECT (DB)

-genericoperators(algebra)

-Persistence

WHITE BOX

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)25

Object attractiveness

➢NATURALNESS :

➢Men deal with objects and computers with DATA

➢Normalized relations are (simple but) not natural

➢COMPLEXITY :

➢Att inventes C++ to deal with concentrators (200 000 lines of programming)

➢REUSE and flexibility :

➢Kit programming

➢ENCAPSULATION :

➢DATA along with associated processing

➢A fuzzy unifying concept !

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)26

Unbearable Lightness of Beingan object !

OBJECT ?

« An identifiable thing which plays a role in regards of an operation..etc… » (X3-SPARC, SEPT.91, OODBTG, pp 3.6)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)27

Object ?

➢ (MIRA96) and (MIRA2002)

Un objet est une capsule logicielle (E) oblative identifiée (I)

avec un tropisme connatif incrémental (C) dont l’hétéronomie est la marque de la durée de l’éphémère

et la hoirie (R), la marque de la richesse.

« An OBJECT is an identified (I) oblative software capsule ( E) with an incremental (C) natural tropism whose heteronomy is its

ephemere–duration mark and hoirie (R), its wealth mark »

➢ (MIRA96) and (MIRA2002)

« An OBJECT is an identified (I) oblative software capsule ( E) with an incremental (C) natural tropism whose heteronomy is its

ephemere–duration mark and hoirie (R), its wealth mark »

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)28

Object contributions to data management : RICE properties (Mira96)

R

I

C

E

Reusability (Inheritance or polymorphism)

Identification (OID : Object Identifier)

Complex Object construct

Encapsulation (Methods)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)29

OBJECTS and Object CLASS

➢OBJECT ?

➢OBJECT = (OID, VALUE) *➢OID : Object Identifier

➢➔ HASHING, b-TREE, …

➢An Object CLASS

➢IS (potential values)

➢HAS (real values)

a data type verifying the RICE properties

*cf (KEY, VALUE) in N.O.SQL data stores

SETconstruct

OBJECT

CLASS

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)30

OR data model and properties

OR data model

(TIPS + RICE)

Object

Model

(RICE)

Relationaldata model

(TIPS)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)31

Object data model

➢NEW object data model : OO (Object-oriented)

➢First manifesto by Francois Bancilhon

➢ODMG standard

➢Enrichment of relational data model : OR (Object relational)

➢Second Manifesto by Mike Stonebraker

➢Third manifesto by Chris Date

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)32

Three approaches for OBJECT Data models

•RICE properties• 1st Manifesto (F. Bancilhon)

• Based upon Object programming

VALUES

•RICE properties• 3rd Manifesto (C.Date)

• Based upon Codd’s relationaldata model

DOMAINS

•RICE properties• 2nd Manifesto

(M. Stonebraker)

• Based upon SQL

RELATIONS

SQL3

ODMG

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)33

SQL3 and OR data model

➢SQL3 encompasses two manifestos

➔ 2 possibilities to create an object class

➢CREATE TYPE (cf « Date »)➢CREATE TABLE (cf « Stonebraker »)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)34

RICE properties in the relational DM

Relational data modelR

I

C

E

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)35

Example : Object structural graph (cf IFO)

EMPLOYEE

HOSTESSPILOT

FLIGHT PLANE

Notation : « Inheritance»« SET OF »« TUPLE »« Class »

NUMBERH DC FLIGHT

STREET CITY NUMBER

E# ENAME ADDRESS

F# DC AC DT AT PLANE

PNAME CAP

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)36

Exercice

➢Take the PILOT class and represent it in Codd’s relational data model

➢Take this example again at the end of the course and represent it in Date’s manifesto

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)37

Back to the future withDate’s 3rd manifesto

C.Date, H. Darwen « Date base programming and design » January 1995 pp.25-34 http://thethirdmanifesto.com/

« Object features are orthogonal to the Relational DM and thereforeRDM needs no extension, no correction, no subsumption, no perversion in order for them to be accommodated »

Chris DATE

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)38

OR data model : first possibility

➢First approach : RELATION with RICE properties

➢Example : UNISQL, POSTGRES,…EX : CREATE OBJECT CLASS PILOT PUBLIC PIL# NUMERIC, PILname CHAR, ADDR CHAR) ;

➢Advantage : unique concept for TABLE and CLASS

➢Problems :

➢PB1 : objects = tuples ➔ encapsulation and relational algebra ?

➢PB2 : Generic and specific operators within query expressions

➢PB3: Closure

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)39

OR data model : second possibility

➢Second approach : DOMAINS with RICE properties

➢Advantages :

➢Object duality➔ Dual Object structures

➢Domains are naturally extendable to classes

➢Problem : structural inheritance

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)40

CLASS and DOMAIN consistency

➢OBJECT CLASS = « DATA TYPE with RICE properties »

➢DOMAIN of Codd’s relational data model :

« Semantical data type »

➢DOMAIN in Date’s manifesto and OR data model :

« Semantical data type with RICE properties »

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)41

Double inheritance in DATA BASES

➢DB INHERITANCE is twofold :

➢SI : STRUCTURAL inheritance (attributes)

➢OI : OPERATIONAL inheritance (methods)

➢In the 2nd manifesto : SI + OI on TABLES

➢In the 3rd manifesto :

➢OI at DOMAIN level

➢SI (at table level) thru a dedicated inheritance operator noted « ➔ » involving primary domains

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)42

DATE’s manifesto : Inheritance at primary-domain level

➢Declarative approach for primary domains

➢Example :

Create Domain PILNO UNDER EMPNO

Create Domain HOSTESSNO UNDER EMPNO 100 103

100 103

EMPNO

PILNO

HostessNO

➢Inheritance graph among primary domains

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)43

Structural inheritance

➢2 possibilities :

➢Declarative approach : DATA STRUCTURE ➢Example : UNDER Clause among TABLES (2nd manifesto)

➢Manipulation approach : OPERATOR➢Example : ‘➔’ operator on primary keys (3rd manifesto)

PK➔ {ATTi} <ATTi being any attribute in the inheritance graph>

➢DOMAIN index and ‘➔’ operator

➢Example : value 100 for EMPNO and access to any tuple having the ‘100’ value for PK or FK

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)44

Structural inhéritance in DATE’smanifesto «PK➔ {ATTi} » ?

➢TABLEs➢EMPLOYEE (E# : EMPNO, Ename, Salary, ADDR)➢PILOT (PIL# : PILNO, NBHF)➢HOSTESS (H# : HOSTESSNO, RANK)

Q : SELECT PIL#➔ Ename, Salary,NBHF

FROM PILOT

WHERE (PIL#➔) NBHF >

(SELECT MAX NBHF FROM PILOT

WHERE PIL#➔ ADDR = ‘Nice’);

EMPNO

PILNO

HostessNO

100 103

100 103

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)45

Exercice

➢Give another form of the query using E# ➔

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)46

Solution with E#

SELECT E# ➔ Ename, Salary,NBHF

FROM EMPLOYEE

WHERE E# ➔ NBHF >

( SELECT MAX NBHF FROM PILOT

WHERE E#➔ ADDR = ‘Nice ’);

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)47

D language

(« D » for « Domain » ?... « C++ » ?... « DATE » ?)

➢Object class attached to relational DOMAINS (RICE)

➢« Encapsulated semantical data types whose values could be complex withassociated functions »

➢and (R)ICE properties at the domain level

➢UNDER Clause among primary domains :

« SUB-DOMAIN » and « SUPER-DOMAIN »

Example : Create Domain Hostessno UNDER Empno

➢C.Date, « user-defined data types and functions including inheritance are orthogonal to the relational data model »

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)48

D language (SQL-D)

➢Examples illustrating ( R ) ICE at domain level(3rd manifesto) with the D language :

➢2D

➢Thesaurus

➢Exercice : Inheritance with primary domains and ‘➔’ operator

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)49

Summary of dual Date’s enrichment of Codd’smodel

➢PRIMARY DOMAIN inheritance➢EX : PILNO under EMPNO (➔ operational inheritance)

➢ INHERITANCE operator➢Ex : PIL#➔ EMPADDR, NBHF (➔ structural inheritance)

➢< PL#, PK definied on the Primary domain PILNO>

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)50

Example 1 : 2D data (M. Stonebraker and C.Date)

CREATE TABLE RECTANGLES

(RECTID, x1, x2, y1,y2)

PRIMARY KEY (RECTID)

UNIQUE (x1, x2, y1, y2)

QUESTION (in SQL2) :What are the rectangles overlapping the square (0, 1, 0, 1) ?

(1,1)

1

1

X1 X2

Y2Y1

(0,0)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)51

SOLUTION : 2D query in SQL2

➢Q : What are the rectangles overlapping the square (0, 1, 0, 1) ?

<With 10 conditions>

SELECT * From RECTANGLES Where

(x1>=0 AND x1<=1 AND y1>=0 AND y2<=1)

OR (x2>=0 AND x2<=1...)...OR...

OR (x1<=0 AND x2<=1 AND y2<=0 and y2<=1)…

<with some trick >

SELECT * FROM rectangle

WHERE x1 BETWEEN 0 AND 1) INTERSECT (SELECT * FROM rectangle WHERE y1 BETWEEN 0 AND 1)

UNION

(SELECT * FROM rectangle

WHERE x2 BETWEEN 0 AND 1) INTERSECT (SELECT * FROM rectangle WHERE y2 BETWEEN 0 AND 1);

--

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)52

2D Example (C.Date) : Domain creation

CREATE DOMAIN RECTANGLE ( ... RTREE ... )CREATE FUNCTION MAKE-RECT

(A FLOAT, B FLOAT, C FLOAT, D FLOAT)RETURNS ( RECTANGLE )AS BEGIN

DECLARE R RECTANGLER.x1 = A; R.x2 = B; R.y1 = C; R.y2 = D;RETURN (R)

END;CREATE FUNCTION OVERLAP( R1 RECTANGLE, R2 RECTANGLE )RETURNS ( BOOLEAN )AS BEGIN ... END;

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)53

2D Example : relation creation

CREATE RELATION RECTANGLES

( RECTID : RECTNO,

AR : RECTANGLE, ...)

PRIMARY KEY ( RECTID )

UNIQUE ( R ) ;

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)54

2D Example : Query in D language (Date)

Q :

SELECT *

FROM RECTANGLES R

WHERE

OVERLAP (R, MAKE_RECT(0,1,0,1))= TRUE;

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)55

DB research on object-relational waves

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)56

DB research (TIPS)

T

I

P

Long-duration and bursty transactions

Multimedia and neural voice interfaces

Big data and very-light DB ; data lakes ; virtual memory management ; main memory DB ; access methos

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)57

DB research (TIPS)

S

Object-relational DBMS (bridges between ODMG and SQL3)

Semi-structured data (bridges SaprQL and SQL)

SQL extension to handle ML, DL and NO SQL

Query optimization

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)58

Exercice : THESAURUS

➢THESAURUS : a DOMAIN i.e. a set of key words (values) with strongsemantical links among them

➢Note : a thesaurus is a semantical net

➢ THESAURUS role

➢Uniform indexing

➢Extension or reduction of the query outcome

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)59

Thesaurus (ontology) : semantical links among KEY WORDS (values)

Computer Science

Software

/LOGICIEL

Operating systems

/OS

Data base systems

/DBMS

Hardware

/MATERIEL

Data base machines

/MPP

3 semantical links :- SYNONYMY (/)- CLOSENESS ( )- HIERARCHY

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)60

Exercice

1.Give the following entity in a normalized relational format ?

DOCUMENT entity :

(DOC#, title, editor, PAGES, {authors}, {keywords})

2.Give a relational schema to represent a thesaurus itself

(with binary relations)

3.Give a SQL2 form for the following query :

What are the documents concerning software (using

thesaurus semantical links to extend the query) whose title

starts with « concepts » ?

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)61

Exercice

4.Give Dates’s object-relational schema and query for this thesaurus

example (in D language)

5.Introduce a super class : « Document » [LOAN function] with 2 sub

classes : « BOOK » and « HANDOUT » [COPY Function]

➢Buid primary domain hierarchy

➢Use inheritance operator to process the following query

What is the number of pages of books published by Dunod which are on loan ?

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)62

Solution : Thesaurus

➢Documentary DB in the relational schema :

➢3 normalized relations :

➢DOCUMENT (DOC#, title, editor, PAGES)

➢DOC-author (DOC#, author)

➢DOC-keyword (DOC#, keyword)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)63

Thesaurus (Cont’)

Thesaurus (type..)

1. With one relation :

➢THESAURUS (keyword1, keyword2, TYPE)

DB Data Base synonymy

Software Data Base hierarchy...

2. OR 3 binary relations :

➢SYNONYMY*(keyword1, keyword2)

Data Base DB...

➢HIERARCHY( keyword-GEN, keyword-SPEC)

Computing Software...

➢CLOSENESS*(keyword1, keyword2)

DB DB Machine

* and REFLEXIVITy !

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)64

SQL2 for the query

➢Q - What are the documents concerning software (using thesaurus semanticallinks to extend the query) whose title starts with « concepts » ?

SELECT *FROM DOCUMENT, DOC-author, DOC-keyword

WHERE DOCUMENT.DOC#=DOC-author.DOC#

and DOCUMENT.DOC#=DOC-keyword.DOC#

and TITLE=“CONCEPT%”

and (DOC-keyword.keyword = “Software”

or DOC-keyword.keyword IN

(SELECT keyword2 FROM SYNONYMY

WHERE keyword1 = “Software”) <+ INVERSE>

or DOC-keyword.keyword IN

(SELECT keyword-SPEC FROM HIERARCHY

WHERE keyword-GEN = “Software”)

or DOC-keyword.keyword IN

(SELECT keyword2 FROM CLOSENESS

WHERE keyword1 = “Software” ); <+ INVERSE>)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)65

OR schema (Chris DATE)

With encapsulated domains

CREATE DOMAIN THESAURUS/KEYWORD ( ... )

CREATE FUNCTION SYNONYMY(keyword THESAURUS) RETURNS SET-OF (THESAURUS)

CREATE FUNCTION HIERARCHY(keyword THESAURUS)RETURNS SET-OF (THESAURUS)

CREATE FUNCTION CLOSENESS(keyword THESAURUS)RETURNS SET-OF (THESAURUS)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)66

Date’s model (cont’)

CREATE FUNCTION CONCERN(keyword THESAURUS)RETURNS SET-OF (THESAURUS)AS BEGIN < composition of synonymy/ hierarchy /closeness functions> END

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)67

Date’s model (D language)

Let us create a unique relation (« as in SQL ») with multivaluedattributes with the SET-OF construct

CREATE RELATION DOCUMENT

(… Setof key word : THESAURUS)…

Q : SELECT *

FROM DOCUMENTS

WHERE title = “CONCEPT%”

and keyword IN {SOFTWARE, CONCERN (SOFTWARE)}

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)68

Complete example with Date’s model

The 3 following Classes with :

(i) the super class DOCUMENTS (DNO, title, PAGES, {keywords})

(ii) two sub classes BOOKS ({authors}, editor) and HANDOUTS (author)

1. complete Object-relational schema (Date’s) ?

2. 2 following (SQL-D) queries using ‘➔’ :

➢Q1 What is the number of pages of DUNOD books on loan ?

➢Q2 What is the number of pages of DUNOD books on loan whose title starts with CONCEPT and which concerns SOFTWARE ?

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)69

Example : Complete OR schema (Date’s)

➢PHASE 1 : DOMAIN definition (with inheritance among primary domains)

Create Domain DOCNO primaryFunction LOAN < boolean value>

Create domain BNO UNDER DocNO primary

Create Domain HandoutNO UNDER DocNO primaryFunction COPY

Create Domain Dtitle Character (12)

Create Domain Dauthor Character (12)

Create Domain Dpage INT

Create Domain Deditor Character (12)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)70

Date’s schema (cont’)

Create Domain THESAURUS <already done>

Function SYN…

Function HIER…

Function CLOSE…

Function CONCERN,…

➢ Phase 2 : Relation creation

Create RELATION Document (

DOC# : DOCNO, Primay Key

title : Dtitle

NBREPAGE : Dpage

key word SET-OF: THESAURUS)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)71

Thesaurus schema

Create Relation BOOK(B# : BNO Primary keyauthor SET-OF: Dauthoreditor : Deditor)

Create Relation HANDOUT(H# :HANDOUTNO Primary Keyauthor : Dauthor)

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)72

Q1 query (Thesaurus)

Select B# ➔ NBREPAGE <structural inheritance with ➔ operator>

From Book

Where editor = « Dunod » and LOAN = « True » ;

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)73

Q2 query ☺

Select B#➔ NBREPAGE

From Book

Where

editor = « Dunod » and LOAN = « True » and B#➔ title = « Concept% »

and B#➔ keyword in { Software, CONCERN (Software)}

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)74

Object-relational DBMS (Books and web site)

➢http://thethirdmanifesto.com/

➢C. J. Date and Hugh Darwen « Databases, Types, and the Relational Model : The Third Manifesto », Addison-Wesley, 2006 (for the 3rd edition)

➢M.Stonebraker« Object-relational DBMS (The next great wave) »Morgan Kaufmann, 1996

Copyright Big Data Pr Serge Miranda, MBDS, Univ de Nice Sophia Antipolis (UCA)75

Seminars : Second DB manifesto by M. Stonebraker and DCOM from Microsoft

« Everything (concerning data store interface) is

and will be SQL »

Recommended