Designing OQL: Allowing Objects to be Queried - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Designing OQL: Allowing Objects to be Queried

Description:

ODMG OQL User Manual. Besides the paper, I referred the ODMG OQL User Manual. ... Set: unordered, duplicate free collection of arbitrary cardinality ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 29
Provided by: yin123
Category:

less

Transcript and Presenter's Notes

Title: Designing OQL: Allowing Objects to be Queried


1
Designing OQL Allowing Objects to be Queried
  • Sophie Cluet
  • INRIA
  • Presented By
  • Ying Liu
  • April 9th, 2003

2
ODMG OQL User Manual
  • Besides the paper, I referred the ODMG OQL User
    Manual.
  • http//www.cis.upenn.edu/cis550/oql.pdf

3
History
  • In 1988, INRIA in Altair Group started to develop
    an OODBS
  • In 1991, O2 DBS as a product of O2 Technology,
    and O2SQL as the query language
  • In 1991, ODMG was created and O2SQl became the
    standard of OQL
  • In 1998, OQL 5.0.

4
O2 System Overview(http//www.cis.upenn.edu/cis5
50/oql.pdf)
5
ODMG Standard
  • 1. an object model
  • 2. an object definition language for this model,
    with its own syntax, ODL
  • or its expression through C and Smalltalk
    syntax
  • 3. an object query language for this model, OQL
  • 4. a C binding allowing C programs to operate
    on a database compliant to the object model
  • 5. a Smalltalk binding allowing Smalltalk
    programs to operate on a database compliant to
    the object model

6
ODMG Model
  • The ODMG object model supports the notion of
    classes, of objects with attributes and methods,
    of inheritance and specialization.
  • It offers the classical types to deal with
    string, date, time, time interval and timestamp.
  • It supports the notions of relationships and
    collections .

7
Basic Constructs
  • Atomic Integer, Float, Boolean, Char
  • Pre-built String, Bitmap, Date
  • Collection
  • Set unordered, duplicate free collection of
    arbitrary cardinality
  • List Ordered collection of arbitrary
    cardinality
  • Bag Unordered collection of arbitrary
    cardinality
  • Array Ordered collection of fixed cardinality.

8
An O2 Schema Example
9
Entry points
  • To query any database, we need various entry
    points.
  • In O2 these are the named objects and named
    values.
  • For example, Globe is an entry point.

10
Creating an object
  • We create objects using struct, list, array, bag
    and set.
  • This creates a temporary object with the name
    attribute initialized to Trent.
  • An object collection can be created in the same
    way.

11
Simple Queries
  • Atomic Values

Struct Values
12
SelectFromWhere
  • Set (a set is an un-ordered, duplicate-free
    collection)
  • OQL uses the in keyword to define the range of
    a variable.

13
SelectFromWhere (contd)
  • List or Array A list or an array is an ordered
    collection that can contain duplicate elements.
  • Since it is ordered, you may extract any of its
    elements if you know their position.
  • Join

14
Constructing results
  • We can also construct a query result with an
    explicit structure using the struct, set, bag,
    list and array constructors.

15
Constructing results (contd)
  • Another example

16
Operators
  • Count
  • Define We can name the result of a query using
    the define clause. For example,

17
Operators (contd)
  • Exits
  • Group By

18
Operators (contd)
  • Like
  • Order by The result of an order by operation is
    always a list

19
Set operators
  • Union (), Interaction () and Difference (-)

20
Conversions
  • List to set
  • Set to list
  • Flatten

21
Combining operators
  • every operator can be combined with any other
    operator.

22
Indexes
  • Defining an index

23
OQL More
  • The most important characteristics of the OO
    language and system include
  • Hierarchy and inheritance
  • Method encapsulation
  • Polymorphism

24
A schema
25
More query
  • Path expressions

26
Method invoking
  • Method invoking

27
Polymorphism
  • Late binding
  • Class indicator

28
Summary
  • Basic queries
  • To query any database you need various entry
    points. In O2 these are the named objects and
    named values.
  • Select..from..where
  • Constructing results
  • The structure of a query result is very often
    implicit . However , you can also construct a
    query result with an explicit structure using the
    struct, set and list constructors.
  • Operators
  • OQL operators include define, order by, count,
    exists, group by and like. They can be combined
    for complex queries.
  • Indexes
  • Method Invoking
  • Polymorphism
  • Path expression
Write a Comment
User Comments (0)
About PowerShow.com