Starter 2: 2.1 Advantages of Multimedia Database 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

1.

Starter 2
2. Multimedia database. 2
2.1 Advantages of multimedia database 3
3. Motivated Example. 4

4. Multimedia objects: What Is It? 5


4.1 Image type 6
4.2 Audio Video type type 6
5. Multimedia objects storage model ...

6. Different architectures for multimedia databases

6.1 I 2 RP architecture 7
6.2 SQL+D architecture 8
6.3 The Oracle interMedia architecture 9
7. Entity-Multimedia-Relationship model (EMRM) 12
8. Defining types and Creation of tables using oracle interMedia ..13
9. New look using Oracle 9i multiMedia.21

Sushil Kulkarni

1. Starter
Today, we need to query and process vast quantities of data that are not easy to
describe with mere symbols. The term "multimedia" attracts a lot of attention, it's really
just a subclass of a large category of unstructured data called abstract data; The
examples of multimedia are text, images, audio, video etc.
The recent explosion in the use of media-rich Internet applications has resulted in an
appreciation for the value of multimedia content, and a realization of the challenges in
managing that content. Emerging Web and e-commerce applications found in diverse
areas such as retail sales, real estate, and Web publishing, need effective, efficient, and
reliable management of multimedia content.
Managing multimedia content for such applications presents unique issues. Large,
relatively unstructured media objects come in a wide variety of complex formats, and
need to be associated with the appropriate application information. Loading large
volumes of multimedia content into a management system requires associating the
correct metadata; indexing the content for search and retrieval; and, efficiently
delivering the multimedia content.
Media and metadata can be stored using following alternatives:
* Binary large objects, or BLOBs, stored within the database
* File-based large objects, or BFILEs, stored in local operating system specific file
systems
* URLs containing image, audio, and video data stored on any HTTP server, such as
the Oracle9i Application Server
* Specialized media storage servers
In this chapter, I will present the architecture and model required for multimedia
databases and its implementation using Oracle interMedia.
2. Multimedia database
Thus, a multimedia database is a database that contains one or more media types of
information such as text, image, video clip, sound, diagram, and graphical animation
and can help to analyze the problem.
There are several applications that need the ability to query multimedia objects based
on their content. For example, online shopping, criminal record application, medical
applications, album of satellite images etc.
An application for criminal records can contain the database that contains face
recognition to identification criminal, criminals trademarks, fingerprints and information
about his or her criminal activities. On the other hand an application for hospital
management may contain the databases of patients X-rays, electrocardiograms,
magnetic resonance imaging (MRI) and traditional information about patient like name
age etc.

sushiltry@yahoo.co.in

Sushil Kulkarni

To satisfy these needs, commercial DBMSs like DB2, Informix, Oracle interMedia support
content based retrieval over multimedia data.
On the web there are huge data files that can support multimedia databases. For
example, consider the web based image data management solution system contains
Text that provides a rich sensory experience, powerful search capabilities, and
extraordinary convenience to a large market of customers giving the system a distinct
competitive advantage. The systems main assets are of course the images, and the
traditional relational (business) data. Placing all these assets in the same database
management system reduces administration and training costs, and increases system
reliability, availability, and scalability. Most important, it creates opportunities for
multimedia information sharing, redirection of that information, and integration of the
multimedia data with traditional relational data and other operational applications that
manage the systems business.
2.1 Advantages of multimedia database
Following are advantages to store multimedia objects in the database:
* Better security: multimedia objects are secured in the databases and can be
invoked any time when required. For example, a doctor can see M.R.I. report of
patient whenever he wants and can be preserved as long as the patient takes the
treatment of doctor.
* Greater control (resizing, manipulating): multimedia objects can be resized
when required and certain changes can be made when required.
* Easy deletion: Images can be deleted without deleting the corresponding data
from the database
* One can search for multimedia content in the same fashion as they search for
traditional relational data. For instance, customers can search for images by a
unique image name or key, by photographer, or by category. In addition, customers
can use Oracle interMedias powerful image content based retrieval capability to
search for similar images recursively through the database. And once a customer
has found an image of interest, they can simply click on it and see the full resolution
image.
* Easy to extract statistics on usage
Oracle interMedia enables Oracle9i to manage multimedia content (image, audio, and
video) in an integrated fashion with other enterprise information. It extends Oracle9i
reliability, availability, and data management to multimedia content in media-rich
Internet applications. As an integral part of the Oracle9 i database server, Oracle
interMedia data benefits from all Oracle9i capabilities, including its speed, efficiency,
scalability, security, and power.

