Presentation is loading. Please wait.

Presentation is loading. Please wait.

Limits of RD model Introduction to ORDBMS and OODBMS

Similar presentations


Presentation on theme: "Limits of RD model Introduction to ORDBMS and OODBMS"— Presentation transcript:

1 Limits of RD model Introduction to ORDBMS and OODBMS
Reading Connolly: Chapter 24, 27 Elmasri: Chapter 22 (20)

2 Objectives Advanced database applications.
Unsuitability of RDBMSs for advanced database applications. Problems of storing objects in relational database. The next generation of database systems. How relational model has been extended to support advanced database applications. Overview of object-oriented features in SQL3.

3 Appearance of new complex database applications whose needs are quite different from traditional business database applications identified that existing RDBMS become inadequate for such complex applications. So this applications require new type of DBMS. The main trends are: OODBMS (Object Oriented DBMS) and ORDBMS (Object Relational DBMS) or ERDBMS Extended RDBMS

4 Advanced Database Applications
Computer-Aided Design (CAD) Computer-Aided Manufacturing (CAM) Computer-Aided Software Engineering (CASE) Network Management Systems Office Information Systems (OIS) and Multimedia Systems Digital Publishing Geographic Information Systems (GIS) Other applications with complex and interrelated objects and procedural data.

5 Computer-Aided Design (CAD)
Stores data relating to mechanical and electrical design, for example, buildings, airplanes, and integrated circuit chips. Designs of this type have some common characteristics: Data has many types, each with a small number of instances. Designs may be very large.

6 Computer-Aided Design (CAD)
Design is not static but evolves through time. Updates are far-reaching. Involves version control and configuration management. Cooperative engineering.

7 Advanced Database Applications
Computer-Aided Manufacturing (CAM) Stores similar data to CAD, plus data about discrete production. Computer-Aided Software Engineering (CASE) Stores data about stages of software development lifecycle.

8 Office Information Systems (OIS) and Multimedia Systems
Stores data relating to computer control of information in a business, including electronic mail, documents, invoices, and so on. Modern systems now handle free-form text, photographs, diagrams, audio and video sequences. Documents may have specific structure, perhaps described using mark-up language such as SGML, HTML, or XML.

9 Geographic Information Systems (GIS)
GIS database stores spatial and temporal information, such as that used in land management and underwater exploration. Much of data is derived from survey and satellite photographs, and tends to be very large. Searches may involve identifying features based, for example, on shape, color, or texture, using advanced pattern-recognition techniques.

10 Weaknesses of RDBMSs Poor Representation of “Real World” Entities
Normalization leads to relations that do not correspond to entities in “real world”. Semantic Overloading Relational model has only one construct for representing data and data relationships: the relation. Relational model is semantically overloaded.

11 Weaknesses of RDBMSs Poor Support for Integrity and Enterprise Constraints Homogeneous Data Structure Relational model assumes both horizontal and vertical homogeneity. Many RDBMSs now allow Binary Large Objects (BLOBs).

12 Weaknesses of RDBMSs Limited Operations
RDBMs only have a fixed set of operations which cannot be extended. Difficulty Handling Recursive Queries Extremely difficult to produce recursive queries. Extension proposed to relational algebra to handle this type of query is unary transitive (recursive) closure operation.

13 Example - Recursive Query

14 Weaknesses of RDBMSs Impedance Mismatch
Most DMLs lack computational completeness. To overcome this, SQL can be embedded in a high-level 3GL. This produces an impedance mismatch - mixing different programming paradigms. Estimated that as much as 30% of programming effort and code space is expended on this type of conversion.

15 Weaknesses of RDBMSs Other Problems with RDBMSs
Transactions are generally short-lived and concurrency control protocols not suited for long-lived transactions. Schema changes are difficult. RDBMSs are poor at navigational access.

16 Next Generation Database Systems
First Generation DBMS: Network and Hierarchical Required complex programs for even simple queries. Minimal data independence. No widely accepted theoretical foundation. Second Generation DBMS: Relational DBMS Helped overcome these problems. Third Generation DBMS: OODBMS and ORDBMS.

