Multimedia

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 ………………………………………... 7 6. Different architectures for multimedia databases……………………… 7 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

Transcript of Multimedia

Page 1: Multimedia

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 ………………………………………... 7

6. Different architectures for multimedia databases……………………… 7

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

Page 2: Multimedia

Sushil Kulkarni 2

[email protected]

1. Starter

Today, we need to query and process vast quantities of data that are not easy todescribe with mere symbols. The term "multimedia" attracts a lot of attention, it's reallyjust a subclass of a large category of unstructured data called abstract data; Theexamples of multimedia are text, images, audio, video etc.

The recent explosion in the use of media-rich Internet applications has resulted in anappreciation for the value of multimedia content, and a realization of the challenges inmanaging that content. Emerging Web and e-commerce applications found in diverseareas such as retail sales, real estate, and Web publishing, need effective, efficient, andreliable 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, andneed to be associated with the appropriate application information. Loading largevolumes of multimedia content into a management system requires associating thecorrect metadata; indexing the content for search and retrieval; and, efficientlydelivering 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 multimediadatabases and its implementation using Oracle interMedia.

2. Multimedia database

Thus, a multimedia database is a database that contains one or more media types ofinformation such as text, image, video clip, sound, diagram, and graphical animationand can help to analyze the problem.

There are several applications that need the ability to query multimedia objects basedon their content. For example, online shopping, criminal record application, medicalapplications, album of satellite images etc.

An application for criminal records can contain the database that contains facerecognition to identification criminal, criminal’s trademarks, fingerprints and informationabout his or her criminal activities. On the other hand an application for hospitalmanagement may contain the databases of patient’s X-rays, electrocardiograms,magnetic resonance imaging (MRI) and traditional information about patient like nameage etc.

Page 3: Multimedia

Sushil Kulkarni 3

[email protected]

To satisfy these needs, commercial DBMSs like DB2, Informix, Oracle interMedia supportcontent based retrieval over multimedia data.

On the web there are huge data files that can support multimedia databases. Forexample, consider the web based image data management solution system containsText that provides a rich sensory experience, powerful search capabilities, andextraordinary convenience to a large market of customers giving the system a distinctcompetitive advantage. The system’s main assets are of course the images, and thetraditional relational (business) data. Placing all these assets in the same databasemanagement system reduces administration and training costs, and increases systemreliability, availability, and scalability. Most important, it creates opportunities formultimedia information sharing, redirection of that information, and integration of themultimedia data with traditional relational data and other operational applications thatmanage the system’s 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 beinvoked any time when required. For example, a doctor can see M.R.I. report ofpatient whenever he wants and can be preserved as long as the patient takes thetreatment of doctor.

* Greater control (resizing, manipulating): multimedia objects can be resizedwhen required and certain changes can be made when required.

* Easy deletion: Images can be deleted without deleting the corresponding datafrom the database

* One can search for multimedia content in the same fashion as they search fortraditional relational data. For instance, customers can search for images by aunique image name or key, by photographer, or by category. In addition, customerscan use Oracle interMedia’s powerful image content based retrieval capability tosearch for ‘similar’ images recursively through the database. And once a customerhas found an image of interest, they can simply click on it and see the full resolutionimage.

* Easy to extract statistics on usage

Oracle interMedia enables Oracle9i to manage multimedia content (image, audio, andvideo) in an integrated fashion with other enterprise information. It extends Oracle9ireliability, availability, and data management to multimedia content in media-richInternet applications. As an integral part of the Oracle9 i database server, OracleinterMedia data benefits from all Oracle9i capabilities, including its speed, efficiency,scalability, security, and power.

Page 4: Multimedia

Sushil Kulkarni 4

[email protected]

3. Motivated Examples

Digital Library is a hot research field and there are matured systems that aredeveloped. The Association for Computing Machinery (ACM) has already put all itsjournals online in its digital library. They have stopped sending the published journals toits 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 interestedpapers.

Another big computer research society, the “IEEE software” also decided to stopproviding the paper based journal. However, the in use digital libraries are not actualdigital library because they still need the backend support of the traditional media. Forexample, ACM digital library is just the index of the traditional journal and documentsare stored in PDF format.

One can define the system that supports multimedia objects in addition to text. One canalso have some user-defined data types and functions to retrieve the multi mediaobjects.

The Multimedia Digital Library Document system (MDLDS) can be designed foreducational and research use. The possible Document can include lectures given by theProfessor, reports include demo of the software applications, seminar lecture given bythe visiting scholars so on and so forth.

