Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and...

39
Query Processing

Transcript of Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and...

Page 1: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Query Processing

Page 2: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

2

Basic Concepts Query Processing – activities

involved in retrieving and manipulating data from the database: SQL query translation into low-level

language implementing relational algebra

Query execution

Page 3: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

3

Phases of Query Processing

Page 4: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

4

Relational Algebra

Relational algebra defines basic operations on relation instances

Results of operations are also relation instances

Page 5: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

5

Operations

Most of these operation can be summarized as being concerned with: Manipulation (editing and modifying) Presentation Analysis (indexing and searching)

Page 6: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Range of Operations

Operation

Text Audio Graphic Image Animation Video

Manipulation

• Character• String• Editing

•Sample•Waveform•Audio editing

•Primitive editing•Structural editing•Shading

•Geometric•Pixel operation•Filtering

•Primitive editing•Structural editing

•Frame manipulation•Pixel operation

Presentation

• Formatting• Encryption• Sorting

•Synchronization•compression•Conversion

•Mapping•compression•Lighting•Rendering•viewing

•Compositing•Compression•conversion

•Synchronization•Compression• rendering

•Synchronization•Compression•Video effects•Mixing•conversion

Analysis •Indexing•searching

•Indexing•searching

•Indexing•searching

•Indexing•searching

•Indexing•searching

•Indexing•searching

6

Page 7: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

7

Query Decomposition

Analysis Normalization Semantic analysis Simplification Query restructuring

Page 8: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

8

Relational Algebra Expressions

The result of a relational operation is a relation instance

Relational algebra expression combines relation instances using relational algebra operations

Relational algebra expression produce the result of a query

Page 9: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

9

Simple SQL Query

SELECT <select-list>FROM <table ist>WHERE <search condition>Group By <grouping column list>Having <search condition>

Page 10: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

10

Conceptual Evaluation Strategy for Simple Query Compute the cross-product of

tables in from-list Delete those rows which fail the

qualification condition Delete all columns that do not

appear in the select-list If DISTINCT clause is specified,

eliminate duplicate rows.

Page 11: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

11

Nested Queries Query block:

Single SELECT_FROM_WHERE expression

May include GROUP BY and HAVING Query block – basic unit that is

translated into RA expression and optimized

SQL query is decomposed into query blocks

Page 12: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Querying MMDBMS

Process of querying multimedia can approach in two ways: ‘What’ information can be retrieved ‘How’ information can be retrieved

12

Page 13: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

‘What’ Approach

Divided into 3 levels of complexity Level 1, Retrieval of Primitive

Features Such as color, shape, texture, spatial location and

object movement. Query Ex.: “Find clips of objects flying from top-right

to bottom-left of screen”

Level 2, Retrieval of Logical Process Related to the identity of object within the media Query Ex.: “Find a clips of an aero plane taking-off”

13

Page 14: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

‘What’ Approach (cont.) Level 3, Retrieval of Abstract

Attributes Associated with an understanding of the nature or

purpose of the object Query Ex.: “Find a picture of nutritional disasters”

Level 2 and 3 are regarded as Semantic Media Retrieval.

However, Success in answering multimedia query is largely limited to level 1. The difference between simple queries at level 1 and those at level 2 and 3 has been called the semantic gap.

14

Page 15: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

‘How’ Approach

This approach can be classified on the basis of whether is retrieved by: Attribute-based retrieval Text-based retrieval Content-based retrieval

15

Page 16: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

‘How’ Approach

Attribute-based retrieval (ABR) ABR is a method that uses a set of structured attributes in

the same way as traditional DBMS. It uses essentially the similar principles, except that these

must be able to cope with gigantic media object such as video clip.

This method can be particularly effective with text. However, the method does not make use of the rich content of image and retrieve information so that is essentially limited to level 1 queries.

16

Page 17: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

‘How’ Approach

Text-based retrieval (TBR) TBR methods work by adding annotations, usually brief

descriptions combined with some structured data. An example of system with this capability was the Kodak’s

picture exchange. Disadvantage of the system is that they are very difficult in

practice.

17

Page 18: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

‘How’ Approach

Content-based retrieval (CBR) CBR is developed to try to overcome some of the