sushiltry@yahoo.co.in

Sushil Kulkarni

3. Motivated Examples
Digital Library is a hot research field and there are matured systems that are
developed. The Association for Computing Machinery (ACM) has already put all its
journals online in its digital library. They have stopped sending the published journals to
its members since 2002.As a substitution of the traditional media the digital library (DL)
of ACM provides much more functionality for researchers to retrieve the interested
papers.
Another big computer research society, the IEEE software also decided to stop
providing the paper based journal. However, the in use digital libraries are not actual
digital library because they still need the backend support of the traditional media. For
example, ACM digital library is just the index of the traditional journal and documents
are stored in PDF format.
One can define the system that supports multimedia objects in addition to text. One can
also have some user-defined data types and functions to retrieve the multi media
objects.
The Multimedia Digital Library Document system (MDLDS) can be designed for
educational and research use. The possible Document can include lectures given by the
Professor, reports include demo of the software applications, seminar lecture given by
the visiting scholars so on and so forth.
This system can have learning Network that allows the students to take classes without
regular lectures. Students can learn by reading the notes, assignments given by the
professors and doing the project at home. However, without lectures it becomes hard
for students to get the points of the professor correctly and the learning curve is going
to be smooth to most students. With the MDLDS the Professors can record their lectures
to some important issues and save them as Documents. The students can retrieve and
play video/audio of the lectures stored in the MDLDS system to learn quickly.
The system can also be used for research. The research has lot documents published
every year. Some of them are about software applications. Even though the writing
paper can be very good for people to read but it will be hard to understand what is
going on with the system with paper only because the system might be very
complicated. With the MDLDS system the document can have video/audio that shows
how the system works and how they deal with the problems to other researchers. This
will help improve the communication among researchers and avoid of the repeated
work.
The Professors and researchers can write/record the documents and put it into the
system. Beside this they can also use the system to retrieve the documents for
education or research purpose. The students can retrieve the documents for study or
research use and may contribute documents too.
The basic requirement of this system is to support information retrieval of the
documents. The document contains not only the traditional text document but also the

sushiltry@yahoo.co.in

Sushil Kulkarni

multimedia including picture, audio or video. So the system must support the multimedia
data type and the operations on them. There may have many kinds of search
requirements like some people may only want to get the picture of the system structure
so it doesnt make sense to retrieve the document as a whole. We should be able to
operate on the pieces of the documents.
Following are representative queries on MDLDS:
(1)
(2)
(3)
(4)
(5)

Search for the Documents about Turing machine.


Look for the picture of the architecture of IA64 of Intel CPU
Get the lecture of SSM model presented by Mihir Sardespande in 2002
Get all the Documents written by Prof. Abhyankar in the past three years
Because of the time conflicting I did not attend a seminar of Introduction to
Hackystat held on Dec 6, 2002 I want to get the video about that seminar.
(6) Im doing the research of Empirical Software Engineering and I want to get to
know the people who are doing the research in this field and with Documents
published in the recent three years.
(7) I am a new Professor of Databases and the class is online. I want to get all the
previous lectures because they can help me organize my teaching materials and
provide the videos of some lectures to students.
(8) I am taking class and it requires me to draw the UML diagram but I dont know how
to use Rational Rose which is good at drawing UML diagram. The class is online
and my friend told me the professor ever gave a tutorial session on Rational Rose.
I want to get that lecture and start to lean how to use Rational Rose.
I cannot say these queries are complete but they are the typical queries required that
can be possible.

4. Multimedia objects: What Is It?