This system can have learning Network that allows the students to take classes withoutregular lectures. Students can learn by reading the notes, assignments given by theprofessors and doing the project at home. However, without lectures it becomes hardfor students to get the points of the professor correctly and the learning curve is goingto be smooth to most students. With the MDLDS the Professors can record their lecturesto some important issues and save them as Documents. The students can retrieve andplay 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 publishedevery year. Some of them are about software applications. Even though the writingpaper can be very good for people to read but it will be hard to understand what isgoing on with the system with paper only because the system might be verycomplicated. With the MDLDS system the document can have video/audio that showshow the system works and how they deal with the problems to other researchers. Thiswill help improve the communication among researchers and avoid of the repeatedwork.

The Professors and researchers can write/record the documents and put it into thesystem. Beside this they can also use the system to retrieve the documents foreducation or research purpose. The students can retrieve the documents for study orresearch use and may contribute documents too.

The basic requirement of this system is to support information retrieval of thedocuments. The document contains not only the traditional text document but also the

Page 5: Multimedia

Sushil Kulkarni 5

[email protected]

multimedia including picture, audio or video. So the system must support the multimediadata type and the operations on them. There may have many kinds of searchrequirements like some people may only want to get the picture of the system structureso it doesn’t make sense to retrieve the document as a whole. We should be able tooperate on the pieces of the documents.

Following are representative queries on MDLDS:

(1) Search for the Documents about “Turing machine”.(2) Look for the picture of the architecture of IA64 of Intel CPU(3) Get the lecture of “SSM” model presented by Mihir Sardespande in 2002(4) Get all the Documents written by Prof. Abhyankar in the past three years(5) 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) I’m 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 Documentspublished in the recent three years.

(7) I am a new Professor of Databases and the class is online. I want to get all theprevious lectures because they can help me organize my teaching materials andprovide the videos of some lectures to students.

(8) I am taking class and it requires me to draw the UML diagram but I don’t know howto use “Rational Rose” which is good at drawing UML diagram. The class is onlineand 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 thatcan 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 MRIdata and other abstract data types (ADTs).

Media objects are similar to Java or C++ classes, to describe image, audio, and videodata. An instance of these objects consists of attributes, including metadata, themultimedia content, and methods.

Multimedia content is the actual image, audio, or video data.

Metadata is format information about the multimedia content, including informationsuch as object length, compression or format, or application provided information (forexample, a singer’s name for a digital audio song).

Methods are procedures that can be performed on the object such as store, deliver, orextract metadata, and compress or convert image format.

Let us study these multimedia objects in detail:

Page 6: Multimedia

Sushil Kulkarni 6

[email protected]

4.1 Image Type

These are two-dimensional, static, digital images stored as binary representations ofreal-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 aflat file. By publishing the internal layout of such a file, it is possible to use it as aninterchange medium between different applications.

A digital image consists of attributes that describe the characteristics of the image, andthe image data itself (the digitized bits). The image data (pixels) can have varyingdepths (bits per pixel) depending on how the image was captured, and can be organizedin 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 inimage file formats.

4.2 Audio and Video Types

Audio and video services provide the foundation for digital audio and video data indatabases. Digitized audio/video consists of the data (digitized bits) and the attributesthat describe and characterize the data. The minimum collection of attributes includesthe 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 producedby the digital recording device.

Page 7: Multimedia

Sushil Kulkarni 7

[email protected]

4.2.1 Audio Formats

Audio data are stored in AIFF, AIFFC, AUFF, WAV, MPEG I, MPEG II, MPEG III, andRealNetworks audio formats. It automatically extracts metadata information from theseformats, 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 enablesapplications to store metadata information as attributes of video object

5. Multimedia Objects Storage Model

The multimedia have a common multimedia storage model. The multimedia componentof 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 transactioncontrol. 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 flatfile), at an HTTP server-based URL, on a specialized media server, or at a user-definedsource on other servers.

Multimedia content stored outside the database can provide a convenient mechanism formanaging large, or new multimedia repositories that reside as flat files on erasable orread-only devices. This data can be imported and exported between BLOBs and theexternal BFILE source at any time.

Object metadata and methods are always stored in the database. Whether multimediacontent is stored inside or outside the database, Database manages metadata for all themultimedia object types, and automatically extracts that metadata for each type. Thismetadata 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 threearchitectures that we will discuss:

Page 8: Multimedia

Sushil Kulkarni 8

[email protected]

6.1 I 2 RP architecture [Intelligent Information Retrieval and Presentationwith Multimedia Databases]

This architecture is question-answer system. The result of query given by user ismultimedia presentation containing the answer. The following figure illustrates thisarchitecture:

