database and xml moussa mané. learning objectives ● learn about native xml databases ● learn...

23
DATABASE and XML Moussa Mané

Upload: antonia-townsend

Post on 27-Dec-2015

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

DATABASE and XML

Moussa Mané

Page 2: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Learning Objectives

● Learn about Native XML Databases

● Learn about the conversion technology available

● Understand New functionality of the Middleware: MySql 5.1

● Use MySql 5.1 to retrieve and update information in XML document

Page 3: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Models

XML documents fall into two broad categories:

data-centric and document-centric

● Data-centric documents (for data transport) have fairly regular structure, order typically does not matter, and little or no mixed content.

● Document-centric documents (usually for human consumption) have less regular or irregular structure, significant order of the elements, and lots of mixed content.

Page 4: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Native XML Databases

"Defines a (logical) model for an XML document and stores and retrieves documents according to that model." (Bourret, 2002)

Product Developer License DB Type Tamino Software AG Commercial Proprietary.

Relational through ODBC.

eXist Wolfgang Meier Open Source Relational

dbXML dbXML Group Open Source Proprietary

Xindice Apache Software Foundation

Open Source Proprietary (Model-based)

Page 5: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

eXist

● eXist is an Open Source effort to develop a native XML database system, tightly integrated with existing XML development tools like Apache's Cocoon.

● The database may be easily deployed, running either standalone, inside a servlet engine, or directly embedded in an application.

Page 6: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

eXist - Features

● Schema-less storage - Documents do not have to be associated to schema or document type, meaning they are allowed to be well formed only.

● Collections - A collection plays a similar role to a directory in a file system. When submitting a query the user can choose a distinct part of the collection hierarchy or even all the documents contained in the database.

● Query languages - The most popular query languages supported by Native XML databases are XPath and XQuery.

Page 7: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Relational Databases

Database vendors such as IBM, Microsoft, Oracle, and Sybase have developed tools to assist in converting XML documents into relational tables.

Page 8: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Oracle

● Oracle's XML SQL Utility (XSU) uses a schematic mapping that defines how to map tables and views, including object-relational features, to XML documents.

● Oracle translates the chain of object references from the database into the hierarchical structure of XML elements.

Page 9: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Oracle

Creating Table:

Page 10: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Oracle

A corresponding XML document generated from the given object-relational model looks like:

Page 11: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

XSU

XSU can be used for executing queries in a Java environment and retrieve XML from the database.

Page 12: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

XSU

Page 13: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Query Languages

● XPath is a language for addressing parts of an XML document, and is the common locator used by both XSLT and XPointer.

●An XPath expression is a series of location steps separated by " / ". Each step selects a set of nodes that become the current node(s) for the next step. The set of nodes selected by the expression are the nodes remaining after processing each step in order.

Page 14: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Query Languages

● XQuery is a query language under development by the World Wide Web Consortium (W3C). The ambitious task is to develop the first world standard for querying Web documents.

● XQuery is a versatile markup language, capable of labeling the information content of diverse data sources including structured and semi-structured documents, relational databases, and object repositories.

Page 15: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Middleware: MySQL 5.1

● Middleware: Software you call from your

application to transfer data between XML documents and databases. For data-centric applications.

● MySQL has an option for using XML as their output format. In its Beta release of MySQL 5.1, several features have been added including new XML functions.

Page 16: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

XML Functions

MySQL version 5.1 has functions for searching and changing XML documents: ExtractValue() and UpdateXML().

Page 17: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

XML Functions

xml document name

Page 18: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

EXTRACTVALUE ( );

This function takes 2 string arguments:

The first parameter correspond to the XML_document string, and

the 2nd Parameter XPath_string (XPath expression / locator).

This will result in the return of the string containing a value from the document.

Page 19: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

EXTRACTVALUE (XML_document, XPath_string);

Page 20: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

EXTRACTVALUE (XML_document, XPath_string);

Page 21: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

UPDATEXML ( );

This function takes 3 string arguments:

The first two paramaters are similar to the ones used with extractValue(), XML_document and XPath_string.

The third parameter is the new value that will replace the one found.

Page 22: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

UPDATEXML (XML_document, XPath_string, new_value);

Page 23: DATABASE and XML Moussa Mané. Learning Objectives ● Learn about Native XML Databases ● Learn about the conversion technology available ● Understand New

Exercise

Using MySQL 5.1, create a “Movies” table, execute a query that would retrieve a specific movie title and another that would update a movie length.

You will send to Dr. Watson a screenshot of each query (with select statement) along with the folder of the database used (in MySQL\data).

It will contain the table Movie with the updated row