17 OODBMS Object-Oriented Concepts
Abstraction, encapsulation, information hiding. Objects and attributes. Object identity. Methods and messages. Classes, subclasses, superclasses, and inheritance. Overloading. Polymorphism and dynamic binding.

18 Abstraction Process of identifying essential aspects of an entity and ignoring unimportant properties. Concentrate on what an object is and what it does, before deciding how to implement it.

19 Encapsulation and Information Hiding
Object contains both data structure and set of operations used to manipulate it. Information Hiding Separate external aspects of an object from its internal details, which are hidden from outside. Allows internal details of an object to be changed without affecting applications that use it, provided external details remain same. Provides data independence.

20 Object Uniquely identifiable entity that contains both the attributes that describe the state of a real-world object and the actions associated with it. Definition very similar to definition of an entity, however, object encapsulates both state and behavior; an entity only models state.

21 Object Identity Object identifier (OID) assigned to object when it is created that is: System-generated. Unique to that object. Invariant. Independent of the values of its attributes (that is, its state). Invisible to the user (ideally).

22 Object Identity vs. Object equality
Objects are equal if values of all their attributes are the same Objects are identical if they refer to the same object i.e. their Object IDs are the same

23 Object Identity - Implementation
In RDBMS, object identity is value-based: primary key is used to provide uniqueness. Primary keys do not provide type of object identity required in OO systems: key only unique within a relation, not across entire system; key generally chosen from attributes of relation, making it dependent on object state.

24 ORDBMSs Vendors of RDBMSs conscious of threat and promise of OODBMS.
Agree that RDBMSs not currently suited to advanced database applications, and added functionality is required. Reject claim that extended RDBMSs will not provide sufficient functionality or will be too slow to cope adequately with new complexity. Can remedy shortcomings of relational model by extending model with OO features.

25 ORDBMSs - Features OO features being added include:
user-extensible types, encapsulation, inheritance, polymorphism, dynamic binding of methods, complex objects including non-1NF objects, object identity.

26 ORDBMSs - Features However, no single extended relational model.
All models: share basic relational tables and query language, all have some concept of ‘object’, some can store methods (or procedures or triggers).

27 ORDBMSs Original term used to describe such systems was Extended Relational DBMS (ERDBMS). Now use Object-Relational DBMS (ORDBMS), and sometimes Universal Server or Universal DBMS (UDBMS).

28 Stonebraker’s View

29 Advantages of ORDBMSs Resolves many of known weaknesses of RDBMS.
Reuse and sharing: reuse comes from ability to extend server to perform standard functionality centrally; gives rise to increased productivity both for developer and end-user. Preserves significant body of knowledge and experience gone into developing relational applications.

30 Disadvantages of ORDBMSs
Complexity. Increased costs. Proponents of relational approach believe simplicity and purity of relational model are lost. Some believe RDBMS is being extended for what will be a minority of applications. OO purists not attracted by extensions either. SQL now extremely complex.

31 SQL3 - New OO Data Management Features
Type constructors for row types and reference types. User-defined types (distinct types and structured types) that can participate in supertype/subtype relationships. User-defined procedures, functions, and operators. Type constructors for collection types (arrays, sets, lists, and multisets). Support for large objects – BLOBs and CLOBs. Recursion. Release of SQL3 fell significantly behind schedule and was only finalized in 1999 (SQL2 in 1992). Some features have been deferred to SQL4.

32 Object-relational database vendors
The following products either adhere to the SQL:1999 standard or provide a proprietary approach. Daffodil Software, Ltd. (Daffodil DB) FirstSQL, Inc. (FirstSQL/J) IBM (Cloudscape and DB2) InterSystems Corporation (Cacheґ) Micro Data Base Systems, Inc. (TITANIUM) Oracle Corporation (Oracle) Paradigma Software (Valentina) PostgreSQL Global Development Group (PostgreSQL)

33 Object-oriented database vendors
Birdstep Technology, Inc. (Birdstep RDM Mobile) Computer Associates International, Inc. (Jasmine Object Database) Custom Microsystems, Inc. (XDb) db4objects, Inc. (db4o - database for objects - open source) GemStone Systems, Inc. (GemStone/S and GemStone Facets) InterSystems Corporation (Cache?) Jade Software Corporation (JADE) JYD Software Engineering Pty Ltd. (JYD Object Database) Logic Arts, Ltd. (VOSS) Matisse Software, Inc. (Matisse) Micro Data Base Systems, Inc. (TITANIUM) Moscow State University (GOODS - open source)