6.2 S Q L+D architecture

SQL+D an extension to SQL, which allows users to dynamically specify how to displayanswers to queries posed to multimedia databases. It provides tools to displaymultimedia 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 connectlocal and remote ODBC (or JDBC) compliant database, such as ORACLE orMicrosoft Access.

* Simplified display specifications syntax and instantiation of display elements.

SQL+D differs from other efforts in that it is specifically designed for queryingmultimedia databases. It emphasizes in the query, by-the-user specification of thedisplay of the output data. In contrast, others have focused on specification of thequery, data visualization, or data browsing. SQL+D allows all of these, and we have onebrowsers and visual querying applications as a proof of concept. By proposing SQL+D asa language extension to SQL, we intend to maintain the flexibility that allowed SQL to be

Page 9: Multimedia

Sushil Kulkarni 9

[email protected]

adopted as the query language of choice by a great number of database managementsystems and browsers, as well as by many programming languages that allowembedded SQL queries.

6.3 The Oracle interMedia architecture

This architecture is best explained against a typical three-tier architecture as depicted infigure:

Page 10: Multimedia

Sushil Kulkarni 10

[email protected]

6.3.1 Data Server Tier

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

Above that arrow, still within the Oracle9i database (see figure), are two boxes: themedia parser and the media processor. The parser takes multimedia content andparses out the format and application metadata when that content is entered into thedatabase. The media processor, primarily based upon the Java Advanced Imaging (JAI)engine, supports the processing of images within the database. Both the parser andprocessor 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. Theseservers, connected by plug-ins, get the multimedia content out of the database anddeliver it to thin clients (typically). The RealNetworks G2 streaming server is a goodexample of a special delivery server.

To the right of the Oracle9i database (see figure) is a box labeled media contentindexers. These indexers perform functions such as speech recognition and building aspeech-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 OracleinterMedia provide access class libraries. In the case of JDBC, these are Java classes forefficient retrieval of multimedia content from the database, and delivery of it to Webbrowsers.

Page 11: Multimedia

Sushil Kulkarni 11

[email protected]

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 forbrowsing, uploading, and downloading multimedia content between the database andlocal files. The second version is browser-based and therefore portable across platforms.The second version provides a hierarchical file oriented view of Oracle interMediamultimedia content.

2. Annotator

The Annotator component is a utility that parses application metadata and uploads themultimedia content and metadata into the database. Annotator is available as a Javaclient and as a Java bean, so it can be integrated into customer or partner applicationsand 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 theOracle JDeveloper environment to generate media-rich applications. Developers caneasily create reusable modules that render and display multimedia content.

Following Figure puts the entire architecture together and focuses on the inter-connectsbetween the three tiers.

Page 12: Multimedia

Sushil Kulkarni 12

[email protected]

7. Entity-Multimedia-Relationship model (EMRM)

The EMRM model can be designed with traditional entities and their relationship setalong with the additional set called multimedia set. Multimedia sets are shown in thismodel 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 theentities and relationships as given below:

The entity “Document” is very important in the system. As a new media it containsmultimedia objects. The cardinality between “Document” and “Media Object” is one tomany, which means a Document has at least one media object and there is no blankDocument. The “media object” can exist without “TechniqueReport” 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 “MediaObject” 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

Page 13: Multimedia

Sushil Kulkarni 13

[email protected]

“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 thecardinalities 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 atleast 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, adepartment like or a laboratory. The “Document” can be conjointly published by someorganizations so the cardinality is from 1 to n.

8. Defining types and Creation of tables using oracle interMedia

Now it’s time to implement multimedia database concepts using oracle intermedia. Herewe take relations and create tables and make queries on it.

(a) An author is a person.(b) An author writes document.(c) Document contains multimedia content.

Page 14: Multimedia

Sushil Kulkarni 14

[email protected]

(d) Multimedia content consists of text, image, audio and video. In otherwords, 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 asan 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 nameMiddleName VARCHAR (3), // middle nameLastName VARCHAR (20) // last name);

1. PersonType object :

