Presentation is loading. Please wait.

Presentation is loading. Please wait.

08.06.2016Murat KARAÖZ1. Scope What is an “Object Database”? History Queries When / Where / Why ODMSs 08.06.2016Murat KARAÖZ2.

Similar presentations


Presentation on theme: "08.06.2016Murat KARAÖZ1. Scope What is an “Object Database”? History Queries When / Where / Why ODMSs 08.06.2016Murat KARAÖZ2."— Presentation transcript:

1 08.06.2016Murat KARAÖZ1

2 Scope What is an “Object Database”? History Queries When / Where / Why ODMSs 08.06.2016Murat KARAÖZ2

3 What is an “Object Database”? 08.06.2016Murat KARAÖZ3 Integration of database capabilities with object oriented programming language capabilities. Object databases store objects rather than data such as integers, strings or real numbers. The Object-Oriented Database System Manifesto It should be a DBMS It should be an object-oriented system

4 Object databases history 1985 - The term "object-oriented database system" first appeared around. 1991 –The first standard, ODMG 1.0, was released in 1993. 1995 - The OODBMS Manifesto, Malcolm Atkinson 2001 - Final ODMG 3.0 standards released. [OQL] 2004 - Advent of Open Source: db4o released as free, open source ODBMS. [Native Queries] 08.06.2016Murat KARAÖZ4

5 How do we store data? 08.06.2016Murat KARAÖZ5

6 How do we store data? 08.06.2016Murat KARAÖZ6

7 Object Query Language (OQL) Declarative query language Not computationally complete Syntax based on SQL (select, from, where) Additional flexibility (queries with user defined operators and types) 08.06.2016Murat KARAÖZ7

8 Object Query Language (OQL) Sample query: “what are the names of the black products?” Select distinct p.name From products p Where p.color = “black” Valid in both SQL and OQL, but results are different. 08.06.2016Murat KARAÖZ8

9 Result of the query (SQL) 08.06.2016Murat KARAÖZ9 Product noNameColor P1Ford MustangBlack P2Toyota CelicaGreen P3Mercedes SLKBlack - The statement queries a relational database. => Returns a table with rows. Name Ford Mustang Mercedes SLK Result Original table

10 Result of the query (OQL) 08.06.2016Murat KARAÖZ10 Product noNameColor P1Ford MustangBlack P2Toyota CelicaGreen P3Mercedes SLKBlack Result Original table - The statement queries a object-oriented database => Returns a collection of objects. String Ford Mustang String Mercedes SLK

11 OQL vs SQL Queries look very similar in SQL and OQL, sometimes they are the same. In fact, the results they give are very different. Query returns: 08.06.2016Murat KARAÖZ11 OQLSQL Object Collection of objects Tuple Table

12 Querying in db4o db4o supports 3 forms of querying: Query by Example (QBE) Native Queries (NQ) Simple Object Database Query API (SODA Query API) 08.06.2016Murat KARAÖZ12

13 The Basics – Person Class creating and storing querying updating deleting person objects 08.06.2016Murat KARAÖZ13

14 Accessing a Database ObjectContainer db = Db4o.openFile( "database path"); try { // access db } finally { db.close(); } 08.06.2016Murat KARAÖZ14

15 Creating and Storing Objects Create objects as usual and then make them persistent using the set() method on the database. Person p1 = new Person("Fred Bloggs", 35); db.set(p1); Person p2 = new Person("Mary Jones", 24); db.set(p2); 08.06.2016Murat KARAÖZ15

16 Querying Objects (QBE approach) // retrieve by age (null default for string) Person p = new Person (null, 35); ObjectSet result = db.get(p); // retrieve by name ( 0 default for int) Person p = new Person ("Mary Jones", 0); ObjectSet result = db.get(p); // retrieve all persons Person p = new Person (null, 0); ObjectSet result = db.get(p); 08.06.2016Murat KARAÖZ16

17 Updating Objects First retrieve object (or objects), then perform update and then store. // update age of person // assumes single result to query ObjectSet res = db.get (new Person ("Mary Jones", 0); Person p = res.next(); p.setAge (40); db.set (p); 08.06.2016Murat KARAÖZ17

18 Deleting Objects As with updating objects, objects must first be retrieved and then deleted. // delete Fred Bloggs from database ObjectSet res = db.get (new Person("Fred Bloggs", 0); Person p = res.next(); db.delete(p); 08.06.2016Murat KARAÖZ18

19 Object database relationships 08.06.2016Murat KARAÖZ19

20 Object database relationships 08.06.2016Murat KARAÖZ20

21 Object database relationships 08.06.2016Murat KARAÖZ21

22 Benefits of using an ODBMS When you use an ODBMS, the way you use your data is the way you store it. If you are working with complex data, an ODBMS can give you performance that is ten to a thousand times faster than an RDBMS. 08.06.2016Murat KARAÖZ22

23 When should you use an ODBMS? Use an ODBMS when you have a business need for high performance on complex data. Embedded DBMS Applications Team is Using Agile Techniques You're Programming in an OO Language Real-Time applications Data is Accessed by Navigation Rather Than Query 08.06.2016Murat KARAÖZ23

24 Data is Accessed by Navigation Rather Than Query 08.06.2016Murat KARAÖZ24

25 Everyday uses of object databases Are you aware that when you; use your cell phone, book a hotel room or a flight, receive health care, you might very well be interacting with an object database? 08.06.2016Murat KARAÖZ25

26 Barriers to using ODBMSs Lack of Familiarity: Most programmers understand RDBMSs. Many do not understand ODBMSs. Inertia: It is easier to use what you know. Technology Fear: It is scary when you do not know what is inside ODBMS technology. Business Fear: Most of the ODBMS vendors are small companies. Is this risk worth the technological benefits? 08.06.2016Murat KARAÖZ26

27 Performance Myth: ODBMSs are slow No, they are not. 08.06.2016Murat KARAÖZ27

28 Will ODBMSs replace RDBMSs? Before we begin, we should acknowledge reality: RDBMS works just fine. There are plenty of remarkably good applications out there that have been running on relational databases for years. That is highly unlikely. It's difficult, if not impossible, to move off databases. That would be unrealistic. Where you primarily see ODBMSs is in new development. 08.06.2016Murat KARAÖZ28

29 Summary – Definition Object database = OO + DB The Object-Oriented Database System Manifesto It should be a DBMS It should be an object-oriented system 08.06.2016Murat KARAÖZ29

30 Summary – Storage 08.06.2016Murat KARAÖZ30

31 Summary – Queries 08.06.2016Murat KARAÖZ31 SQL and OQL Query by Example (QBE) Native Queries (NQ) Simple Object Database Query APIs

32 Summary – Relationships 08.06.2016Murat KARAÖZ32

33 Summary Object databases are a niche field within the broader DBMS market dominated by relational database management systems (RDBMS). Object databases have been considered since the early 1980s and 1990s but they have made little impact on mainstream commercial data processing, though there is some usage in specialized areas. 08.06.2016Murat KARAÖZ33

34 References http://www.service-architecture.com/index.html http://www.odbms.org/ Object Database Tutorial, Rick Cattell, International Conference on Object-Oriented Databases Zurich, 2009 http://en.wikipedia.org/wiki/Object_database The OODBMS Manifesto 6/8/2016Murat KARAÖZ34

35 Questions? Thanks for listening. Murat KARAÖZ 08.06.2016Murat KARAÖZ35


Download ppt "08.06.2016Murat KARAÖZ1. Scope What is an “Object Database”? History Queries When / Where / Why ODMSs 08.06.2016Murat KARAÖZ2."

Similar presentations


Ads by Google