cs1001 lecture 26. overview artificial intelligence artificial intelligence database systems...

25
CS1001 CS1001 Lecture 26 Lecture 26

Post on 19-Dec-2015

228 views

Category:

Documents


1 download

TRANSCRIPT

CS1001CS1001

Lecture 26Lecture 26

OverviewOverview

Artificial IntelligenceArtificial Intelligence Database SystemsDatabase Systems

ReadingReading

Brookshear, 9Brookshear, 9

DatabasesDatabases

Databases hold knowledgeDatabases hold knowledge One fundamental limitations of all One fundamental limitations of all

computation is having knowledge computation is having knowledge represented in an available and represented in an available and structured waystructured way

(needed for AI) (needed for AI) http://http://www.abenteuermedien.de/jabberwockwww.abenteuermedien.de/jabberwock//

File-Oriented SystemFile-Oriented System

Database-Oriented Database-Oriented SystemSystem

DefinitionDefinition

A database is a collection of related dataA database is a collection of related data example:example:

– 1. collection of names, home address and telephone numbers1. collection of names, home address and telephone numbers– 2. collection of words to make paragraph in a page2. collection of words to make paragraph in a page

A database represents some aspect of the real world, sometimes A database represents some aspect of the real world, sometimes

called the miniworld or the Universe of Discoursecalled the miniworld or the Universe of Discourse (UoD). (UoD). A database is a logically coherent collection of data A database is a logically coherent collection of data

with some inherent meaning. A random assortment of with some inherent meaning. A random assortment of data cannot correctly be referred to as a database. data cannot correctly be referred to as a database.

Definition ….Definition ….

A database is designed, built, and populated A database is designed, built, and populated with data for a specific purpose. It has an with data for a specific purpose. It has an intended group of users and some preconceived intended group of users and some preconceived applications in which these users are interested.applications in which these users are interested.

A database can be of any size and of varying A database can be of any size and of varying complexitycomplexity

A database may be generated and maintained A database may be generated and maintained manually or it may be computerized (set of manually or it may be computerized (set of application programs or by RDBM).application programs or by RDBM).

Database Management Database Management SystemSystem Is a collection of programs that enables Is a collection of programs that enables

users to create and maintain a database. users to create and maintain a database. The DBMS is a general-purpose software The DBMS is a general-purpose software

system that facilitates the processes of system that facilitates the processes of defining, constructing, and manipulating defining, constructing, and manipulating databases for various applicationsdatabases for various applications

Defining:Defining: a database involves specifying a database involves specifying the data types, structures, and constraints the data types, structures, and constraints for the data to be stored in the database.for the data to be stored in the database.

DBMS …..DBMS …..

Constructing:Constructing: the database is the process of the database is the process of storing the data itself on some storage medium storing the data itself on some storage medium that is controlled by the DBMS. that is controlled by the DBMS.

Manipulating:Manipulating: a database includes such functions a database includes such functions as querying the database to retrieve specific data, as querying the database to retrieve specific data, updating the database to reflect changes in the updating the database to reflect changes in the miniworld, and generating reports from the data. miniworld, and generating reports from the data.

We will call the database and DBMS software We will call the database and DBMS software together a database systemtogether a database system

Example Example

UNIVERSITY database for maintaining information UNIVERSITY database for maintaining information concerning students, courses, and grades in a concerning students, courses, and grades in a university environmentuniversity environment

define: file (records), data elements, data type ( for define: file (records), data elements, data type ( for each data element)each data element)

construct: store data in the appropriate files (note construct: store data in the appropriate files (note that records may be related between files)that records may be related between files)

Manipulation: querying, updatingManipulation: querying, updating– informal queries and updates must be specified precisely informal queries and updates must be specified precisely

in the database system language before they can be in the database system language before they can be processed.processed.

DB Vs Programming DB Vs Programming with fileswith files Self-Describing Nature of a Database SystemSelf-Describing Nature of a Database System