As the name implies, multimedia comprises many kinds of media, including image,
video, audio, graphics, animation, hypertext, and hypermedia. It can also include MRI
data and other abstract data types (ADTs).
Media objects are similar to Java or C++ classes, to describe image, audio, and video
data. An instance of these objects consists of attributes, including metadata, the
multimedia content, and methods.
Multimedia content is the actual image, audio, or video data.
Metadata is format information about the multimedia content, including information
such as object length, compression or format, or application provided information (for
example, a singers name for a digital audio song).
Methods are procedures that can be performed on the object such as store, deliver, or
extract metadata, and compress or convert image format.
Let us study these multimedia objects in detail:

sushiltry@yahoo.co.in

Sushil Kulkarni

4.1 Image Type


These are two-dimensional, static, digital images stored as binary representations of
real-world objects or scenes, in most popular file formats and compression schemes.
Image file formats provide a convenient means for an application to store an image in a
flat file. By publishing the internal layout of such a file, it is possible to use it as an
interchange medium between different applications.
A digital image consists of attributes that describe the characteristics of the image, and
the image data itself (the digitized bits). The image data (pixels) can have varying
depths (bits per pixel) depending on how the image was captured, and can be organized
in various ways. The minimum attributes of an image include the following:
*
*
*
*

Size (height in scan lines and width in pixels)


Number of bits per pixel in each of the colors sampled
Compression type
Content format

The content format consists of monochrome or bit depth, color space (GRAY, RGB),
Special attributes such as alpha channel or transparency color.
Multimedia database supports most popular desktop publishing image file formats,
including: TIFF, JFIF (more commonly referred to as JPG), BMP, TARGA, EXIF, PCX,
PICT, GIF, CALS, SUN RASTER, FPIX, PNGF, PPMF, PGMF, PBMF, WBMP, and RPIX.
Developers can easily store images created by applications without becoming experts in
image file formats.
4.2 Audio and Video Types
Audio and video services provide the foundation for digital audio and video data in
databases. Digitized audio/video consists of the data (digitized bits) and the attributes
that describe and characterize the data. The minimum collection of attributes includes
the following:
*
*
*
*
*
*
*
*
*

Source type, location, and name


Description
File format
Number of audio channels
Sample/frame rate and sample/frame size
Frame resolution and total number of frames
Number of colors
Bit rate
Duration

These data attributes describe or characterize the data as it was recorded or produced
by the digital recording device.

sushiltry@yahoo.co.in

Sushil Kulkarni

4.2.1 Audio Formats


Audio data are stored in AIFF, AIFFC, AUFF, WAV, MPEG I, MPEG II, MPEG III, and
RealNetworks audio formats. It automatically extracts metadata information from these
formats, and stores it as attributes of the audio object.
4.2.2 Video Formats
Video data are stored in QuickTime, AVI, and RealNetworks video formats. It enables
applications to store metadata information as attributes of video object
5. Multimedia Objects Storage Model
The multimedia have a common multimedia storage model. The multimedia component
of these objects can be stored in the database, as a BLOB under transaction control.
The multimedia component can also be stored outside the database, without transaction
control. In this case, a pointer, under transaction control, is stored in the database,
while the multimedia component is stored in an external BFILE (operating system flat
file), at an HTTP server-based URL, on a specialized media server, or at a user-defined
source on other servers.
Multimedia content stored outside the database can provide a convenient mechanism for
managing large, or new multimedia repositories that reside as flat files on erasable or
read-only devices. This data can be imported and exported between BLOBs and the
external BFILE source at any time.
Object metadata and methods are always stored in the database. Whether multimedia
content is stored inside or outside the database, Database manages metadata for all the
multimedia object types, and automatically extracts that metadata for each type. This
metadata includes the following:
Data storage information including the source types, location, and name
Data update time and format
MIME media type (used in Web and mail applications)
Image height and width, and image content length, format, and compression type
Audio encoding type, number of channels, sampling rate, sample size, compression
type, play time (duration), and description
* Video frame widths and heights, frame resolution and rate, play time(duration),
number of frames, compression type, number of colors, bit rate, and description
* Select application metadata (for example, singer or studio names)
*
*
*
*
*