Create type PersonType as object(pid VARCHAR (12), // user pidName Pname, // name object of the personBdate Date, // birthdatePnumber VARCHAR(10), // contact phone numberProfile CLOB // Person’s profile image);create type body PersonType asmember function Age_f return Integer asbeginReturn Year(sysdate) – Year(Bdate);End Age_fEnd;

Now we create an author table as follows:

Create table Author (aid CHAR(12) NOT NULL, // author idperson PersonType // person objectresearch_field VARCHAR(500), // Research field of the authorprimary key (aid))

The author id is the primary key of this table so it’s automatically indexed. Some queriesare about the author’s name or the research_field so it might be a good choice to indexthe name of the person and research field. The index in name is a composite indexbecause the search on name will match the last name and first name at the same time.It can improve the efficiency.

Page 15: Multimedia

Sushil Kulkarni 15

[email protected]

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 documentTitle VARCHAR(500), // Title of the documentAbstract VARCHAR(2000), // AbstractionKeyword VARCHAR(500), // Atomic keywordCreatedDate Date default SYSDATE, // Creation dayPrimary Key (did))

Keyword is used in the document to improve the search efficiency. The creation date ofthe document is kept to manage different documents and satisfy the search requestwith date requirement. For instance a query could be to get the document published inthe past 5 years.

The did is the primary key that is already automatically indexed by the DBMS. As theprimary key the pid column cannot be null. Most queries will search the title, abstractand keyword so it’s better to create term index to title, abstract and keyword column asfollows:

Create index Ind_Title on document (Title); // Term index ontitleCreate index Ind_Abstract on document (Abstract); // Term indexon abstractCreate index Ind_Keyword on document (Keyword); // Term index onkeyword

The default value to the CreateDate is the current system time.

Lastly, we define writes relationship table and it presents the relationship between theauthor and the document.

Create table Writes (did CHAR(12) NOT NULL, // Document Idaid CHAR(12) NOT NULL, // Author idPrimary key (did, aid),Foreign Key (did),Foreign Key (aid));

(c) Document contains multimedia content.

Now we have to define multimedia content type as follows:

Page 16: Multimedia

Sushil Kulkarni 16

[email protected]

Create type Media as object (mid CHAR (10), // IdentifierKeywords VARCHAR(1000), // Keyword of the media objectType CHAR(5), // media typeDate Date // created date of the media);

Here Type indicates the format of the media content. The keywords can be used todigest or category the media and used to speed up the search efficiency. We are notdefining 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. Alsowe define consists of relationship table.

1. Text object and table

It inherits the attributes from the media type and has one more attributes defined byContent (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 mediaText TextMedia, // Text media objectprimary key (tmid));

The tmid of the text media is the primary key of the table TextMediaTable. The primarykey will ensures that tmid is unique and is indexed automatically by the DBMS. Forquery efficiency purpose the attribute keywords is indexed.

Create Ind_Text_Keyword on TextMediaTable (Text.keywords); //Termindex of the keyword of the text

The content of the TextMedia is a CLOB data type that can be indexed as normal datatypes in Oracle. This term existence index can help the search on the context of thedocument.

Create Ind_Text_Content on TextMediaTable (Text.content); // Termindex of the content of the text

2. consistsOfText table:

A relationship table that connects the document (via multimedia content) and text mediais designed to implement the consistof relationship as follows:

Page 17: Multimedia

Sushil Kulkarni 17

[email protected]

Create table ConsistOfText (did CHAR (12) NOT NULL, // Id of the documenttmid CHAR (12) NOT NULL, // Id of text mediaPrimary key (did, tmid), // Joint primary keyForeign key (did),Foreign key (tmid));

did is the document identifier of the document and tmid is the identifier of the textmedia type. A document can have more that one text media and one text media can beused 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. Inthe DBMS caption can be indexed to facilitate the search.

* Pixels (BLOB): Pixel is defined as binary large object that holds the pixels of theimage. We can have user-defined functions (UDF) to provide the operations on itand 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 picturePixels 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. Theprimary key will ensure the imid is unique and is indexed automatically. For queryefficiency purpose the attributes keywords and caption are indexed too.

Create Ind_image_Keyword on imageMediaTable(Image.keywords); //Index of image keywordsCreate Ind_image_Caption on imageMediaTable(Image.Caption); //Index of image caption

Now we connect an imageMedia table to document using consistOf relationship asfollows:

Create table ConsistOfImage (

Page 18: Multimedia

Sushil Kulkarni 18

[email protected]

did CHAR (12) NOT NULL, // Id of the documentimid CHAR (12) NOT NULL, // Id of image mediaPrimary key (did, imid), // Joint primary keyForeign Key (did),Foreign Key (imid));

imid is the identifier of the image media type. A document can have more that oneimage media and one image media can be used by more than one document. Theconjoint primary key implements this relationship. Because the did and imidare also theprimary of tables document and imageMediaTable they are declared as foreign key inthis table.

4. Audio object and table:

The “Audio” inherits the media type so it has all the attributes defined by the mediaentity and the following additional attributes

* Title: Title is the theme of audio and it abstract what the content of the audio isabout.

* Introduction: The introduction of the audio gives more detail information to theaudio 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 tapeIntroduction VARCHAR(5000), // A brief description of audioTrack BLOB // Track of the audio);

Create table AudioMediaTable (amid CHAR(12) NOT NULL, // amid of the audio mediaAudio AudioMedia, // Audio media objectprimary key (id));

The amid of the audio media is the primary key of the table AudioMediaTable. Theprimary key will ensure the id is unique and is indexed. For query efficiency purposesthe 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 AudioMediaTable(audio.Introduction);

Now we connect an audioMedia table to document using consistOf relationship asfollows:

Page 19: Multimedia

Sushil Kulkarni 19

[email protected]

Create table ConsistOfAudio (did CHAR (12) NOT NULL, // Id of the documentamid CHAR (12) NOT NULL, // Id of audio mediaPrimary key (did, amid), // Joint primary keyForeign Key (did),Foreign Key (amid));

did is the identifier of the document and amid is the identifier of the audio media type. Adocument can have more that one audio media and one audio media can be used bymore than one document. This conjoint primary key implements this relationship.Because the did and amid are also the primary keys of tables document andAudioMediaTable 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 andthe following additional attributes:

* Title: Title is the theme of audio and it abstract what the content of the audio isabout.

* Introduction: The introduction of the video gives more detail information to thevideo than Title. It is helpful for the search of the video information.

* Stream (BLOB): It’s 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 clipIntroduction VARCHAR(5000), // A brief description of videoStream 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. Theprimary key will ensure the id is unique and is indexed. For query efficiency purposesthe 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:

Page 20: Multimedia

Sushil Kulkarni 20

[email protected]

Create table ConsistOfVideo (did CHAR (12) NOT NULL, // Id of the documentvmid CHAR (12) NOT NULL, // Id of video mediaPrimary key (did, vmid), // Joint primary keyForeign Key (did),Foreign Key (vmid));vmid is the identifier of the video media type. A document can have more than onevideo media and one video media can be used by more than one document. Theconjoint primary key implements this relationship. Because the did and vmid are also theprimary keys of tables document and VideoMediaTable they are declared as foreignkeys.

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:

The query is written as follows:

SELECT imt.Image.pixelsFROM document d, ConsistsOfImage coi, ImageMediaTable imtWHERE d.title = “Elphinstone College” and d.did = coi.did and coi.imid = imt.imid;

Document ConsistOfImage ImageMediaTable

did did , imid imid , Image.pixelstitle= “Elphinstone College”

Page 21: Multimedia

Sushil Kulkarni 21

[email protected]

Query 2: I am looking for attractive audio and video clips to be used in mypresentation so that the students in my class will not sleep!

Audio and Video clips are found in audio/video media tables using following approach:

The query is written as follows:

SELECT amt.Audio.TrackFROM document d, ConsistsOfAudio coa, AudioMediaTable amtWHERE d.title = “computer” and d.did = coa.did and coa.amid = amt.amid;

You can listen to computer

SELECT amt.Video.streamFROM document d, ConsistsOfVideo cov, VideoMediaTable vmtWHERE 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 describeimage, 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 newtables with multimedia columns in them (see Figure). Any number of these columns canbe added to a table, and in the simplest form, this represents the integratedmanagement of relational and multimedia data.

Document ConsistOfAudio AudioMediaTable

did did , amid amid , Audio.Tracktitle= “computer”

Document ConsistOfVideo VideoMediaTabledid did , vmid vmid , Video.streamtitle= “Soccer”

Page 22: Multimedia

Sushil Kulkarni 22

[email protected]

interMedia also includes an object data type known as ORDDoc. This multimedia columntype can contain any mixture of ORDImage, ORDAudio, or ORDVideo objects, thusincreasing 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 tablestructure 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 thedirectory as shown above.

Next we initialize Item as follows

Declareimage ORDSYS.ORDImage;BeginInsert into Item values(

Page 23: Multimedia

Sushil Kulkarni 23

[email protected]

'it1',’pictures’,20,ORDSYS.ORDImage.init('file', 'image_dir','item.jpg'));Select photo into image from ItemWhere Id = 'it1' for Update;image.setProperties;Update Item set photo = imageWhere cam_id = 'Cam 1';End;

The coding above is to set the pointer of it1 to point to the image file of the initialisedimage directory. In this case, photo entity of it1 will store pointer value of image nameimage.jpg in the directory of C:\adbms\images. This method of storing image isknown as the BFILE technique.