– single repository of data is maintained single repository of data is maintained – contains not only the database itself but also a contains not only the database itself but also a

complete definition or description of the database complete definition or description of the database structure and constraints (system catalogue).structure and constraints (system catalogue).

– information stored in the catalog is called meta-information stored in the catalog is called meta-datadata

– catalog used by the DBMS and users.catalog used by the DBMS and users.– The DBMS software work equally well with any The DBMS software work equally well with any

number of database applications.number of database applications.

DB Vs Programming DB Vs Programming with files …..with files …..

Insulation between Programs and Data, and Data Insulation between Programs and Data, and Data AbstractionAbstraction– program-data independenceprogram-data independence– The characteristic that allows program-data independence and The characteristic that allows program-data independence and

program-operation independence is called data abstractionprogram-operation independence is called data abstraction– A DBMS provides users with a conceptual representation of A DBMS provides users with a conceptual representation of

data that does not include many of the details of how the data data that does not include many of the details of how the data is stored or how the operations are implemented. (data model )is stored or how the operations are implemented. (data model )

– data model hides storage and implementation details that are data model hides storage and implementation details that are not of interest to most database users. not of interest to most database users.

– in object-oriented and object-relational databases, abstraction in object-oriented and object-relational databases, abstraction is carried one level further to include not only the data is carried one level further to include not only the data structure but also the operations on the datastructure but also the operations on the data

Database ActorsDatabase Actors

Database AdministratorsDatabase Administrators– In a database environment, the primary resource is In a database environment, the primary resource is

the database itself and the secondary resource is the the database itself and the secondary resource is the DBMS and related softwareDBMS and related software

– authorizing access to the databaseauthorizing access to the database– coordinating and monitoring its usecoordinating and monitoring its use– acquiring software and hardware resources as neededacquiring software and hardware resources as needed

Database DesignersDatabase Designers– identifying the data to be stored in the databaseidentifying the data to be stored in the database– choosing appropriate structures to represent and store choosing appropriate structures to represent and store

this data undertaken before the database is actually this data undertaken before the database is actually implemented and populated with dataimplemented and populated with data

Database Actors …..Database Actors …..

– communicate with all prospective database users, in order communicate with all prospective database users, in order to understand their requirementsto understand their requirements

– develop a view of the database that meets the data and develop a view of the database that meets the data and processing requirements for each group of usersprocessing requirements for each group of users

– These views are then analyzed and integrated with the These views are then analyzed and integrated with the views of other user groups. The final database design must views of other user groups. The final database design must be capable of supporting the requirements of all user groupsbe capable of supporting the requirements of all user groups

End UsersEnd Users– access to the database for querying, updating, and access to the database for querying, updating, and

generating reportsgenerating reports– Casual end users: Casual end users: – occasionally access the databaseoccasionally access the database– need different information each time need different information each time – learn only a few facilities that they may use repeatedly.learn only a few facilities that they may use repeatedly.

Database Actors …..Database Actors …..

– use a sophisticated database query language to specify their requests use a sophisticated database query language to specify their requests

– typically middle- or high-level managers or other occasional browserstypically middle- or high-level managers or other occasional browsers

Naive or parametric end users Naive or parametric end users – constantly querying and updating the database, using standard types of constantly querying and updating the database, using standard types of

queries and updates called canned transactions that have been queries and updates called canned transactions that have been carefully programmed and testedcarefully programmed and tested

– need to learn very little about the facilities provided by the DBMSneed to learn very little about the facilities provided by the DBMS

– Bank tellers check account balances and post withdrawals and depositsBank tellers check account balances and post withdrawals and deposits

– Reservation clerks for airlines, hotels, and car rental companies check Reservation clerks for airlines, hotels, and car rental companies check availability for a given request and make reservationsavailability for a given request and make reservations

– Clerks at receiving stations for courier mail enter package identifications Clerks at receiving stations for courier mail enter package identifications via bar codes and descriptive information through buttons to update a via bar codes and descriptive information through buttons to update a central database of received and in-transit packagescentral database of received and in-transit packages