6. Different architectures for multimedia databases


There are various architectures for multimedia databases. Following are three
architectures that we will discuss:

sushiltry@yahoo.co.in

Sushil Kulkarni

6.1 I 2 RP architecture [Intelligent Information Retrieval and Presentation


with Multimedia Databases]
This architecture is question-answer system. The result of query given by user is
multimedia presentation containing the answer. The following figure illustrates this
architecture:

6.2 S Q L+D architecture


SQL+D an extension to SQL, which allows users to dynamically specify how to display
answers to queries posed to multimedia databases. It provides tools to display
multimedia data plus other traditional GUI elements such as boxed text, checkbox, list,
and button. The architecture of SQL+D is shown in the following figure.
The version of SQL+D, includes:
* The full implementation of the Database Interface, allowing users to connect
local and remote ODBC (or JDBC) compliant database, such as ORACLE or
Microsoft Access.
* Simplified display specifications syntax and instantiation of display elements.
SQL+D differs from other efforts in that it is specifically designed for querying
multimedia databases. It emphasizes in the query, by-the-user specification of the
display of the output data. In contrast, others have focused on specification of the
query, data visualization, or data browsing. SQL+D allows all of these, and we have one
browsers and visual querying applications as a proof of concept. By proposing SQL+D as
a language extension to SQL, we intend to maintain the flexibility that allowed SQL to be

sushiltry@yahoo.co.in

Sushil Kulkarni

adopted as the query language of choice by a great number of database management


systems and browsers, as well as by many programming languages that allow
embedded SQL queries.
6.3 The Oracle interMedia architecture
This architecture is best explained against a typical three-tier architecture as depicted in
figure:

sushiltry@yahoo.co.in

Sushil Kulkarni

10

6.3.1 Data Server Tier


In the first (foundation or data server) tier (see figure below), within the Oracle9i
database, are tables that contain media columns. The arrow to the right points to
externally referenced media (files).

Above that arrow, still within the Oracle9i database (see figure), are two boxes: the
media parser and the media processor. The parser takes multimedia content and
parses out the format and application metadata when that content is entered into the
database. The media processor, primarily based upon the Java Advanced Imaging (JAI)
engine, supports the processing of images within the database. Both the parser and
processor are written in Java, and run within the Oracle9i Java Virtual Machine (JVM).
To the left of the Oracle9i database (see figure) are the special delivery servers. These
servers, connected by plug-ins, get the multimedia content out of the database and
deliver it to thin clients (typically). The RealNetworks G2 streaming server is a good
example of a special delivery server.
To the right of the Oracle9i database (see figure) is a box labeled media content
indexers. These indexers perform functions such as speech recognition and building a
speech-to-text time base for the specialized multimedia content.
6.3.2 Application or Web Server Tier
In the middle tier (see figure below), is the Web server. It is here that Oracle
interMedia provide access class libraries. In the case of JDBC, these are Java classes for
efficient retrieval of multimedia content from the database, and delivery of it to Web
browsers.

sushiltry@yahoo.co.in

Sushil Kulkarni

11

6.3.3 Client Tier


At the third (or top) tier (figure 8), Oracle interMedia includes three components:
* Clipboard, two versions: NT utility and browser-based
* Annotator
* Business Components for Java (BC4J)

1. Clipboard: NT Utility and Browser-Based


The Clipboard component has two versions. The first version is an NT utility for
browsing, uploading, and downloading multimedia content between the database and
local files. The second version is browser-based and therefore portable across platforms.
The second version provides a hierarchical file oriented view of Oracle interMedia
multimedia content.
2. Annotator
The Annotator component is a utility that parses application metadata and uploads the
multimedia content and metadata into the database. Annotator is available as a Java
client and as a Java bean, so it can be integrated into customer or partner applications
and used in various script-based languages.
3. Business Components for Java (BC4 J)
The Business Components for Java (BC4J) make it simple for developers who use the
Oracle JDeveloper environment to generate media-rich applications. Developers can
easily create reusable modules that render and display multimedia content.
Following Figure puts the entire architecture together and focuses on the inter-connects
between the three tiers.

