Object-Oriented DatabasesOriented Databases · Object-Relational Databases Relational model...
Transcript of Object-Oriented DatabasesOriented Databases · Object-Relational Databases Relational model...
Object-Oriented DatabasesObject Oriented DatabasesIntroduction
• Course Overview• Evolution and History of Database Management Systems• Requirements of Object-Oriented Database Management Systems
September 19, 2008 1Michael Grossniklaus – Department of Computer Science – [email protected]
Organisation
Michael GrossniklausETH Z i h P lit i di MilETH Zurich Politecnico di MilanoIFW D 46.2 Campus Bassini, Room 18/103+41 44 632 72 73 +39 022 399 3474+41 44 632 72 73 +39 022 399 [email protected] [email protected]
Alexandre de SpindlerETH ZurichIFW D 47.1
41 44 632 74 16+41 44 632 74 [email protected]
September 19, 2008 2Michael Grossniklaus – Department of Computer Science – [email protected]
Exercises
Course will be accompanied by exercisesWork with technologies covered in the courseTutorial sessions every week
Starting on October 3rd, 2008IFW A 32.1, 11-12Al d d S i dlAlexandre de Spindler
Optional but strongly recommended!Optional, but strongly recommended!
September 19, 2008 3Michael Grossniklaus – Department of Computer Science – [email protected]
Exam
Session examinationJ 19th 2009 F b 13th 2009January 19th, 2009 – February 13th, 2009Exceptions can be arranged for exchange students
Oral exam in EnglishOral exam in EnglishDuration of 15 minutes5 ECTS
September 19, 2008 4Michael Grossniklaus – Department of Computer Science – [email protected]
Course Overview
I. Basics of Object-Oriented Databases1 I t d ti1. Introduction2. Object Persistence3 db4o3. db4o
II. Advanced Concepts of Object-Oriented Databases4 Standards and Commercial Systems4. Standards and Commercial Systems5. Storage and Indexing6. Version Models
III. Semantic Object Data Management7. OM Data Model and OM Data Model Languageg g8. Design and Implementation of OMS Avon9. Context-Aware Data Management
September 19, 2008 5Michael Grossniklaus – Department of Computer Science – [email protected]
Database Design
Conceptual Design
Implementation Design
Physical Design
6September 19, 2008 Michael Grossniklaus – Department of Computer Science – [email protected]
Database Management Systems
Conceptual modellingClient Interface Layer E/R
SQL, JDBC, ODBC
Conceptual modelling Data access and representation
Data Model Layer Relational ModelData semanticsOperation semantics
Storage Layer RDBMSPersistenceACIDDistribution
September 19, 2008 7Michael Grossniklaus – Department of Computer Science – [email protected]
Evolution and History
Mod
el
hip
Mod
el
ndar
d
Rel
atio
nal D
ata
Ent
ity-R
elat
ions
SQ
L:19
99X
ML
CO
DAS
YL
Sta
n
OD
MG
1.0
OM
Dat
a M
odel
SQ
L-86
OD
MG
3.0
SQ
LHierarchical
Network
R E S XC O OS OS
Network
Object-Oriented
Relational
Object Oriented
Semi-Structured
Object-Relational
XML
1960 1970 1980 1990 20001960 1970 1980 1990 2000
September 19, 2008 8Michael Grossniklaus – Department of Computer Science – [email protected]
Hierarchical Databases
Data organised in a treet h hilda parent can have many children
a child can have only one parent
Records described by entity typesRecords described by entity types1:N (one-to-many) relationshipsQuery by path navigationExamples
File systemLDAPWi d R i t d A ti Di tWindows Registry and Active DirectoryXML documents and XQuery
September 19, 2008 9Michael Grossniklaus – Department of Computer Science – [email protected]
Network Databases
Data organised in graph (lattice)t h hilda parent can have many children
a child can have many parents
Bachmann diagramsBachmann diagramsRecord types define propertiesSet types defined relationships
parent-child, (double) linked list, …
Query by graph navigationExamples
CODASYL
September 19, 2008 10Michael Grossniklaus – Department of Computer Science – [email protected]
Relational Databases
Data organised as tuples in relationsLink between data tuples
primary and foreign keys
Relational algebraproject, select, join
Relational normal formsDeclarative language
data definition, consistency, manipulation and querying
ExamplesOracle 11g, Microsoft SQL Server, IBM DB2PostgreSQL, MySQL
September 19, 2008 11Michael Grossniklaus – Department of Computer Science – [email protected]
Relational Databases
Relational model is very simplel b i t f d t b i l t donly basic concepts → references need to be simulated
restricted type system → no user-defined types
Lack of semantic modellingLack of semantic modellingcomplex data, versioning, roles
Little support for data and schema evolutionLittle support for data and schema evolutionObject-relational impedance mismatch
September 19, 2008 12Michael Grossniklaus – Department of Computer Science – [email protected]
Object-Relational Impedance MismatchObject Relational Impedance Mismatch
Object-oriented application development and relational j pp pdata management results in clash of two incompatible modelsCode to map between models is considerable overhead, costly and hard to maintaincostly and hard to maintain
13September 19, 2008 Michael Grossniklaus – Department of Computer Science – [email protected]
Object-Oriented Databases
Data represented as objectsbj t id titobject identity
attributes and methodsreferences relationships associationsreferences, relationships, associations
Extensible type hierarchyuser-defined types abstract data typesuser defined types, abstract data typessingle or multiple inheritanceoverloading, overriding, late binding
Declarative language for ad hoc purposesBinding for object-oriented programming languageBinding for object oriented programming language
September 19, 2008 14Michael Grossniklaus – Department of Computer Science – [email protected]
Object-Relational Databases
Relational model extendedt d l tinested relations
referencessetssetsrow types, abstract typesfunctions
Declarative language extendedcomputationally complete
Fundamental impedance mismatch remainsCommingling of modelsCommingling of models
September 19, 2008 15Michael Grossniklaus – Department of Computer Science – [email protected]
Object-Relational Databases
create type AddressType (street varchar(10),city varchar(10)
)
create row type PublicationType (title varchar(50)
)
create row type BookType (isbn varchar(10)
) under PublicationType
create row type AuthorType (name varchar(25),books setof(BookType),address AddressType
))
create table Book of type BookTypecreate table Author of type AuthorType
September 19, 2008 16Michael Grossniklaus – Department of Computer Science – [email protected]
Emerging and Future Databases
XML DatabasesC 251 0317 00LCourse 251-0317-00LXML and DatabasesProf. Dr. Donald Kossmann, Dr. Peter FischerAutumn Semester, Wed 13-15
Mobile and Personal DatabasesCourse 251-0373-00LMobile and Personal Information SystemsProf. Dr. Moira C. NorrieAutumn Semester Thu 9 11Autumn Semester, Thu 9-11
September 19, 2008 17Michael Grossniklaus – Department of Computer Science – [email protected]
Object-Oriented DatabasesObject Oriented Databases
Object-OrientedSystems
DatabaseSystemsO
DB
Systems Systems
OO
Avoid object-relational impedance mismatchj pProvide a uniform data modelCombine features and properties ofCombine features and properties of
object-oriented systems and languagesdatabase management systemsdatabase management systems
18September 19, 2008 Michael Grossniklaus – Department of Computer Science – [email protected]
Defining Object-Oriented Databases
Diverse focus of object-oriented database systemski bj t i t d i l i t tmaking object-oriented programming languages persistent
managing and storing object data
Many attempts to define object oriented databasesMany attempts to define object-oriented databasesThe object-oriented database manifesto
13 d t f t13 mandatory features5 optional characteristics4 open choices4 open choices
Manifesto aftermathseveral refutations from the relational campseveral refutations from the relational campseveral important properties not addressed
September 19, 2008 19Michael Grossniklaus – Department of Computer Science – [email protected]
The Object-Oriented Database Manifesto
1. Complex objects2. Object identity 3. Encapsulation4 Types and classesObject oriented 4. Types and classes5. Type and class hierarchies6 Overriding overloading and late binding
Object-oriented systems
6. Overriding, overloading and late binding 7. Computational completeness8. Extensibility9. Persistence10. Efficiency11 CDatabase 11. Concurrency12. Reliability13 Declarative query language
Database management systems
13. Declarative query language
September 19, 2008 20Michael Grossniklaus – Department of Computer Science – [email protected]
Objects
Complex objectsl bj t f d f i l b t tcomplex object formed from simpler ones by constructors
record, set, bag, list and array complex object constructorsconstructor orthogonalityconstructor orthogonality
Object identity and equalityevery object has unique and immutable object identifier (OID)every object has unique and immutable object identifier (OID)sharing of objects through referencestwo objects are identical if they have the same OIDtwo objects are equal if they have the same stateshallow and deep equality
September 19, 2008 21Michael Grossniklaus – Department of Computer Science – [email protected]
Objects
Encapsulationbj t i t f i t f d i l t tiobject consists of interface and implementation
interface defines signatures of public methodsimplementation includes object data and methodsimplementation includes object data and methodsobject state is only modified through public methodsobject data structure may be exposed for declarative queries
record t perecord type
set type
publicinterface
set type
September 19, 2008 22Michael Grossniklaus – Department of Computer Science – [email protected]
Types and Classes
Data typesd fi iti f bj t tidefinition of object propertiesstatic part describes object structuredynamic part describes object behaviourdynamic part describes object behaviourseparation of interface and implementationused to check correctness of programs at compile time
Object classescontainer for objects of the same typeobjects can be added and removedused to create and manipulate objects at run time
September 19, 2008 23Michael Grossniklaus – Department of Computer Science – [email protected]
Types and Classes
Class Typehas
describescontains
Object Valuehas
September 19, 2008 24Michael Grossniklaus – Department of Computer Science – [email protected]
Generalisation Hierarchies
Advantagesf l d lli t l +getName()
Publication
powerful modelling toolguarantee semantic complexityreuse of specification and implementation
+getName()+getAuthors()
A ti l B kreuse of specification and implementation
Inheritanceobjects of subclass belong automatically to superclass
+getPages()+getJournal()
Article
getISBN()
Book
objects of subclass belong automatically to superclassattributes and methods are inherited from superclasssubclass can introduce new attributes and methods
getConference()
Proceeding
Migration between classesmove objects between hierarchy levelsj yobject specialisation (↓) and generalisation (↑)class instance versus class member
September 19, 2008 25Michael Grossniklaus – Department of Computer Science – [email protected]
Generalisation Hierarchies
Substitution inheritancebt h ti th tsubtype has more operations than supertype
subtype can be substituted where supertype is expectedbased on behaviour rather than valuesbased on behaviour rather than values
Inclusion inheritanceevery object of subtype is also object of supertypeevery object of subtype is also object of supertypebased on structure rather than operations
Constraint inheritanceConstraint inheritancespecial case of inclusion inheritancesubtype is expressed by constraint on supertypeyp p y p yp
Specialisation inheritancesubtype objects contain more specific informationyp j p
September 19, 2008 26Michael Grossniklaus – Department of Computer Science – [email protected]
Overriding, Overloading and Late Binding
Method overridingth d i d fi d i bt
«interface»Shape
method is redefined in subtypeguarantees specialisation of methodspreserves uniform method interface
+draw(Graphics g)
Rectanglepreserves uniform method interface
Method overloadingeffect caused by method overriding
+draw(Graphics g)
Rectangle
effect caused by method overridingvarious version of a method can exist in parallel
Late binding+draw(Graphics g)
FilledRectangle
Late bindingappropriate version of overloaded method selected at run timealso known as virtual method dispatchingp g
September 19, 2008 27Michael Grossniklaus – Department of Computer Science – [email protected]
Computational Completeness and Extensibility
Computational completenessi t f th th d i l t ti lrequirement for the method implementation language
any computable function can be expressedcan be realised through connection with existing languagecan be realised through connection with existing language
Extensibilitydatabase has a set of predefined typesdatabase has a set of predefined typesdevelopers can define new types according to requirementsno usage distinction between system and user types
September 19, 2008 28Michael Grossniklaus – Department of Computer Science – [email protected]
Durability and Efficiency
Persistenced t h t i th tidata has to survive the program executionorthogonal persistenceimplicit persistenceimplicit persistence
Secondary storage managementindex managementindex managementdata clusteringdata bufferingaccess path selectionquery optimisation
September 19, 2008 29Michael Grossniklaus – Department of Computer Science – [email protected]
Concurrency Control and Recovery
Concurrencyt f lti l tl i t timanagement of multiple users concurrently interacting
atomicity, consistency, isolation and durabilityserialisability of operationsserialisability of operations
Reliabilityresiliency to user software and hardware failuresresiliency to user, software and hardware failurestransactions can be committed or abortedrestore previous coherent state of dataredoing and undoing of transactionslogging of operations
September 19, 2008 30Michael Grossniklaus – Department of Computer Science – [email protected]
Declarative Query Language
High-level languaget i i l i i lexpress non-trivial queries concisely
text-based or graphical interfacedeclarativedeclarative
Efficient executionpossibility for query optimisationpossibility for query optimisation
Application independentwork on any possible databasework on any possible databaseno need for additional methods on user-defined types
September 19, 2008 31Michael Grossniklaus – Department of Computer Science – [email protected]
Optional Characteristics and Open Choices
Optional characteristicslti l i h itmultiple inheritance
type checking and inferencedistributiondistributiondesign transactions, long transactions, nested transactionsversions
Open choicesprogramming paradigmrepresentation systemtype system
if ituniformity
September 19, 2008 32Michael Grossniklaus – Department of Computer Science – [email protected]
Beyond the Manifesto
Database administration utilitiesView definition and derived dataObject roles
objects have roles in addition to typesroles can be gained and lost dynamically
Database evolutionschema and data has to evolve gracefully over time
Constraintsintegrity, semantic and evolution constraintsd fi iti t d f t f t i tdefinition, management and enforcement of constraints
September 19, 2008 33Michael Grossniklaus – Department of Computer Science – [email protected]
Literature
M. Atkinson, F. Bancilhon, D. DeWitt, K. Dittrich, D. Maier, d S Zd ik Th Obj t O i t d D t b S tand S. Zdonik: The Object-Oriented Database System
Manifesto, In: Building an Object-Oriented Database System Morgan Kaufmann 1992System, Morgan Kaufmann 1992M. Stonebraker, L. A. Rowe, B. Lindsay, J. Gray, M. Carey, M B di P B t i d D B h Thi d G tiM. Brodie, P. Bernstein, and D. Beech: Third-Generation Database System Manifesto, In: ACM SIGMOD RECORD 19(3) 1990RECORD, 19(3), 1990H. Darwen and C. J. Date: The Third Manifesto, In: ACM SIGMOD RECORD 24(1) 1995SIGMOD RECORD, 24(1), 1995
September 19, 2008 34Michael Grossniklaus – Department of Computer Science – [email protected]
Next WeekNext WeekObject Persistence
• Serialisation• Object-Relational Mappings and Frameworks• Persistent Programming Languages
September 19, 2008 35Michael Grossniklaus – Department of Computer Science – [email protected]