Tuesday, June 23, 2015

XML Databases

Definition
            An XML database is a data persistence software system that allows data to be stored in XML format

Data-Centric Documents:
            Data-centric documents are documents that use XML as a data transport. Examples of data-centric documents are sales orders, flight schedules, scientific data, and stock quotes. Data-centric documents are characterized by fairly regular structure, fine-grained data (that is, the smallest independent unit of data is at the level of a PCDATA-only element or an attribute), and little or no mixed content. The order in which sibling elements and PCDATA occurs is generally not significant, except when validating the document.

Document-Centric Documents:
            Document-centric documents are (usually) documents that are designed for human consumption. Examples are books, email, advertisements, and almost any hand-written XHTML document. They are characterized by less regular or irregular structure, larger grained data (that is, the smallest independent unit of data might be at the level of an element with mixed content or the entire document itself), and lots of mixed content.

XML-QL: Querying XML Data
The motivation for XQuery is that increasing amounts of information are stored, exchanged, and presented using XML. An XQuery is an expression that:
Reads a number of XML documents or fragments
Returns a sequence of well-formed XML fragments

E.g., XQuery: List books published by Addison-Wesley after 1991, including their year and title.
<bookstore>
 {
  for $b in doc(“books.xml")/bookstore/book
  where $b/pub = "Addison-Wesley" and $b/year > 1991
  return
    <book year="{ $b/year }">
     { $b/title }
    </book>
 }

</bookstore>

No comments:

Post a Comment