difficulties of TBR. The idea is that the important details can be extracted

from the media by automatic method which will be more efficient for data

capture and reliable for retrieval.

18

Page 19: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Ontology Providing a shared understanding of the

application domain that can be communicated between people and computer and incorporated in the database as part of the metadata.

It means that key information about the kind of object in the database can be captured and reused many times for many different queries with any kind of media data.

19

Page 20: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Metadata Usage in Querying Considering role of metadata for media

separation Considering design to classify metadata

and relate this to three type of information retrieval Content Independent – used in ABR Content Descriptive – used in TBR Content Dependent – use in CBR

20

Page 21: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Role of Metadata in Querying

21

Query Metadata

Image Metadata

Media independent

metadata

Meta-Correlation

Text Metadata

Media dependent

Media preprocessor

Media dependent

Media preprocessor

Image Text

Conceptual data view

Ontologies

Physical Storage view

Example of role of metadata in Querying

Page 22: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Query Language

Page 23: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Structured Query Language Query languages are generalized

computer language that is used to interrogate database and information systems.

  Query languages can be classified

according to database query languages or information retrieval query languages. 

Marina G. Erechtchoukova 23

Page 24: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Structured Query Language (SQL) scope includes data insert, query, update and delete, schema creation and modification, and data access control.

SQL was developed at IBM by Donald D. Chamberlin and Raymond F. Boyce in the early 1970s. This version, initially called SEQUEL (Structured English Query Language), was designed to manipulate and retrieve data stored in IBM's original quasi-relational database management system.

Marina G. Erechtchoukova 24

Page 25: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

The most common operation in SQL is the query, which is performed with the declarative SELECT statement. SELECT retrieves data from one or more tables, or expressions.

Standard SELECT statements have no persistent effects on the database. Some non-standard implementations of SELECT can have persistent effects, such as the SELECT INTO syntax that exists in some databases.

Marina G. Erechtchoukova 25

Page 26: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Queries allow the user to describe desired data, leaving the database management system (DBMS) responsible for planning, optimizing, and performing the physical operations necessary to produce that result as it chooses.

Marina G. Erechtchoukova 26

Page 27: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

A query includes a list of columns to be included in the final result immediately following the SELECT keyword. An asterisk ("*") can also be used to specify that the query should return all columns of the queried tables. SELECT is the most complex statement in SQL, with optional keywords and clauses that include:

Marina G. Erechtchoukova 27

Page 28: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

The FROM clause which indicates the table(s) from which data is to be retrieved. The FROM clause can include optional JOIN subclauses to specify the rules for joining tables.

The WHERE clause includes a comparison predicate, which restricts the rows returned by the query. The WHERE clause eliminates all rows from the result set for which the comparison predicate does not evaluate to True.

Marina G. Erechtchoukova 28

Page 29: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

The GROUP BY clause is used to project rows having common values into a smaller set of rows. GROUP BY is often used in conjunction with SQL aggregation functions or to eliminate duplicate rows from a result set. The WHERE clause is applied before the GROUP BY clause.

Marina G. Erechtchoukova 29

Page 30: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

The HAVING clause includes a predicate used to filter rows resulting from the GROUP BY clause. Because it acts on the results of the GROUP BY clause, aggregation functions can be used in the HAVING clause predicate.

The ORDER BY clause identifies which columns are used to sort the resulting data, and in which direction they should be sorted (options are ascending or descending). Without an ORDER BY clause, the order of rows returned by an SQL query is undefined.

Marina G. Erechtchoukova 30

Page 31: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Query Language

Object Oriented Query Language

Page 32: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Evolution of Design Approach in Multimedia

Page 33: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Object Oriented Query Language

Figure 1 : Media class and Its subclass

Page 34: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Object Oriented Schema Declaration

Page 35: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Event & Content-Based Queries for Image / Video Data

Spatial

Temporal

Page 36: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Spatial Object

Page 37: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Temporal Object

Page 38: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Queries for Multimedia

Multimedia Document Retrieval

Playout Control

Page 39: Query Processing. 2 Basic Concepts Query Processing – activities involved in retrieving and manipulating data from the database: SQL query translation.

Thanks for Your Attention