Database Actors …..Database Actors …..

Sophisticated end usersSophisticated end users– Engineers, scientists, business analysts, and others who thoroughly Engineers, scientists, business analysts, and others who thoroughly

familiarize themselves with the facilities of the DBMS so as to familiarize themselves with the facilities of the DBMS so as to implement their applications to meet their complex requirementsimplement their applications to meet their complex requirements

– Try to learn most of the DBMS facilities in order to achieve their Try to learn most of the DBMS facilities in order to achieve their complex requirementscomplex requirements

Stand-alone users Stand-alone users – Maintain personal databases by using ready-made program Maintain personal databases by using ready-made program

packages that provide easy-to-use menu- or graphics-based packages that provide easy-to-use menu- or graphics-based interfaces. An example is the user of a tax package that stores a interfaces. An example is the user of a tax package that stores a variety of personal financial data for tax purposesvariety of personal financial data for tax purposes

– Typically become very proficient in using a specific software packageTypically become very proficient in using a specific software package

Database Actors …..Database Actors …..

System Analysts and Application Programmers System Analysts and Application Programmers – Determine the requirements of end users, especially naive and Determine the requirements of end users, especially naive and

parametric end users, and develop specifications for canned parametric end users, and develop specifications for canned transactions that meet these requirementstransactions that meet these requirements

– Application programmers implement these specifications as Application programmers implement these specifications as programs; then they test, debug, document, and maintain programs; then they test, debug, document, and maintain these canned transactionsthese canned transactions

Workers behind the SceneWorkers behind the Scene– Typically do not use the database for their own purposesTypically do not use the database for their own purposes– DBMS system designers and implementersDBMS system designers and implementers– design and implement the DBMS modules (for implementing design and implement the DBMS modules (for implementing

the catalog, query language, interface processors, data access, the catalog, query language, interface processors, data access, concurrency control, recovery, and security. ) and interfaces as concurrency control, recovery, and security. ) and interfaces as a software packagea software package

Database Actors …..Database Actors …..

Tool developersTool developers– Tools are optional packages that are often purchased Tools are optional packages that are often purchased

separatelyseparately– include packages for database design, performance include packages for database design, performance

monitoring, natural language or graphical interfaces, monitoring, natural language or graphical interfaces, prototyping, simulation, and test data generation. prototyping, simulation, and test data generation.

Operators and maintenance personnel Operators and maintenance personnel – system administration personnel who are responsible system administration personnel who are responsible

for the actual running and maintenance of the for the actual running and maintenance of the hardware and software environment for the database hardware and software environment for the database systemsystem

The conceptual layers The conceptual layers of a databaseof a database

Asking QuestionsAsking Questions

The Database is an oracle – you The Database is an oracle – you need to be able to pose it need to be able to pose it questions and receive answersquestions and receive answers

For relational databases, the For relational databases, the language of choice is SQL language of choice is SQL (Structured Query Language)(Structured Query Language)

QuestionsQuestions

The goal is to allow unambiguous The goal is to allow unambiguous questions to be formulated and questions to be formulated and for the system to encode for the system to encode information in such a way as to information in such a way as to provide unambiguous answersprovide unambiguous answers

You must You must modelmodel your problem to your problem to properly represent its informationproperly represent its information

Example: Employee RecordsExample: Employee Records

Example DataExample Data

Key Point is how to structure this as to reduce redundancyEliminating Redundancy (replacing it with relations) allows for unambiguous question answering

Note that this is a table (fundamental structure of a database)

SolutionSolution

The solution is to decompose a single The solution is to decompose a single database database tabletable into multiple tables and set into multiple tables and set up relationships between the tablesup relationships between the tables

FilesFiles

Note that each table is similar in Note that each table is similar in structure to a structure to a flat fileflat file

The added value of a database The added value of a database makes it easy to search among makes it easy to search among relationships between such flat relationships between such flat filesfiles