Your SlideShare is downloading. ×
CmpE226-DB-L12n-2-Intro.ppt
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

CmpE226-DB-L12n-2-Intro.ppt

309
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
309
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • 1) In SQL, this statement will query a relational database, i.e., a set of table-like structures (see Section 2.2, Second generation database technology), and return a table, the rows of which are rows of the table called products in which the column called colour has the value "black". If the relational database contains the products table in Figure 6.2 (a), the result of the query will be the Figure 6.2 (b) table.   2) In OQL this statement will query an object database and return a collection-object which contains objects contained in the collection object called products for which the value of the colour attribute is the literal "black". Given the object database in Figure 6.1, this OQL statement will return the object represented in Figure 6.3. 1) That which is interpreted as a table name in SQL, is interpreted as a collection-object name in OQL; 2) That which is interpreted as the name of a column of a table in SQL is interpreted as an object characteristic name (an attribute, relationship, or operation name) in OQL.
  • Transcript

    • 1. Object Oriented Database
      • Group 4
      • Mathieu Metz
      • Palani Kumaresan
      • Napa Gavinlertvatana
      • Kristine Pei Keow Lee
      • Prabhu Ramachandran
    • 2. Outline
      • Object definitions
      • Object Structures
      • Object-oriented concepts
      • OODBS
      • OQL with an example
      • SQL3 with examples
    • 3. Definition of an object
      • Objects – User defined complex data types
      • An object has structure or state (variables) and methods (behavior/operations)
      • An object is described by four characteristics
      • Identifier: a system-wide unique id for an object
      • Name: an object may also have a unique name in DB (optional)
      • Lifetime: determines if the object is persistent or transient
      • Structure: Construction of objects using type constructors
    • 4. Object Structure
      • The state (current value) of a complex object may be constructed from other objects (or other values) by using certain type constructors
      • Can be represented by (i,c,v)
        • i is an unique id
        • c is a type constructor
        • v is the object state
      • Constructors
        • Basic types: atom, tuple and set
        • Collection type: list, bag and array
    • 5. Object-Oriented Concepts
      • Abstract Data Types
        • Class definition, provides extension to complex attribute types
      • Encapsulation
        • Implementation of operations and object structure hidden
      • Inheritance
        • Sharing of data within hierarchy scope, supports code reusability
      • Polymorphism
        • Operator overloading
    • 6. What is Object Oriented Database? (OODB)
      • A database system that incorporates all the important object-oriented concepts
      • Some additional features
        • Unique Object identifiers
        • Persistent object handling
    • 7. Advantages of OODBS
      • Designer can specify the structure of objects and their behavior (methods)
      • Better interaction with object-oriented languages such as Java and C++
      • Definition of complex and user-defined types
      • Encapsulation of operations and user-defined methods
    • 8. 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)
    • 9. Example of OQL query
      • The following is a sample query
      • “ what are the names of the black product?”
      • Select distinct p.name
      • From products p
      • Where p.color = “black”
        • Valid in both SQL and OQL, but results are different.
    • 10. Result of the query (SQL) - The statement queries a relational database. => Returns a table with rows. Result Original table Black Mercedes SLK P3 Green Toyota Celica P2 Black Ford Mustang P1 Color Name Product no Ford Mustang Mercedes SLK Name
    • 11. Result of the query (OQL) - The statement queries a object-oriented database => Returns a collection of objects. Result Original table Black Mercedes SLK P3 Green Toyota Celica P2 Black Ford Mustang P1 Color Name Product no Ford Mustang String Mercedes SLK String
    • 12. Comparison
      • Queries look very similar in SQL and OQL, sometimes they are the same
      • In fact, the results they give are very different
      • Query returns:
      Tuple Table Object Collection of objects SQL OQL
    • 13. SQL3 “Object-oriented SQL”
      • Foundation for several OO database management systems – ORACLE8, DB2, etc
      • New features – “relational” & “Object oriented”
      • Relational Features – new data types, new predicates, enhanced semantics, additional security and an active database
      • Object Oriented Features – support for functions and procedures
    • 14. User defined Data Types
      • Creating a “row type”
        • Example:
        • create row type AddressType(
        • street char (50),
        • city char (20));
        • create row type StarType(
        • name char (30),
        • address AddressType);
    • 15. Creating Data Types (contd.)
      • Creating “Table”
      • create table Address of type AddressType;
      • create table MovieStar of type StarType;
      • Instances of Row types are tuples in tables
    • 16. Sample Query
      • Find the names and street addresses of those MovieStars who stay in the city “Columbus”:
      • select MovieStar.name, MovieStar.address.street
      • from MovieStar
      • where MovieStar.address.city = “Columbus”;
    • 17. Complex Data and Queries
      • A Water Resource Management example
      • A database of state wide water projects
      • Includes a library of picture slides
      • Indexing according to predefined concepts – prohibitively expensive
      • Type of queries
        • Geographic locations
        • Reservoir levels during droughts
        • Recent flood conditions, etc
    • 18. Complex Data and Queries (contd.)
      • Addressing these queries
        • Linking this database to landmarks on a topographic map
        • Examining the captions for each slide
        • Implementing image-understanding programs
        • Inspecting images and ascertaining attributes
      • These type of queries necessitate dedicated “methods”
    • 19. Creating Functions
      • create function one() returns int4
      • as ‘ select 1 as RESULT'
      • language 'sql';
      • select one() as answer;
      answer 1
    • 20. Creating “tables” with “methods”
      • Implementation
      • create table slides (
      • id int,
      • date date,
      • caption document,
      • picture CD_image,
      • method containsName
      • (name varchar)
      • returns boolean
      • as external name ‘matching’
      • language ‘C’ );
    • 21. Creating Tables (Contd.)
      • create table landmarks(
      • name varchar (30),
      • location point);
    • 22. Implementation (contd.)
      • Sample query – find a picture of a reservoir with low water level which is in “Sacramento”
      • select P.id
      • from slides P, landmarks L
      • where IsLowWaterLevel (P.picture) and
      • P.containsName (L.name) and L.name = “Sacramento”;

    ×