sushiltry@yahoo.co.in

Sushil Kulkarni

12

7. Entity-Multimedia-Relationship model (EMRM)


The EMRM model can be designed with traditional entities and their relationship set
along with the additional set called multimedia set. Multimedia sets are shown in this
model as entities and can be connected to the normal entities using relationship.
For example, one can design the EMRM as shown in the figure with description of the
entities and relationships as given below:
The entity Document is very important in the system. As a new media it contains
multimedia objects. The cardinality between Document and Media Object is one to
many, which means a Document has at least one media object and there is no blank
Document. The media object can exist without Technique
Report so the cardinality between Media Object and Document is 0 to many.
A media object can belong to multiple Documents.
Different media entities Text, Picture, Audio and Video have the (t, d)
classification hierarchy with the Media Object. Each media is a subclass of Media
Object and they are disjoint with each other.
In the system two kinds of user groups are anticipated which are Reader and Author
entities. A generic entity Person is defined to include the common attributes of

sushiltry@yahoo.co.in

Sushil Kulkarni

13

Reader and Author. It does make sense that a person can be the Author and
Reader at the same time so the classification hierarchy is (p, o) which means a
Person can be either a Reader or an Author or both.

The ternary relationship between Reader and Document is defined by connections


Read and Readby. A Reader can exist without any Document and the Document
can have no any reader at all. Also the Reader can read unlimited number of
Document and unlimited number of Reader can read the Document so the
cardinalities are from 0 to many.
Another ternary relationship is defined between the Author and the Document as
Write and Writtenby relationships. The difference is that a Document must have at
least 1 Author while an author can write 0 to many Document
The last entity is Publisher. The ternary relationship addresses the connection between
Publisher and Document. The Publisher can be an organization such as ACM, a
department like or a laboratory. The Document can be conjointly published by some
organizations so the cardinality is from 1 to n.
8. Defining types and Creation of tables using oracle interMedia
Now its time to implement multimedia database concepts using oracle intermedia. Here
we take relations and create tables and make queries on it.
(a)
(b)
(c)

An author is a person.
An author writes document.
Document contains multimedia content.

sushiltry@yahoo.co.in

Sushil Kulkarni

14

(d) Multimedia content consists of text, image, audio and video. In other
words, document consists of text, image, audio and video.
Let us consider the above statements:
(a) An author is a person.
Author and person are entities. We define name of person (Pname) and PersonType as
an object with attributes and a method to compute an age as follows:
1. Pname type object :
Create type Pname as object (
FirstName VARCHAR (20), // first name
MiddleName VARCHAR (3), // middle name
LastName
VARCHAR (20) // last name
);
1. PersonType object :
Create type PersonType as object(
pid
VARCHAR (12), // user pid
Name
Pname, // name object of the person
Bdate
Date, // birthdate
Pnumber VARCHAR(10), // contact phone number
Profile CLOB // Persons profile image
);
create type body PersonType as
member function Age_f return Integer as
begin
Return Year(sysdate) Year(Bdate);
End Age_f
End;
Now we create an author table as follows:
Create table Author (
aid
CHAR(12) NOT NULL, // author id
person
PersonType // person object
research_field VARCHAR(500), // Research field of the author
primary key (aid)
)
The author id is the primary key of this table so its automatically indexed. Some queries
are about the authors name or the research_field so it might be a good choice to index
the name of the person and research field. The index in name is a composite index
because the search on name will match the last name and first name at the same time.
It can improve the efficiency.

sushiltry@yahoo.co.in

Sushil Kulkarni

15

