Home > Link, Microsoft SQL Server, MSBI, Optimization, Query, Script, SQL Mentalist, SQL PraRup, SQL Query, SQL Server, Technology,, Vishal Pawar > BISQL – Laymen to SQL Developer # 43 – Relational Databases #2 – Object Oriented Data Model, Object Oriented Databases, Object Relational Database Management Systems

BISQL – Laymen to SQL Developer # 43 – Relational Databases #2 – Object Oriented Data Model, Object Oriented Databases, Object Relational Database Management Systems

Hi Folks,

This post is part of Series Database Management Systems

Currently running topic for this series is listed as below :

Series of Database Management Systems

>>Chapter 1 : DBMS [Database Management Systems]

>>Chapter 2 : Database Core Concepts and  Applications

>>Chapter 3 : Record Storage and Primary File Organization

>>Chapter 4 : Index Structures of Files

>>Chapter 5 : Entity-Relationship Model

>>Chapter 6 : Relational Algebra

>>Chapter 7 : SQL

>>Chapter 8 : Functional Dependencies and  Normalization For Relational Databases

>>Chapter 9 : Transaction Processing

>>Chapter 10 : Concurrency Control Techniques

>>Chapter 11 : Recovery Techniques

>>Chapter 12 : Distributed Databases

>>Chapter 13 : Relational Databases <You are Here>

Continuing from my previous post on this series.

