Download Xml and Relational Databases

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Data analysis wikipedia , lookup

Semantic Web wikipedia , lookup

Information privacy law wikipedia , lookup

Data model wikipedia , lookup

Operational transformation wikipedia , lookup

Business intelligence wikipedia , lookup

National Information Exchange Model wikipedia , lookup

Open data in the United Kingdom wikipedia , lookup

Data vault modeling wikipedia , lookup

Database wikipedia , lookup

Versant Object Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

XML wikipedia , lookup

Transcript
XML Databases
Presented By:
Pardeep MT15042
Anurag Goel MT15006
Outline
 Introduction to XML
 XML Documents
 XML Databases
 XML Model v/s Relational Model
 Mapping between XML Model and Relational Model
What is XML?
 XML (eXtensible Markup Language) is a meta-language used to
represent and manipulate data elements and enables designers to
create customized tags.
 Similar to HTML in structure, but XML is concerned with the
description and representation of data, rather than with the way it is
displayed.
 XML has tree-structured (hierarchical) data model.
 XML has emerged as the standard for structuring and exchanging
data over the web.
XML Document: Elements and Attributes
Raw Data (Course information) :
CIS 3730 Designing and Managing Data
CRN: 10059
Instructor: Dr. Jack Zheng
XML Format :
Element (Complex)
Attribute
<?xml version="1.0" encoding="UTF-8" ?>
Element (Simple)
<Course CRN="10059">
<Prefix>CIS 3730</Prefix>
<Title>Designing and Managing Data</Title>
<Instructor><Title>Dr.</Title> Jack Zheng</Instructor>
</Course>
XML Document: Well Formed and Valid
 An XML document is well formed if it is syntactically correct.
 An XML document is valid if it is well formed and follow the structure
specified in a separate XML DTD file or XML schema file.
Why XML for databases?
 One of the main reasons that XML was developed was to allow the
exchange of semi-structured documents like invoices, order forms,
applications etc. over the internet.
 Using a database system to store XML documents allows users to be
able to better access information.
 XML is very flexible
 Data is maintained in a self-describing format to accommodate a
variety of ever-evolving business needs.
What is an XML Database?
 Simply a database that stores XML Documents
 There are two major types of XML databases:
XML-enabled: These map all XML to a traditional database (such as a
relational database), accepting XML as input and rendering XML as
output.
Native XML (NXD): The internal model of such databases depends
on XML and uses XML documents as the fundamental unit of storage.
XML Model
V/S
 XML data is hierarchical (nesting
of elements is allowed).
 XML data is self-describing.
Relational Model
 Relational data is represented in a
model of logical relationships.
 Relational data is not self-
describing.
 XML data has inherent ordering.
 In XML, schema is optional.
 Relational data does not have
inherent ordering.
 In relational database, schema is
an inherent part of database.
 Mixture of text with Sub elements
is legal in XML.
 It is not allowed in relational
databases.
Going from Relational Model to XML Model

The table becomes the root element (a complex type): may use the table name as
the root element name.

Each row (record) becomes direct child elements (complex types) under the root
element.

Each value in the row becomes (two choices)
an attribute of the row element (the column name becomes the attribute name,
and the data becomes the attribute value), or
an third level child element (simple type) under the row element: the column
name becomes the element name and the data becomes the text node under the
element.
Example
<?xml version="1.0" encoding="utf-8" ?>
<Shippers>
<Shipper>
<ShipperID>1</ShipperID>
<CompanyName>Speedy Express</CompanyName>
<Phone>(503) 555-9831</Phone>
</Shipper>
<Shipper>
<ShipperID>2</ShipperID>
<CompanyName>United Package</CompanyName>
<Phone>(503) 555-3199</Phone>
</Shipper>
<Shipper>
<ShipperID>3</ShipperID>
<CompanyName>Federal Shipping</CompanyName>
<Phone>(503) 555-9931</Phone>
</Shipper>
</Shippers>
Shippers Table
<?xml version="1.0" encoding="utf-8"?>
<Shippers>
<Shipper ShipperID="1" CompanyName="Speedy
Express" Phone="(503)555-9831" />
<Shipper ShipperID="2" CompanyName="United
Package" Phone="(503)555-3199" />
<Shipper ShipperID="3" CompanyName="Federal
Shipping" Phone="(503)555-9931" />
</Shippers>
Going from XML Model to Relational Model
 XML documents can be decomposed into a relational table.
 Those decomposed
XML documents can be made into
relational tables and published to an XML document( they
might differ from the original)
 During the decomposing process, the XML document loses
most of it structure in order to map into the relational table;
not all the tags are stored in the relational tables.
Example
<ORDER ORDER_ID=’83492’ CUST_ID=’93457’>
<ITEM>
<PROD_ID>94872</PROD_ID>
<PROD_NAME>PEN</PROD_NAME>
<PRICE>19.95</PRICE>
<QUANTITY>30</QUANTITY>
</ITEM>
<ITEM>
<PROD_ID>94866</PROD_ID>
<PROD_NAME>BINDER</PROD_NAME>
<PRICE>7.95</PRICE>
<QUANTITY>26</QUANTITY>
</ITEM>
<ITEM>
<PROD_ID>92219</PROD_ID>
<PROD_NAME>LABELS</PROD_NAME>
<PRICE>12.95</PRICE>
<QUANTITY>250</QUANTITY>
</ITEM>
</ORDER>
Order
Item
Conclusion

XML documents are best suited for modelling semi-structured data
(data does not conform to a fixed schema).

XML documents can optionally have a DTD or XML schema, which
defines the valid syntax of an XML document.

XML is very flexible and XML tags are self-describing tags that’s why,
XML is extensively used as a data format standard for exchanging the
data over the web.
Thank You