Create index Ind_Author_name on Author (person. LastName, person.


FirstName);
Create index Ind_Author_research on Author(research_field)
(b) An author writes document.
We define a table called document as follows:
Create table document (
did
CHAR(12) NOT NULL, // Identifier of the document
Title
VARCHAR(500), // Title of the document
Abstract VARCHAR(2000), // Abstraction
Keyword
VARCHAR(500), // Atomic keyword
CreatedDate Date default SYSDATE, // Creation day
Primary Key (did)
)
Keyword is used in the document to improve the search efficiency. The creation date of
the document is kept to manage different documents and satisfy the search request
with date requirement. For instance a query could be to get the document published in
the past 5 years.
The did is the primary key that is already automatically indexed by the DBMS. As the
primary key the pid column cannot be null. Most queries will search the title, abstract
and keyword so its better to create term index to title, abstract and keyword column as
follows:
Create index Ind_Title on document (Title); // Term index on
title
Create index Ind_Abstract on document (Abstract); // Term index
on abstract
Create index Ind_Keyword on document (Keyword); // Term index on
keyword
The default value to the CreateDate is the current system time.
Lastly, we define writes relationship table and it presents the relationship between the
author and the document.
Create table Writes (
did
CHAR(12) NOT NULL, // Document Id
aid
CHAR(12) NOT NULL, // Author id
Primary key (did, aid),
Foreign Key (did),
Foreign Key (aid)
);
(c) Document contains multimedia content.
Now we have to define multimedia content type as follows:

sushiltry@yahoo.co.in

Sushil Kulkarni

16

Create type Media as object (


mid
CHAR (10), // Identifier
Keywords VARCHAR(1000), // Keyword of the media object
Type
CHAR(5), // media type
Date
Date // created date of the media
);
Here Type indicates the format of the media content. The keywords can be used to
digest or category the media and used to speed up the search efficiency. We are not
defining the table for media.
(d) Document consists of text, image, audio and video.
Here we define text, image, audio and video types and create corresponding tables. Also
we define consists of relationship table.
1. Text object and table
It inherits the attributes from the media type and has one more attributes defined by
Content (CLOB). It defines a Character Large Object supported by Oracle 9i.
Create type TextMedia under Media (
Content CLOB, // content of the text object
);
Create table TextMediaTable (
tmid CAHR(12) NOT NULL, // Id of the text media
Text TextMedia, // Text media object
primary key (tmid)
);
The tmid of the text media is the primary key of the table TextMediaTable. The primary
key will ensures that tmid is unique and is indexed automatically by the DBMS. For
query efficiency purpose the attribute keywords is indexed.
Create Ind_Text_Keyword on TextMediaTable (Text.keywords); //Term
index of the keyword of the text
The content of the TextMedia is a CLOB data type that can be indexed as normal data
types in Oracle. This term existence index can help the search on the context of the
document.
Create Ind_Text_Content on TextMediaTable (Text.content); // Term
index of the content of the text
2. consistsOfText table:
A relationship table that connects the document (via multimedia content) and text media
is designed to implement the consistof relationship as follows:
sushiltry@yahoo.co.in

Sushil Kulkarni

17

Create table ConsistOfText (


did CHAR (12) NOT NULL, // Id of the document
tmid CHAR (12) NOT NULL, // Id of text media
Primary key (did, tmid), // Joint primary key
Foreign key (did),
Foreign key (tmid)
);
did is the document identifier of the document and tmid is the identifier of the text
media type. A document can have more that one text media and one text media can be
used by more than one document.
3. image object and table:
An image inherits the media entity and has all the attributes defined by the media.
Additionally, Besides they also have the following:
* Caption: Caption is the title of the picture. It addresses what the figure is about. In
the DBMS caption can be indexed to facilitate the search.
* Pixels (BLOB): Pixel is defined as binary large object that holds the pixels of the
image. We can have user-defined functions (UDF) to provide the operations on it
and index it if necessary.
Image type and table can be created as follows:
Create type imageMedia under Media (
Caption VARCHAR (500), // The caption of the picture
Pixels BLOB, // Pixel matrix of the image
);
Create table imageMediaTable (
imid
CAHR(12) NOT NULL,
Image
imageMedia,
primary key (imid)
);
The imid of the image media is the primary key of the table imageMediaTable. The
primary key will ensure the imid is unique and is indexed automatically. For query
efficiency purpose the attributes keywords and caption are indexed too.
Create Ind_image_Keyword on imageMediaTable(Image.keywords); //
Index of image keywords
Create Ind_image_Caption on imageMediaTable(Image.Caption); //
Index of image caption
Now we connect an imageMedia table to document using consistOf relationship as
follows:
Create table ConsistOfImage (

sushiltry@yahoo.co.in

Sushil Kulkarni

did
CHAR
imid
CHAR
Primary key
Foreign Key
Foreign Key
);