We are going to Cover the Following Points in this article

  • Object Oriented Data Model
  • Object Oriented Databases
  • Object Relational Database Management Systems

    Object Oriented Data Model

    A data model is a logic organization of the real world objects (entities), constraints put on them, and the relationships that exits among objects. You can see a DB language as a concrete syntax for a data model. Data model is implemented by a DB system.

    The basic concepts of object oriented data model are the following:

    Object Identity:

    Any real world entity is uniformly modeled as an object. They are attached with a unique id which is used to refer the object to retrieve. You can see an object retaining its identity even if some or all of the values of variables or definitions of methods change over time.

    This concept of object identity is necessary in applications but does not apply to tuples of a relational database. It is a stronger notion of identity than typically found in programming languages or in data models not based on object orientation.

    There are many forms of identity. They are:

    · Value: A data value is used for identity. For example. the primary key of a tuple in a relational database.

    · Name: A user-supplied name is used for identity. For example, file name in a file system.

    · Built-in: A notion of identity is built-into the data model or programming languages and no user-supplied identifier is required. For example, in OO systems.

    There are many situations which avail the benefits of generating the identifiers automatically which help in becoming human independent of performing the task.

    Complex objects: Complex objects are those that are form from the simpler objects by applying methods to them. Examples of simpler objects may be integers, characters, strings of any length, Booleans (0/1), floating point values, etc. examples of methods or constructor can be Set, List, tuples, etc.

    You can differentiate complex objects as structured objects and unstructured objects.

    Structured complex object are component and is defined by applying type constructor recursively at different levels. For example consider the object DEPARTMENT object. The figure 15.1 shows the diagrammatic representation of the structured complex object for the object DEPARTMENT.

    clip_image002

    Figure Example for Structure complex objects

    In the first level the DEPARTMENT has a tuple structure with six attributes (Dno, Dname, Manager, Location, Employee, and Project). You can observe that out of these attributes Dno and Dname have basic values; the other four have complex structure. Therefore you need to build second level of the complex object structure. You can also observe that out of these four Manager and Employee has tuple structure and the other two (Location, Projects) have set attributes. For the third level the manager has one basic attribute for start_date_exec and Mgr is a attribute which refers to employee object and has a tuple structure. For Location and Projects we have set of tuple structured objects.

    Thus, it is used to represent the object and its hierarchy in a structured form.

    Unstructured components are data types that are stored on large data storage. This kind of complex object is used to represent image or large text. For example the objects which are two dimensional images and if we need that any application needs to select from the collection of those  images which are of similar pattern then the user must provide the pattern which is recognized. Here pattern recognition is a different field of study in itself which may help in studying the different patterns and building relationship between the patterns.

    Persistence:

    You can create any object by executing some applications program, by invoking the object constructor operations. Not all objects are meant to be stored permanently in the database. Object persistence, is the term you often hear used in conjunction with the issue of storing objects in databases. Persistence is expected to operate with transactional integrity, and as such it is subject to strict conditions. In contrast, language services offered through standard language libraries and packages are often free from transactional constraints. The typical mechanisms for making an object persistent are naming and reliability.

    The naming mechanism involves giving an object a unique persistent name through which it can be retrieved by this and other programs. But sometimes it is not practical to give names to all objects in a large database that includes thousands of objects, so most objects are made persistent by using the second mechanism called reachability. The reachability mechanism works by making the object reachable from some persistent object.

    Type and class hierarchies:

    A type is defined by giving a type name and later listing the names of its visible (public) functions. Simple example, you can define a type that gives the details of an EMPLOYEE as,

    EMPLOYEE: Emp_Id, Name, Address, department, DOB, age, Phne_no

    In the EMPLOYEE type, you can implement Emp_Id, Name, Address, department, DOB, Phne_no functions as stored attributes, and the age function as a method that calculates the age from the value given in the DOB attribute and current date.

    Class is a means of grouping all the objects which share the same set of attributes and methods. An object must belong to only one class as an instance of that class (instance-of relationship). A class is similar to an abstract data type. A class may also be primitive (no attributes), e.g., integer, string, Boolean. Class hierarchies derive a new class (subclass) from an existing class (superclass). The subclass inherits all the attributes and methods of the existing class and may have additional attributes and methods.

    Inheritance:

    Inheritance is a way to define relationships among objects. As the name indicates inheritance tells us that an object is able to inherit characteristics from another object. In more detail we can say an object is capable of acquiring the state and behavior of its parent object. The objects will have common behaviors so that inheritance works.

    For example, suppose we would like to create a class called “Human” which would represent the physical characteristics. It is a generic class that would represent you me and anyone other human in the world. It has state that takes of having legs, arms, etc. They can eat, sleep, drink, and walk. In that way, human is capable of acquiring behaviors, that resembles all of us same. But when it comes to specific of being gender it is not the same. So another two new class types need to create “man” and woman”. The state and behavior of the human will now depend upon these two classes. The human will differ from each other based on these two types and may be combination of two classes. Therefore, inheritance allows us to encompass the state and behavior of parent class to child. The child class is treated as the specialized version of its parent.

    Advantages of inheritance

    1. It is an abstraction mechanism which may be used to classify entities.

    2. It is a reuse mechanism at both the design and the programming level.

    3. The inheritance graph is source of organizational knowledge about domains and systems.

    Object Oriented Databases

    Object oriented databases are also called Object oriented database management system (ODBMS). These databases store objects rather than storing data such as integers, strings and real numbers. An object has attributes and methods. As you know attributes are data that defines the characteristics of object, it store integers, strings etc. Methods define the behavior of the objects. They are also called as procedures.

    If we ask ourselves when to use objects databases, then the answer is whenever you need to store complex databases or relationships then we can use ODs.

    While the relational database stores the data about the object, ODs store the objects. in this way it avoids more processing methods for understanding the object. For example if you have to store the image of the dog in a relational database then you need to store the different parts of the dog in the table. The following table may be the representation of storing the image of dog in the relational database.

    Table 14.1: Relational database

    face

    eyes

    Mustache

    ears

    body

    Front legs

    Back legs

    The mouth gap

    If the same thing has to be stored in ODBMS, it is the object DOG which is the combination of many attributes and methods.

    Table  ODBMS table

    image

    This kind of storing serves in following types of applications

    1. CAD applications: This kind of storing the data helps in storing the complex data types.

    2. Multimedia applications: ODBMS helps in storing wide range of data

    types in the same database.

    3. Evolutionary applications: Using ODBMS it becomes easier to follow objects through time.

    History of Databases

    In early 1950s the data was stored in files and this was the first method of recording the data for processing and future process. This method was called File processing systems. In this kind of systems data was stored after the process created it has ceased to exist. Gradually files were replaced by tree structure in 1960. The structure allows repeating information using parent/child relationships: each parent can have many children but each child only has one parent. All attributes of a specific record are listed under an entity type. During 1970s, relational DBMS was introduced which work on relationship that exists between the entities. They show more reliable property, more flexible, less redundant and multiple views of same data.

    For the better simulation and storing complex objects ODBMS came into existence during 1990s. Advantages of reuse of database and inheriting the properties were undertaken. The below table shows the history of databases during the course of period:

    Table History of Databases

    System

    Property

    File systems (1950s)

    · store data after process created it has ceased to exist

    hierarchical/ network

    (1960s)

    · concurrency

    · recovery

    · fast access

    · complex structures

    Relational (1970-80s)

    · more reliability

    · less redundancy

    · more flexibility

    · multiple views

    ODBMS (1990s)

    · better simulation

    · more (and complex) data types

    · more relationships (e.g. aggregation, specialization)

    · single language for database AND programming

    · better versioning

    · no ‘reconstruction’ of objects

    · Other OO advantages (reuse, inheritance etc.)

    How do ODBMS work?

    Consider an example of Student_Course relationship. The entity STUDENT has got attributes std_id, std_name and std_address. The following will be the table for STUDENT database.

    STUDENT

    Std_id

    Std_name

    Std_add

    MBA2001

    Priyadarshini Bhat

    #16, Cambridge layout, Bangalore

    MBA2002

    Ashwini Sharma

    #45, Gupta Layout, Mumbai

    MBA2003

    Ravi Joshi

    #54, Airport Road, Delhi

    MBA2004

    Shilpa Saxena

    5th Main, BTM layout, Bangalore

    MBA2005

    Rashi Khanna

    #4, Kanaka Layout, Lucknow

    The entity COURSE has got attributes Course_id and Course_name

    COURSE

    Course_Id

    Course_name

    M1

    Marketing

    H1

    Human Resource

    IS1

    Information science

    IT2

    Information technology

    The relationship between the STUDENT and COURSE is identified by the relation OPTED. Therefore the relationship database has Std_id and course_id as its attributes.

    OPTED

    Std_id

    Course_id

    MBA2001

    M1

    MBA2002

    H1

    MBA2003

    IS1

    MBA2004

    IT2

    MBA2005

    M1

    The examples of queries in relational database model are given below

    1. When we require knowing what course the student with student ID MBA2005, then the query may be,

    Ø Go to OPTED and look up student with id MBA2005 and return the course_id.

    It will return M1

    Ø Go to COURSE and look up M1 and return Marketing

    2. For the query, Name all students opting Marketing, then the query may be,

    Ø Go to COURSE and find course_id

    It will return M1

    Ø Go to OPTED and look up M1 and return all std_id

    It will return MBA2001 and MBA2005

    Ø Go to STUDENT and find each std_id and return each std_name

    It will return Priyadarshini Bhat and Rashi Khanna

    In object Oriented Database Model, the following diagram represent the system

    clip_image002[4]

    Figure Object Oriented Database Model

    The same examples of queries is represented in the Object Oriented database model as given below

    1. When we require knowing what course the student with student ID

    MBA2005, then the query may be,

    Ø Search STUDENT index for pointer to MB2005

    Ø Follow course pointer to M1and return course_name

    It will return Marketing

    2. For the query, Name all students opting Marketing, then the query may be,

    Ø Search Course index and find Course_id

    Ø Follow student pointers, looking up each std_id

    This process is called Navigation. You should note that the process relies on pointers and for this reason pointers must be persistent. When this system was first initiated the querying varied considerably. But due to the existence of object oriented language (OOL), It has become normalized.

    Implementation Issues

    To implement a stored procedure, the behavior must be described in the object model and implemented in the run time implementation of the object model behavior.

    Likewise, referential integrity traditionally supported through triggers or declarative constructs in the relational world, must be described in the object model and implemented in the runtime. The theoretical problem with this is that such things as database rules must be consistently implemented in each application, as opposed to once in the DBMS with most RDBMS and ERDBMS products. If this separation is not managed inconsistencies can arise in the database.

    The most important factors which is responsible are the following Persistence: This is that property of object oriented a database which gives objects persistence. This allows the objects to be stored between database runs. This also helps in versioning which means a new object is created every time changes are made.

    Sharing: objects can be shared in the distributed environment. Objects can be shared between processes where ever required. This is possible with object oriented databases.

    Paging: Object-oriented databases can reduce the need for paging by enabling only the currently required objects to be loaded into memory (relational databases load in tables containing both the required data AND other unnecessary data)

    Relationships

    Relationships are the connectivity between the two objects or among different objects. Diamond is the notation used to represent relationship. For any object to be a part of a system it should have at least one relationship that exists with the other object or entity. For example in the class room suppose STUDENT and CLASSROOM are two objects then they should have relationship between them like student sits in the classroom. Here sits in in the relationship that is there between student and classroom. This is represented by

    image

    There are four different kinds of standard relationships which object oriented databases models.

    1. Inheritance: this kind of relationship is used when one object is a kind of something else. For example, Son looks like his father.

    2. Association: This kind of relationship is used when one object is having

    connection with another object. For example, Husband is related to his

    Wife.

    3. Aggregation: this kind of relationships is used when one object is made out of other objects. For example, human body is made out of different organs.

    4. Inverse relationship: This kind of relationships is used when one object

    is part of another object. For example, Stomach is part of human body.

    Advantages

    There are many advantages in using ODBMS over RDBMS. They are

    · Objects don’t require assembly and disassembly saving coding time and execution time to assemble or disassemble objects.

    · Reduced paging

    · Easier navigation which leads easier versioning

    · Better concurrency control – A hierarchy of objects may be locked.

    · Data model is based on the real world.

    · Less code required when applications are object oriented.

    · Relationships and constraints on objects can be stored in the server application

    · Fit in well with client/server and distributed architectures

    Limitations

    In spite of much advantage we have from ODBMS there are many drawbacks.

    They are

    · Lower efficiency when data is simple and relationships are simple.

    · Relational tables are simpler.

    · Reduced access speed due to late binding.

    · More user tools exist for RDBMS.

    · Lack of standards includes lack of common query language. Such as

    SQL.

    · Support for RDBMS is more certain and change is less likely to be required.

    Object Relational Database Management Systems

    Object Relational database management systems simply ORDBMS is a system that implement object oriented front end on a relational database. It acts as a interface when the other applications interact with this database. It will behave as though the data is stored as objects. The information which is in the form of objects is converted into database.

    Performance Constraints

    ORDBMS converts data between an object oriented format and RDBMS format. Therefore, the speed performance of the database is degraded substantially. This is due to the additional conversion work the database must do.

Hope you will like Series of Database Management Systems series !

If you have not yet subscribe this Blog , Please subscribe it from “follow me” tab !

So that you will be updated @ real time and all updated knowledge in your mail daily for free without any RSS subscription OR news reading !!

Happy Learning and Sharing !!

For More information related to BI World visit our all Mentalist networks Blog

SQL Server Mentalist … SQL Learning Blog

Business Intelligence Mentalist … Business Intelligence World

Microsoft Mentalist … MVC,ASP.NET, WCF & LinQ

MSBI Mentalist … MS BI and SQL Server

NMUG Bloggers …Navi Mumbai User Group Blog

Architectural Shack … Architectural implementation and design patterns

DBA Mentalist …Advance SQL Server Blog

MVC Mentalist … MVC Learning Blog

Link Mentalist … Daily Best link @ your email

Infographics Mentalist … Image worth explaining thousand Words

Hadoop Mentalist … Blog on Big Data

BI Tools Analysis … BI Tools

Connect With me on

| Facebook |Twitter | LinkedIn| Google+ | Word Press | RSS | About Me |

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: