1 / 15

Object-Oriented Database Management Systems (ODBMS)

Object-Oriented Database Management Systems (ODBMS). By Wendy Wooters CS157B. ODBMS Outline. Definition Why Who Approaches Persistent Programming Languages Object-Oriented Concepts Object Class & Encapsulation Inheritance & Polymorphism Object Identifier (OID)

esma
Download Presentation

Object-Oriented Database Management Systems (ODBMS)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object-Oriented Database Management Systems (ODBMS) By Wendy Wooters CS157B

  2. ODBMS Outline • Definition • Why • Who • Approaches • Persistent Programming Languages • Object-Oriented Concepts • Object • Class & Encapsulation • Inheritance & Polymorphism • Object Identifier (OID) • Advantages and Disadvantages • Example Code • Conclusion

  3. SSN Hired Name Salary Employee What is an ODBMS? • Database that stores data elements as objects. Uses object-oriented concepts. • Object - like an entity in and E-R Diagram.

  4. Why use ODBMS? Product DB • Complex data or relationship requirements • Lack of unique, natural identification • Large numbers of many to many relationships • Access using traversals. Graph/Tree structure. • Frequent use of type codes such as those found in the relational schema Source: http://www.service-architecture.com/object-oriented-databases

  5. Who Uses ODBMS? • Typical Applications for ODBMS: • Computer-aided design (CAD) • Computer-aided software engineering (CASE) • Multimedia databases • Images, video, games, etc. • Office automation systems (OIS) • Expert database systems

  6. Relational DB extended to use object-oriented concepts. (Object-relational DB) DB is Relational Programming language is object-oriented. Object-oriented DB model. Application and database use same object-oriented model. Uses persistent programming languages. Application Translation RDB Application ODB Approaches for ODBMS

  7. Application ODB Persistence Programming Languages • A programming language that directly manipulates persistent data in a database. • Persistent data exists after the program terminates. • Single program for application and data management. No translation from database to application programming needed. • Used with the object-oriented DB model approach.

  8. Employee SSN:int Name:String Hired:Date Salary:double … getSSN() getName() setName() … Relationships Variables Methods Object-Oriented ConceptsObject • Object is an entity containing: • Variables/Attributes – Object Data • Relationships – References to other objects • Methods – Object Functions • Messages – Accessing Methods

  9. Class encapsulates the data structure and operations of the object. Internals are hidden from the user. User only knows available methods and how to call them. Public class Employee { //Class Attributes private int SSN; private String name; private Date hired; private double salary; … //Class Constructor public Employee() {…} //Class Accessor Methods public int getSSN() {…} public String getName() {…} public Date getHired() {…} public double getSalary() {…} //Class Mutator Methods public void setName(String newName) {…} public void setHired(Date newHired) {…} public void setSalary(double newSalary) {…} … } Object-Oriented ConceptsClass & Encapsulation

  10. Person Superclass Employee Supplier Customer Subclass Object-Oriented ConceptsInheritance & Polymorphism • Inheritance - A class (subclass) can inherit the characteristic of another class (superclass). • Example: Employee has inherited attributes and methods from Person. • Polymorphism - Each subclass object can respond differently to same message by overriding the superclass method. Example:

  11. Employee Date Object-Oriented ConceptsObject Identifier • Object Identifier (OID) – The unique OID is maintained by the DBMS. • ODBMS - Generated automatically by the system. Example: Reference to Date object in the Employee object for the date hired. • RDBMS – Primary key. Example: SSN for Employee

  12. ODBMS Advantages • Matches the object-oriented application design: • Reduces code, execution time and paging • Real world data model • Easier Navigation • Allows reusability of objects – generic objects can be used in many applications. • Manages Complex data types more efficiently. • Supports distributions of data across networks more efficiently.

  13. ODBMS Disadvantages • Still developing • Lack of accepted standards • Lack of development tools. • Change is more likely to occur in model • More complicated than the relational model. Takes longer to learn. • Not as efficient when data and relations are simple.

  14. Example of how to access data in an ODB, using the ODMG Object Query Language (OQL): Opens DB Starts a transaction Executes a query to find a Person object named “S. M. Lee” Does additional processing on this Person object Gets Address object of Person Update street of Address object Commit transaction Close database Java & ODB Example • import org.odmg.*; • import java.util.Collection; • Implementation impl = new com.vendor.odmg.Implementation(); • Database db = impl.newDatabase(); • Transaction txn = impl.newTransaction(); • try { • db.open("addressDB", Database.OPEN_READ_WRITE); • txn.begin(); • // perform query • OQLQuery query = new OQLQuery( • "select x from Person x where x.name = \“S. M. Lee\""); • Collection result = (Collection) query.execute(); • Iterator iter = result.iterator(); • // iterate over the results • while ( iter.hasNext() ) { • Person person = (Person) iter.next(); • // do some addition processing on the person (now shown) • // now traverse to the address object and update its value • person.address.street = "13504 4th Avenue South"; • } • txn.commit(); • db.close(); • } • //exception handling would go here ... Source: http://www.service-architecture.com/object-oriented-databases

  15. Conclusion • Definition • Persistent Programming Languages • Object-Oriented Concepts • Advantages and Disadvantages of ODBMS • Example Code

More Related