18

(12) NOT NULL, // Id of the document


(12) NOT NULL, // Id of image media
(did, imid), // Joint primary key
(did),
(imid)

imid is the identifier of the image media type. A document can have more that one
image media and one image media can be used by more than one document. The
conjoint primary key implements this relationship. Because the did and imidare also the
primary of tables document and imageMediaTable they are declared as foreign key in
this table.
4. Audio object and table:
The Audio inherits the media type so it has all the attributes defined by the media
entity and the following additional attributes
* Title: Title is the theme of audio and it abstract what the content of the audio is
about.
* Introduction: The introduction of the audio gives more detail information to the
audio thanTitle. It is helpful for the search of the audio information.
* Track (BLOB): The audio track of the audio is defined as binary large object.
Audio type and table can be created as follows:
Create type AudioMedia under Media (
Title VARCHAR(500) , // Title of the audio tape
Introduction VARCHAR(5000), // A brief description of audio
Track BLOB // Track of the audio
);
Create table AudioMediaTable (
amid CHAR(12) NOT NULL, // amid of the audio media
Audio AudioMedia, // Audio media object
primary key (id)
);
The amid of the audio media is the primary key of the table AudioMediaTable. The
primary key will ensure the id is unique and is indexed. For query efficiency purposes
the attribute keywords, title and introduction are indexed too.
Create Ind_Audio_Keyword on Audio MediaTable(audio.keywords);
Create Ind_Audio _Title on Audio MediaTable(audio.Title);
Create Ind_Audio _Introduction on Audio
MediaTable(audio.Introduction);
Now we connect an audioMedia table to document using consistOf relationship as
follows:

sushiltry@yahoo.co.in

Sushil Kulkarni

19

Create table ConsistOfAudio (


did
CHAR (12) NOT NULL, // Id of the document
amid
CHAR (12) NOT NULL, // Id of audio media
Primary key (did, amid), // Joint primary key
Foreign Key (did),
Foreign Key (amid)
);
did is the identifier of the document and amid is the identifier of the audio media type. A
document can have more that one audio media and one audio media can be used by
more than one document. This conjoint primary key implements this relationship.
Because the did and amid are also the primary keys of tables document and
AudioMediaTable they are declared as foreign key in this table.
5. Video object and table:
The Video inherits the media type so it has all the attributes defined by the media and
the following additional attributes:
* Title: Title is the theme of audio and it abstract what the content of the audio is
about.
* Introduction: The introduction of the video gives more detail information to the
video than Title. It is helpful for the search of the video information.
* Stream (BLOB): Its the video stream defined as BLOB data type.
Video type and table can be created as follows:
Create type VideoMedia under Media (
Title
VARCHAR(500) , // Title of the video clip
Introduction VARCHAR(5000), // A brief description of video
Stream BLOB // Video stream
);
Create table VideoMediaTable (
Vmid
CHAR(12) NOT NULL,
Video VideoMedia,
primary key (vmid)
);
The vmid of the video media is the primary key of the table VideoMediaTable. The
primary key will ensure the id is unique and is indexed. For query efficiency purposes
the attribute keywords, title and introduction are indexed too.
Create Ind_Video_Keyword on VideoMediaTable(video.keywords);
Create Ind_Video_Title on VideoMediaTable (video.Title);
Create Ind_Video_Introduction on VideoMediaTable
(video.Introduction);
Now we connect videoMedia table to document using consistOf relationship as follows:
sushiltry@yahoo.co.in

20

