Unit 6 DBMS
Unit 6 DBMS
7 Advances in Databases
Syllabus
Emerging Databases : Active and Deductive Databases, Main Memory Databases, Semantic
Databases.
Complex Data Types : Semi-Structured Data, Features of Semi-Structured Data Models. Nested
Data Types : JSON, XML. Object Orientation : Object-Relational Database System, Table
Inheritance, Object-Relational Mapping. Spatial Data : Geographic Data, Geometric Data.
Contents
7.1 Emerging Databases
7.2 Complex Data Types
7.3 Nested Data Types
(7 - 1)
Database Management Systems 7-2 Advances in Databases
Active Databases
Active databases are the databases which consists of triggers. The situation and
action rules are embedded in the active databases. The active databases are able to
react automatically to the situations in the database. The trigger is a technique for
specifying certain types of active rules. The commercial databases such as Oracle,
DB2, Microsoft SQLServer allows the use of triggers.
);
ENABLE
Code for actual trigger
DECLARE
usr_name VARCHAR2(20);
BEGIN
END;
/
SQL query on execution of which the
trigger gets fired.
INSERT INTO PersonTab VALUES('Sharda');
Deductive Database
Deductive database is a database system that can make deductions based on rules
and facts stored in the database.
Deductive databases use the concept of logic programming for specifying the rules
and the facts. Prolog is a popular programming language which is based on the
concept of logic programming.
There are two types of specifications used in deductive databases –
1) Facts : Facts are specified as the same way the relations are specified in the
Relational Database except it is not necessary to include the attribute [Link]
meaning of an attribute value in a tuple is determined solely by its position in the
tuple.
2) Rules : They specify “virtual relations” that are not actually stored but that can be
formed from the facts by applying deduction mechanisms based on the rule
specifications.
For example –
/*Facts*/
man(anand)
man(arun)
woman(anuradha)
woman(jayashree)
parent(anand, parth)
parent(anuradha,parth)
parent(arun,anuradha)
parent(jayashree,anuradha)
/* General Rule */
father(F,C):-man(F),parent(F,C)
mother(M,C):-woman(M),parent(M,C)
Semantic databases represent the data models in which data is arranged in some
logical manner.
It is a conceptual database system that include semantic information that adds basic
meaning of the data and relationships among the data.
The semantic database systems allow easy development of application programs
and also it becomes easy to maintain such database system when data is updated.
Features
1. Semantic database systems are exceptionally usable and flexible.
2. They have shorter application design and programming cycle.
3. It provides user control via an intuitive structure of information.
4. It empowers the end-users to pose complex, ad-hoc, decision support queries.
5. These are highly efficient database systems.
Review Questions
3. XML documents
4. Zipped files
5. Binary executables
Advantages
1. The semi-structured data is flexible as schema can be changed accordingly.
2. Data is portable.
3. The heterogeneous information can be stored in semi-structured data.
4. There is no need to express the requirements in pure SQL only.
Disadvantages
1. As there is no fixed schema, storing the data is complex.
2. Querying the database is less efficient as the data is in semi-structured manner.
3. Interpretation of relationship among data is difficult.
2. It is schema dependent and It is more flexible than It is the most flexible data.
less flexible. structured data but less
flexible than
unstructured data.
3. Structured query languages The tags and elements are Only textual queries are
are used to access the data used to access the data. possible.
present in the schema
4. Storage requirement for data Storage requirements for Storage requirements for the
is less. the data is significant. data is huge.
Review Question
7.3.1 JSON
JSON stands for JavaScript object notation.
Using JSON we can store and retrieve data. This text based open standard format.
It is extended from JavaScript language.
Features of JSON
1. It is text based, lightweight data interchange format.
2. It is language independent.
3. It is easy to read and write.
4. It is easy for machines to parse and generate.
5. It uses the conventions that are familiar to the languages like C, C++, Java,
JavaScript, Perl, Python and so on.
Structure of JSON
JSON is built on two structures :
1. A collection of name/value pairs. In various languages, this is realized as an object,
record, struct, dictionary, hash table, keyed list, or associative array.
2. An ordered list of values. In most languages, this is realized as an array, vector, list,
or sequence.
JSON Object
JSON object holds the Key value pair.
Each key is represented as string and value can be of any datatype.
The key and value are separated by colon.
Syntax
{ string : value, .......}
For example
“Age”:38
Each key value pair is separated by comma.
The object is written within the { }curly brackets.
7.3.2 XML
XML stands for eXtensible Markup Language.
This scripting language is similar to HTML. That means, this scripting language
contains various tags. But these tags are not predefined tags, in-fact user can define
his own tags.
Thus HTML is designed for representation of data on the web page whereas the
XML is designed for transport or to store data.
Uses of XML
1. XML is used to display the meta contents i.e. XML describes the content of the
document.
2. XML is useful in exchanging data between the applications.
3. The data can be extracted from database and can be used in more than one
application. Different applications can perform different tasks on this data.
Advantages of XML
1. XML document is human readable and we can edit any XML document in simple
text editors.
2. The XML document is language neutral. That means a Java program can generate
an XML document and this document can be parsed by Perl.
3. Every XML document has a tree structure. Hence complex data can be arranged
systematically and can be understood in simple manner.
4. XML files are independent of an operating system.
Goals of XML
Following are the goals of XML -
1. User must be able to define and use his own tag. This allows us to restrict the use of
the set of tags defined by proprietary vendors.
2. Allow user to build his own tag library based on his web requirement.
3. Allow user to define the formatting rules for the user defined tags.
4. XML must support for storage or transport of data.
Features of XML
Following are some features which are most suitable for creating web related
applications.
XML is EXtesible Markup Language intended for transport or storage of the data.
The most important feature of XML is that user is able to define and use his own
tag.
XML contains only data and does not contain any formatting information. Hence
document developers can decide how to display the data.
XML permits the document writer to create the tags for any type of information.
Due to this virtually any kind of information can be such as mathematical formulae,
chemical structures, or some other kind of data can be described using XML.
Searching sorting, rendering or manipulating the XML document is possible using
Extended Stylesheet Language (XSL).
The XML document can be validated using some external tools.
Some commonly used web browsers like Internet Explorer and Firefox Mozilla
provide support to the tags in XML. Hence XML is not at all vendor specific or
browser specific.
1. HTML stands for Hypertext Markup XML stands for eXtensible Markup
Language. Language.
2. HTML is designed to display data with the XML is used to transport and store data, with
focus on look and feel of data. focus on what data is.
3. HTML is case insensitive. XML is case sensitive.
4. HTML has predefined tags. XML has custom tags can be defined and the
tags are invented by the author of the XML
document.
5. As HTML is for displaying the data it is As XML is for carrying the data it is dynamic.
static.
6. It can not preserve white space. It can preserve the white space.
1. Elements
The basic entity is element. The elements are used for defining the tags. The elements
typically consist of opening and closing tag. Mostly only one element is used to define a
single tag.
2. Attribute
The attributes are generally used to specify the values of the element. These are
specified within the double quotes.
For example -
<flag type=”True”>
The type attribute of the element flag is having the value True.
3. CDATA
CDATA stands for Character Data. This character data will be parsed by the parser.
4. PCDATA
It stands for Parsed Character Data (i.e. text).
The above document does not produce any error although the element text is used for
two different attribute values. The output will be,
Using DTD we can specify the various elements types, attributes and their
relationship with one another.
Basically DTD is used to specify the set of rules for structuring data in any XML file.
For example : If we want to put some information about some students in XML file
then, generally we use tag student followed by his/her name, address, standard
and marks. That means we are actually specifying the manner by which the
information should be arranged in the XML file. And for this purpose the
Document Type Definition is used.
Internal DTD
Consider following xml document –
External DTD
In this type, an external DTD file is created and its name must be specified in the
corresponding XML file. Following XML document illustrates the use of external DTD.
Merits of DTD
1. DTDs are used to define the structural components of XML document.
2. These are relatively simple and compact.
3. DTDs can be defined inline and hence can be embedded directly in the XML
document.
Demerits of DTD
1. The DTDs are very basic and hence cannot be much specific for complex
documents.
2. The language that DTD uses is not an XML document. Hence various frameworks
used by XML cannot be supported by the DTDs.
3. The DTD cannot define the type of data contained within the XML document.
Hence using DTD we cannot specify whether the element is numeric, or string or of
date type.
4. There are some XML processor which do not understand DTDs.
5. The DTDs are not aware of namespace concept.
Review Questions
OODBMS DBMS
OODBMS stands for Object Oriented Database DBMS is any Database Management System.
Management System that supports creating The most popular DBMS are relational database
and modelling of data as objects. management systems in which we store
everything as a relation between entities.
Handles larger and complex data than RDBMS. Handles comparatively simpler data.
Data Handling - Stores data as well as methods Data Handling - RDBMS stores only data.
to use it.
Advantages
1. It supports object oriented features such as inheritance, polymorphism, association
and so on.
2. Instead of plain data, the object relational mapping return objects. These objects can
be easily accessed, programmed and permanently stored in memory.
3. Object relational mapping systems also provide query languages that allow
programmer to write queries directly on the object model. Such queries are
translated into SQL queries for underlying relational database.
Disadvantages
1. The query language for object relational mapping systems have limited capabilities.
2. There is significant overhead on the object relation system when there occurs bulk
database update.
Review Questions
Closed polygons :
i) It is represented as list of vertices in order starting vertex is the same as ending
vertex.
ii) Represent boundary edges as separate tuples with identifier.
iii) Use triangulation – Divide polygon into triangles. Use identifier for each triangles.
The 3D shapes are represented in the similar manner as of 2D shapes. But it has
extra z component.
7.5.2 Geographic Data
Geographic data are spatial in nature. For example – maps and satellite images are
geometric data.
Maps not only provides the location but along with location it also provides
detailed information about the location.
Applications of geographic data
1) Web based road map services which allows us to use map data for vehicle
navigation.
2) Vehicle navigation systems store information about roads and services for use of
drivers.
3) Global Positioning System (GPS) information broadcasts from GPS satellites to find
the current location of user with some accuracy.
Representation of geographic data
There are two types of geographic data
1. Raster data : Raster data consists of bit maps or pixel maps in two or more
dimensions. For example – 2D raster image : Satellite image of cloud cover, where
each pixel stores the cloud visibility in a particular area.
2. Vector data : The vector data is constructed from basic geometric objects such as
points, line segments, polygon, triangles and so on. The vector data is always used
to represent the map data. For instance – roads can be considered as two
dimensional(2D) and represented by lines and curves. Rivers may be represented as
complex curves. The regions and lakes can be represented using polygons.
Review Question