Upload
tendy
View
223
Download
0
Embed Size (px)
Citation preview
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
1/42
Multi-media Content
Management and the Oracle 9iDatabase
interMedia and Partitioning
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
2/42
Jeremy Forman
The New Mexico Highway andTransportation department
Computer Systems Analyst
505.827.8275
mailto:[email protected]:[email protected]:[email protected]8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
3/42
The Problem: The Road FeaturesInventory
Multi-terabyte database (4TB)
Approximately 5,000,000 images
1,000,000 Assets
Web based Application
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
4/42
Oracle interMedia
Media and application metadatamanagement services
Storage and retrieval services
Support for popular formats
Access through traditional and Web
interfaces and a search capability usingassociated relational data or usingspecialized indexing
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
5/42
The capabilities ofinterMedia include the storage,
retrieval, management, and manipulation of multimediadata managed by Oracle9i. Oracle interMedia supports
multimedia storage, retrieval, and management of:
Binary large objects (BLOBs) stored locally in Oracle9i and containing
audio, image, or video data, or other heterogeneous media data
File-based large objects, or BFILEs, stored locally in operating system-
specific file systems and containing audio, image, or video data, or otherheterogeneous media data
URLs containing audio, image, or video data or other heterogeneous media
data, stored on any HTTP server such as Oracle Internet Application Server,
Netscape Application Server, Microsoft Internet Information Server, Apache
HTTPD server, and Spyglass servers
Streaming audio or video data stored on specialized media
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
6/42
interMedia Object Types
ORDAudio
ORDDoc
ORDImage
ORDVideo
ORDImageSignature
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
7/42
ORDImageCREATE OR REPLACE TYPE ORDImage AS OBJECT( ------------------- -- TYPE ATTRIBUTES -------------------
source ORDSource,
height INTEGER,
width INTEGER,
contentLength INTEGER,
fileFormat VARCHAR2(4000),
contentFormat VARCHAR2(4000),
compressionFormat VARCHAR2(4000),
mimeType VARCHAR2(4000),
-------------METHOD DECLARATION-----------------------CONSTRUCTORS
STATIC FUNCTION init( ) RETURN ORDImage,
STATIC FUNCTION init(srcType IN VARCHAR2,
srcLocation IN VARCHAR2, srcName IN VARCHAR2)
RETURN ORDImage,
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
8/42
ORDImage Attributes
Source Height
Width
ContentLength
FileFormat
ContentFormat CompressionFormat
MimeType
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
9/42
interMedia Common Object Type
Methods: Modifying the time an object was last updated
Manipulating the location of media data
Extracting attributes from multimedia data
Getting and managing multimedia data fromOracle interMedia, Web servers, and other servers
Performing a minimal set of manipulation
operations on multimedia data (ORDImage only) Performing file operations on the source and
metadata extraction in XML format (ORDAudio,
ORDDoc, and ORDVideo only)
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
10/42
ORDImage Methods
Init() ProcessCopy()
Set/GetUpdateTime() Set/GetMimeType()
GetCompressionFormat() ReadFromSource()
WriteToSource()
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
11/42
interMedia Image Loading
PL/SQL
SQLLDR
Java
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
12/42
SQLLDR Example
LOAD DATA
INFILE *
INTO TABLE SOUNDS
APPENDFIELDS TERMINATED BY ','
(Item_ID integer external,
sound column object
(
source column object(
localdata_fname FILLER CHAR(128),
localdata LOBFILE
(sound.source.localdata_fname),
))
)
BEGINDATA
55,the_grid.au,
33,engine.wav,44,spacemusic.au
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
13/42
SQL Examples
INSERT INTO stockphotos
VALUES ( 1, 'John Doe', 'red plaid',ORDSYS.ORDImage.init(),
ORDSYS.ORDImageSignature.init());
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
14/42
interMedia Loading Images
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
15/42
interMedia Copying an Image
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
16/42
Content Based Retrieval with
ORDImage
The primary benefit of using content-based retrieval is reduced time and
effort required to obtain image-basedinformation
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
17/42
Content Based Retrieval withORDImage
A content-based retrieval system
processes the information containedin image data and creates an
abstraction of its content in terms ofvisual attributes
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
18/42
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
19/42
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
20/42
ORDImageSignature
3000 4000 Bytes
Color: represents the distribution of colors withinthe entire image.
Texture: represents the low-level patterns and
textures within the image, such as graininess orsmoothness.
Shape: represents the shapes that appear in the
image, as determined by color-based segmentationtechniques.
Location: represents the positions of the shapes,
color, and texture components.
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
21/42
ORDImageSignature
Score: is the relative distance between two images
being compared. A smaller distance represents acloser match. (0.00-100.00)
Weight: reflects how sensitive the matching
process for a given attribute should be to thedegree of similarity or dissimilarity between twoimages. (0.1 1.0)
Threshold: If the weighted sum of the distancesfor the visual attributes is less than or equal to thethreshold, the images match.
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
22/42
DECLAREt_image ORDSYS.ORDImage;
image_sig ORDSYS.ORDImageSignature;
image_sig2 ORDSYS.ORDImageSignature;
BEGINSELECT photo, photo_sig
INTO t_image, image_sig
FROM stockphotos
WHERE photo_id = 1 FOR UPDATE;-- compute the distance between two signatures
ORDSYS.ORDImageSignature.isSimilar(image_sig,image_sig2,'color
=1.0,texture=0,shape=0,location=0',10);
UPDATE stockphotosSET photo = t_image
WHERE photo_id = 1;
END;
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
23/42
ORDImageIndex
CREATE INDEX
idx1 ONT(pattern_signature) INDEXTYPE IS
ORDSYS.ORDIMAGEINDEX
PARAMETERS('ORDImage_Filter_Tablespace =
,ORDImage_Index_Tablespace= ');
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
24/42
Partitioning
Partitioning allows tables, indexes,and index-organized tables to be
subdivided into smaller pieces,
enabling these database objects to be
managed and accessed at a finer level
of granularity.
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
25/42
Partitioning
List Partitions Range Partitions
Hash Partitions
Composite Range-Hash Partitioning
Composite Range-List Partitioning
Sub Partitions
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
26/42
List Partitioning Example
CREATE TABLE q1_sales_by_region
(deptno number, deptname varchar2(20),quarterly_sales number(10, 2), state varchar2(2))
PARTITION BY LIST (state)(PARTITION q1_northwest VALUES ('OR', 'WA'),PARTITION q1_southwest VALUES ('AZ', 'UT', 'NM'),
PARTITION q1_northeast VALUES ('NY', 'VM', 'NJ'),
PARTITION q1_southeast VALUES ('FL', 'GA'),PARTITION q1_northcentral VALUES ('SD', 'WI'),
PARTITION q1_southcentral VALUES ('OK', 'TX'));
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
27/42
Querying Directly from a
Partition
SELECT DEPTNO, DNAME
FROM Q1_SALES_BY_REGION
PARTITION(Q1_SOUTHWEST)
WHERE STATE = NM
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
28/42
Partitioning Performance
Partition Pruning: a query only accessesspecific partitions depending on the where clause
Partition-wise Joins:breaks a large join into
smaller joins that occur between each of thepartitions, completing the overall join in less time
Parallel Execution Of Updates and Deletes:
Partitioning enables the unlimited parallelexecution of UPDATE, DELETE, and MERGEstatements
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
29/42
CREATE TABLESPACE DATAFILE BLOCKSIZE 16384
EXTENT MANAGEMENT LOCALSEGMENT SPACE MANAGEMENT
MANUAL
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
30/42
Partitioning an interMedia TableCREATE TABLE RFI_VIRTUAL_DRIVE_IMAGES (
ID NUMBER (9) NOT NULL,
RROUTES_ID NUMBER (5),FILENAME VARCHAR2 (100) NOT NULL,
SMPOINT NUMBER (11,3) NOT NULL,
DIRECTION NUMBER (1),
IMAGE ORDIMAGE,THUMBNAIL ORDIMAGE,
SIGNATURE ORDIMAGE,
ROUTE_PREFIX VARCHAR2 (2),
ROUTE_ID NUMBER (6),
CREATEDBY VARCHAR2 (30),
CREATEDDATE DATE,
MODBY VARCHAR2 (30),MODDATE DATE)
P titi i i t M di T bl
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
31/42
Partitioning an interMedia Table
PARTITION BY RANGE(ID)SUBPARTITION BY HASH(ROUTE_ID)
SUBPARTITIONS 12
(PARTITION IMAGES_PART1 VALUES LESS THAN(500000)TABLESPACE RFI_PART1_DIST1_TBS
LOB (IMAGE.SOURCE.LOCALDATA) STORE
AS(TABLESPACE RFI_IMAGES_PART1_TBS NOCACHECHUNK 16346),
LOB (THUMBNAIL.SOURCE.LOCALDATA) STORE
AS(TABLESPACE RFI_THUMBNAILS_PART1_TBSNOCACHE CHUNK 8132)
LOB (SIGNATURE.SOURCE.LOCALDATA) STORE AS
(TABLESPACE RFI_SIGNATURES_PART1_TBS NOCACHECHUNK 8132)
P i i i i M di T bl
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
32/42
Partitioning an interMedia Table
PARTITION IMAGES_PART2 VALUES LESS THAN
(MAXVALUE) TABLESPACE RFI_PART2_DIST2_TBS
LOB (IMAGE.SOURCE.LOCALDATA) STOREAS(TABLESPACE RFI_IMAGES_PART2_TBS NOCACHE
CHUNK 16346)
LOB (THUMBNAIL.SOURCE.LOCALDATA) STOREAS(TABLESPACE RFI_THUMBNAILS_PART2_TBS
NOCACHE CHUNK 8132)
LOB (THUMBNAIL.SOURCE.LOCALDATA) STOREAS(TABLESPACE RFI_THUMBNAILS_PART2_TBS
NOCACHE CHUNK 8132)
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
33/42
Oracle HTTP Server and
MOD_PLSQL
Mod_plsql provides support for building
PL/SQL-based applications on the Web.
PL/SQL stored procedures retrieve data from
a database and generate HTTP responses
containing data and code to display in a Webbrowser. Mod_plsql also supports other
Oracle products such as Oracle Portal.
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
34/42
Processing Client Requests
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
35/42
Processing Client Requests
1.The Oracle HTTP Server receives a PL/SQL Server Page request from a
client browser.
2.The Oracle HTTP Server routes the request to mod_plsql.
3.The request is forwarded by mod_plsql to the Oracle Database. By using the
configuration information stored in your DAD, mod_plsql connects to the
database.
4.Mod_plsql prepares the call parameters, and invokes the PL/SQL procedure
in the application.
5.The PL/SQL procedure generates an HTML page using data and the
PL/SQL Web Toolkit accessed from the database.
6.The response is returned to mod_plsql.
7.The Oracle HTTP Server sends the response to the client browser.
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
36/42
Database Access Descriptors
the database alias (Net8 service name).
a connect string if the database is remote.
a procedure for uploading and downloading
documents.
Document Table Definition
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
37/42
Document Table Definition
An example of legal document table definition is:
CREATE TABLE DOC_TABLE_UPLOAD(
NAME VARCHAR(128) UNIQUE NOT NULL,MIME_TYPE VARCHAR(128),
DOC_SIZE NUMBER,
DAD_CHARSET VARCHAR(128),
LAST_UPDATED DATE,
CONTENT_TYPE VARCHAR(128),
BLOB_CONTENT BLOB );
--If content column is a BLOB the column name must be
BLOB_CONTENT
--If content column is a LONG RAW, the column name must be
CONTENT
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
38/42
Invoking mod_plsql
To invoke mod_plsql in a Web browser, input
the URL in the following format:
protocol://hostname[:port]/DAD_location/[
schema.][package.]proc_name[?query_strin
g]]http://hoas9ias:7780/pls/rfi_admin_dad/rfi_ad
min.photo_upload
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
39/42
Mod_PLSQL Supports:
Get, Post, Head Methods
Parameter Passing
File Upload and Download Path Aliasing
CGI Variables (uses the OWA_UTILpackage which provides an API to get thevalues of CGI environment variables)
S l C d i MOD PLSQL
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
40/42
Sample Code using MOD_PLSQL
8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
41/42
interMedia Code Wizard
8i: download the Code Wizard for the PL/SQL
Gateway:http://otn.oracle.com/software/products/
intermedia/content.html
9i: /ord/http/demo/plsgwycw
Execute ordplsui.sql as ORDSYS
Create Code Wizard administration DAD
Grant Access to other DAD
http://otn.oracle.com/software/products/intermedia/content.htmlhttp://otn.oracle.com/software/products/intermedia/content.htmlhttp://otn.oracle.com/software/products/intermedia/content.htmlhttp://otn.oracle.com/software/products/intermedia/content.htmlhttp://otn.oracle.com/software/products/intermedia/content.html8/9/2019 Multi Media Content Management and the Oracle Database Inter Media And
42/42
Resources http://download-
west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htm
#1004903
http://otn.oracle.com/docs/products/intermedia/content.html
http://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htmhttp://download-west.oracle.com/docs/cd/A97329_01/web.902/a90855/feature.htm