Sushil Kulkarni

Create table ConsistOfVideo (


did
CHAR (12) NOT NULL, // Id of the document
vmid
CHAR (12) NOT NULL, // Id of video media
Primary key (did, vmid), // Joint primary key
Foreign Key (did),
Foreign Key (vmid)
);
vmid is the identifier of the video media type. A document can have more than one
video media and one video media can be used by more than one document. The
conjoint primary key implements this relationship. Because the did and vmid are also the
primary keys of tables document and VideoMediaTable they are declared as foreign
keys.
Now we fire the queries on the tables that are created.
sQuery 1. I am looking for the picture of old college of Mumbai whose name is
Elphinstone College
The picture can be displayed using following approach:
Document

ConsistOfImage

did
title= Elphinstone College

did ,

imid

ImageMediaTable
imid , Image.pixels

The query is written as follows:


SELECT
FROM
WHERE

imt.Image.pixels
document d,
ConsistsOfImage coi,
ImageMediaTable imt
d.title = Elphinstone College and d.did = coi.did
and coi.imid = imt.imid;

sushiltry@yahoo.co.in

21

Sushil Kulkarni

Query 2: I am looking for attractive audio and video clips to be used in my


presentation so that the students in my class will not sleep!
Audio and Video clips are found in audio/video media tables using following approach:
Document

ConsistOfAudio

did
title= computer

did ,

Document
did
title= Soccer

amid

ConsistOfVideo
did ,
vmid

AudioMediaTable
amid , Audio.Track
VideoMediaTable
vmid , Video.stream

The query is written as follows:


SELECT
FROM
WHERE

amt.Audio.Track
document d,
ConsistsOfAudio coa,
AudioMediaTable amt
d.title = computer and d.did = coa.did
and coa.amid = amt.amid;

You can listen to computer


SELECT
FROM
WHERE

amt.Video.stream
document d,
ConsistsOfVideo cov,
VideoMediaTable vmt
d.title = Soccer and d.did = cov.did
and cov.amid = vmt.vmid;

You can watch soccer


9. New look using Oracle 9i multiMedia
Oracle interMedia uses object data types, similar to Java or C++ classes, to describe
image, audio, and video data. These object data types are called ORDImage,
ORDAudio, and ORDVideo, respectively.
Applications use Oracle interMedia by adding one or more multimedia columns
(ORDImage, ORDAudio, or ORDVideo) to existing tables (see figure), or by creating new
tables with multimedia columns in them (see Figure). Any number of these columns can
be added to a table, and in the simplest form, this represents the integrated
management of relational and multimedia data.

sushiltry@yahoo.co.in

Sushil Kulkarni

22

interMedia also includes an object data type known as ORDDoc. This multimedia column
type can contain any mixture of ORDImage, ORDAudio, or ORDVideo objects, thus
increasing the flexibility of its multimedia management capability.

Let us create a table to include a picture of a particular item as follows


Create table Item(
Id char(12)
name VARCHAR(20),
price number,
photo ORDSYS.ORDImage
);
This table consists of name and photo entities. The above code is to create a table
structure where it will store the name and price of the product and its picture frame.
Following statement is required to initialise Image Directory Link
Create or replace directory image_dir as 'C:\adbms\images;
This line of code is to create or replace a directory named image_dir to point/link to the
directory as shown above.
Next we initialize Item as follows
Declare
image ORDSYS.ORDImage;
Begin
Insert into Item values
(

sushiltry@yahoo.co.in

Sushil Kulkarni

23

'it1',pictures,20,ORDSYS.ORDImage.init('file', 'image_dir',
'item.jpg')
);
Select photo into image from Item
Where Id = 'it1' for Update;
image.setProperties;
Update Item set photo = image
Where cam_id = 'Cam 1';
End;
The coding above is to set the pointer of it1 to point to the image file of the initialised
image directory. In this case, photo entity of it1 will store pointer value of image name
image.jpg in the directory of C:\adbms\images. This method of storing image is
known as the BFILE technique.

sushiltry@yahoo.co.in

You might also like