34 Object Relational Mapping ORM
ORDBMS implementations are not completely standardized, e.g. UDT implementation could differ and not always support all features defined in SQL3, not system independent. These difficulties rise a need for alternative solution to provide a link between OO Programming language and DBMS – ORM.

35 ORM An ORM solution consists of the following four pieces:
An API for performing basic CRUD operations on objects of persistent classes A language or API for specifying queries that refer to classes and properties of classes A facility for specifying mapping metadata A technique for the ORM implementation to interact with transactional objects to perform dirty checking, lazy association fetching, and other optimization functions

36 LINQ to SQL, Entity Framework
LINQ to SQL that was later replaced by Entity Framework are Microsoft solution for ORM Also NHibernate is an ORM framework that was developed by third parties for .NET

37 LINQ to SQL LINQ to SQL provides a runtime infrastructure for managing relational data as objects without losing the ability to query. Uses LINQ language for queering data, with syntacs that is similar to SQL Built on top of ADO.NET VS.NET provides a designer and a RAD environment

38 LINQ to SQL LINQ to SQL supports only SQL Server DBMS
but does not support Oracle, MySql etc. There is a DBLinq project that aims to develop providers for other DBMS - Entity Framework support other DBMS if there is a DB provider that supports Entity Framework.

39 LINQ to SQL Queering data example
DBDataContext db = new DBDataContext(); var customers = from c in db.Customers where c.City == "London" select c; var empIds= ( from c in db.Customers join e in db.Employees on c.City equals e.City select e.EmployeeID).Distinct();

40 LINQ to SQL Update data example
DBDataContext db = new DBDataContext(); //create new Customer object Customer newCust = new Customer(); newCust.CompanyName = “Test Name"; newCust.CustomerID = “123"; //Add to database db.Customers.InsertOnSubmit(newCust); //Save changes in database db.SubmitChanges();

41 LINQ to SQL Update data example
DBDataContext db = new DBDataContext(); var customers = from c in db.Customers where c.City == "London" select c; Customer existingCust = customers.First(); existingCust.Name = “Updated Name"; db.SubmitChanges();

42 LINQ to SQL Delete data example
DBDataContext db = new DBDataContext(); var customers = from c in db.Customers where c.City == "London" select c; Customer existingCust = customers.First(); db.Customers.DeleteOnSubmit(existingCust); db.SubmitChanges();

43 There are three layers in ADO.NET EF:
Entity Framework There are three layers in ADO.NET EF: Conceptual layer Mapping layer Logical layer

44 Entity Framework - Quering

45 Entity Famework Changes to entities are stored in memory:
Every entity in ObjectContext has a ObjectStateEntry ObjectContext uses ObjectStateEntries to track entity changes The context.SaveChanges() method is used to update the database according to ObjectStateEntries Rollback (in memory) can be done with context.SaveChanges(false)

46 Insert Create a new instance (entity) of the class. Set references to related objects Add the entity to the context Call context.SaveChanges() var order = new Order { CustomerID = 5, EmployeeID = 1, Amount=1200 }; context.AddToOrders(order); context.SaveChanges();

47 Update Get a reference to the entity Make the changes
And call context.SaveChange() var order = from o in context.Orders where o.OrderID == 11078 select o; order.Single().OrderDate = DateTime.Now; context.SaveChanges();

48 Delete Get a reference to the entity
Call context.DeleteObject(theEntity) Call context.SaveChanges() var order = from o in context.Orders where o.OrderID == 11078 select o; context.DeleteObject(order.Single()); context.SaveChanges();

49 Select using (var ctx = new CompanyEntities()) { var results = from e in ctx.EMPs where e.EMPNO = 123 select e; return results.ToList(); }

50 Reading Books Programming Entity Framework O’Reilly Julia Lerman
Useful tool for querying relational data using LINQ and ESQL Entity framework materials


Download ppt "Limits of RD model Introduction to ORDBMS and OODBMS"

Similar presentations


Ads by Google