XML Databases
5. Mapping Relational Data to
Silke Eckstein Andreas Kupfer
Institut für Informationssysteme
Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de
5. Mapping Relational Data to XML Documents, 24.11.08
5.1 Mapping to XML 5.2 Mapping tables
5.3 Mapping query results
5. Mapping Rel2XML
5.4 Individual mapping 5.5 XSLT
5.6 Overview
• Why map relational database contents to XML?
– Interoperability
• We may want to use (parts of) our RDB contents in many
different application contexts (XML as data interchange format)
– Reconstruction
5.1 Mapping to XML
– Reconstruction
• We might have stored (parts of) our XML documents in an RDBMS in the first place (RDBMS as XML store)
– Dynamic XML contents
• We may use RDBMS queries to retrieve dynamic XML contents (cf. dynamic Web sites)
– Wrapping
• Everybody likes XML …, so why don't we give it to them?
• Why do we look at that mapping?
– What we're really interested in is the mapping in the opposite direction:
How to get XML into a database!
– Yes, but…
5.1 Mapping to XML
– Yes, but…
• This one is easier to start with.
• We do get some insight for the other mapping.
• We can see some of the problems.
• We'll see in what respect XML supports semi-structured
• XML vs. SQL
– Hierarchical vs. flat
– Loose schema vs. fixed schema
– Case-sensitive names vs. case-insensitive names
5.1 Mapping to XML
Case-sensitive names vs. case-insensitive names – Several type concepts
– Strictly unicode based vs. heterogeneous encodings – Ordered vs. unordered
• Mapping of SQL database to XML
– SQL charset to unicode (depends on implementation) – SQL identifiers to XML names
– SQL data types to XML schema data types
5.1 Mapping to XML
SQL data types to XML schema data types – SQL values to XML values
– SQL tables to XML and XML schema documents – SQL schemas to XML and XML schema documents – SQL catalogues to XML and XML schema documents
• Mapping between SQL identifiers and XML names
• Charset
– XML is based on unicode, SQL is not
– Mapping between a SQL charset and unicode depends on the implementation
• Names
– Not every SQL name is allowed as XML name (delimited identifier)
5.1 Mapping to XML
– Not every SQL name is allowed as XML name (delimited identifier) – Certain characters have to be masked (especially ":" and leading
"xml" )
• Ω _x03A9_ (the unicode value)
• Gehalt:FY2000 Gehalt_x003A_FY2000
• Work@home Work_x0040_home
• Home_Town Home_x005F_Town
– SQL name becomes XML name (in capitals)
• Employee <EMPLOYEE>…</EMPLOYEE>
• Mapping data type names
– Data type parameters are added to the XML name
• Example: DECIMAL_9_2, VARCHAR_10, BLOB_4000
• For TIME, TIMESTAMP, INTERVAL parameters are added about accuracy and time zone if applicable
– DOMAIN d in schema s in catalogue c is transformed to the XML name c.s.d (fully masked)
5.1 Mapping to XML
XML name c.s.d (fully masked)
– DISTINCT TYPE is analogous to domain
– ARRAY of the type t with maximal m elements: ARRAY_m.t – MULTISET is analogous to ARRAY
– ROW types: depends on implementation, but begin with prefix Row
– Interval types, structured types and reference types can not be
• Mapping of data types
– Using XML schema
• Many predefined data types
– <xsd:element name="city" type="xsd:string">
– <xsd:element name="zip" type="xsd:integer">
5.1 Mapping to XML
– <xsd:element name="zip" type="xsd:integer">
– Extension of DTDs by reserved attributes
• <city xml-sqltype="varchar">Braunschweig</city>
• <zip xml-sqltype="integer">38100</zip>
– XML processors or applications have to know about and evaluate those information
• ... Mapping of data types
– Differences between SQL and XML schema
• SQL data types are mapped to the best matching XML schema type
• Facets limit the range of the XML schema type to the SQL range
5.1 Mapping to XML
length scale maxElements domainName
maxLength minExponent final typeName
characterSet maxExponent catalogName mappedType
• Characteristics not mapped (like Collation and character set) are annotated
– Cooperation of the namespaces XML schema and SQL/XML
• To define the SQL base data types und type constructors in XML
characterSet maxExponent catalogName mappedType
collation userPrecision schemaName mappedElementType precision leadingPrecision
• Mapping of SQL basic data types: Character
– CHARACTER(20) CHARACTER SET LATIN1 COLLATION ENGLISH
<xsd:simpleType name="CHAR_20">
<xsd:annotation>
<xsd:appinfo>
<sqlxml:sqltype kind="PREDEFINED"
5.1 Mapping to XML
Exact type description Exact type description
based on the data
<sqlxml:sqltype kind="PREDEFINED"
name="CHAR" length="20"
characterSetName="LATIN1"
collation="ENGLISH"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:length value="20"/>
</xsd:restriction>
</xsd:simpleType>
based on the data type or type constructor from
SQLXML
Mapping to data type of XML schema
• Mapping of SQL basic data types: Numeric
– NUMERIC(12,2) with an implementation using 13 decimals
5.1 Mapping to XML
<xsd:simpleType name="NUMERIC_12_2">
<xsd:annotation>
<xsd:appinfo>
<sqlxml:sqltype kind="PREDEFINED"
name="NUMERIC"
There are different There are different attributes defined for name="NUMERIC"
precision="12"
scale="2"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="13"/>
<xsd:fractionDigits value="2"/>
attributes defined for the various SQL data
types, like precision and fraction digits for
numeric data types
• Mapping of SQL basic data types: DECIMAL(12,2) ARRAY [10]
<xsd:complexType name="ARRAY_10.DECIMAL_12_2">
<xsd:annotation>
<xsd:appinfo>
<sqlxml:sqltype kind="ARRAY"
maxElements="10"
mappedElementType="NUMERIC_12_2"/>
5.1 Mapping to XML
mappedElementType="NUMERIC_12_2"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Element"
minOccurs="0"
maxOccurs="10"
type="NUMERIC_12_2">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
Maximum length of the array
• Mapping of SQL basic data types: CHARACTER(20) MULTISET
5.1 Mapping to XML
<xsd:complexType name="MULTISET.CHAR_20">
<xsd:annotation>
<xsd:appinfo>
<sqlxml:sqltype kind="MULTISET"
mappedElementType="CHAR_20"/>
</xsd:appinfo>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Element"
minOccurs="0"
maxOccurs="unbounded"
type="CHAR_20">
</xsd:element>
</xsd:sequence>
Unlimited cardinality
5.1 Mapping to XML 5.2 Mapping tables
5.3 Mapping query results
5. Mapping Rel2XML
5.4 Individual mapping 5.5 XSLT
5.6 Overview 5.7 References
• Mapping of databases to XML
– Standard mapping of tables
– Standard mapping of query results – Individual mapping instructions
5.2 Mapping tables
• General approach
– How to map
• Table and column names to element and attribute names
• Data types to XML schema data types
• Data from the database to content in XML documents
5.2 Mapping tables
• Data from the database to content in XML documents
– Similar approach for all database system producers – SQL/XML (next chapter)
• Standard mapping of tables
– Database as a 3-tier hierarchy of
• Database
• Tables
• Columns
5.2 Mapping tables
Database
Table_1
Column_11 Column_12 Column_13
Table_2
Coulmn_21 Column_2o
Table_n
Column_n1 Column_np
• Columns
– Presentation of database contents and structures in an XML document
• As elements
• As elements and attributes
Column_11 Column_12 Column_13 Coulmn_21 Column_2o Column_n1 Column_np
• Example: Mapping as elements Pizza Delivery: Address:
5.2 Mapping tables
Pid Name Category Address
1 Super Pizza 4 1
2 Turbo Pizza 3 2
Aid City Street Number
1 Braunschweig Big str. 55 2 Braunschweig Small str. 6
– Standard mapping of column names to element names
2 Turbo Pizza 3 2 2 Braunschweig Small str. 6
<PizzaDelivery>
<Pid>1</Pid>
<Name>Super Pizza</Name>
<Category>4</Category>
<Location>1</Location>
</PizzaDelivery>
• Example: Mapping as elements and attributes Pizza Delivery: Address:
5.2 Mapping tables
Pid Name Category Address
1 Super Pizza 4 1
2 Turbo Pizza 3 2
Aid City Street Number
1 Braunschweig Big str. 55 2 Braunschweig Small str. 6
– Standard mapping of the column names to attribute names
<PizzaDelivery Pid='1'
Name='Super Pizza' Category='4'
Location='1' />
• Mapping of keys and foreign keys
– Goal: Keys and foreign keys shall be represented appropriately in the XML document
– Mapping relations to element hierachy
• 1:n relations are mapped to nested elements
5.2 Mapping tables
• n:m relations are problematic
– Denormalized content in the XML document – possibly high redundancy
– Using XML schema
• Representing keys and foreign keys with key / keyref
– Using DTD
• Mapping keys and foreign keys to attributes (ID/IDREF)
• Make keys unique (ID must be unique document wide)
• Keys and foreign key as nested elements
5.2 Mapping tables
Pid Name Category Address
1 Super Pizza 4 1
2 Turbo Pizza 3 2
Aid City Street Number
1 Braunschweig Big str. 55 2 Braunschweig Small str. 6 FK
– Resolving of foreign key relations by embedding referenced elements
<!ELEMENT PizzaDelivery (Pid, Name, Category?, Address)>
<!ELEMENT Address (Aid, City, Street, Number)>
<!ELEMENT Pid (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Category (#PCDATA)>
• Mapping object relational databases
– Object relational databases support non atomic, complex columns
• Tuple values
• Collection values
5.2 Mapping tables
• Collection values
• Object values
• Reference values
– Existing structure shall be carried over to the XML document
• Instance layer
• Schema layer
• Mapping object relational databases
– Instance layer:Appropriate mapping of instances with complex attributes (tuple, sets or lists)
5.2 Mapping tables
Pid Name <Address> {Phone}
1 Super Pizza 4City Big str.Street 55Number 1
1 Super Pizza BS Big str. 55 {'0531/555-7447'
1 Super Pizza BS Big str. 55 {'0531/555-7447'
'0531/555-2232'}
<PizzaDelivery>
<Pid>1</Pid>
<Name>Super Pizza</Name>
<Address>
<City>BS</City>
<Street>Big str.</Street>
<Number>55</Number>
• Mapping object relational databases
– Schema layer: Derive XML schema or DTD from object relational schema
5.2 Mapping tables
CREATE ROW TYPE AddressType(
City VARCHAR(25), Street VARCHAR(20), Number INTEGER);
CREATE TABLE PizzaDelivery(
CREATE TABLE PizzaDelivery(
Pid INTEGER NOT NULL PRIMARY KEY, Name VARCHAR(20) NOT NULL,
Address AddressType,
Phone SET(INTEGER NOT NULL));
<!ELEMENT PizzaDelivery (Pid, Name, Address, Phone+)>
<!ELEMENT Address (City, Street, Number)>
<!ELEMENT Pid (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Phone (#PCDATA)>
<!ELEMENT City (#PCDATA)>
…
• Mapping tables – summary
– Database output – complete – Required information – none – Variable output format – no
– Preservation of data types – by extended DTD or XML schema – Storing keys and foreign keys
5.2 Mapping tables
– Storing keys and foreign keys
• Mapping to hierachies in the XML document
• ID/IDREF
• XML schema
– Special features
• Parsers must evaluate DTD extensions
• XML schema is better suited
Appropriate represenation of tuples, sets, lists and references from
5.1 Mapping to XML 5.2 Mapping tables
5.3 Mapping query results
5. Mapping Rel2XML
5.4 Individual mapping 5.5 XSLT
5.6 Overview 5.7 References
• Mapping of SQL query results to XML documents or XML elements
– Standard XML representation
• Result table to rowset elements
• Every row to a row element
5.3 Mapping query results
• Every row to a row element
• Columns to subelements or XML attributes
• No variable structure
– Similar process is part of the SQL/XML standard
• SQL
• XML
5.3 Mapping query results
SELECT Name, Category, City FROM PizzaDelivery, Address WHERE City='Braunschweig' AND
PizzaDelivery.Address=Address.Aid
• XML ?
<rowset>
<row no='1'>
<Name>Super Pizza</Name>
<Category>4</Category>
<City>Braunschweig</City>
</row>
</rowset>
…
?
• Creating XML by using defaults from the DBMS
– Implementation dependant, e.g.: MySQL has an option to produce XML output
• Shell command to execute a query with username and database name, piped to a file
5.3 Mapping query results
./mysql -ujon test --xml -e 'SELECT * FROM t1' > t1.xml
<?xml version="1.0"?>
<?xml version="1.0"?>
<resultset statement="SELECT * FROM t1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row> <field name="Pid">1</field>
<field name="Name">Super Pizza</field>
<field name="Category">4</field>
<field name="Location">1</field> </row>
<row>…</row>
</resultset>
• Mapping query results – summary
– Database output – partial
– Required information – database query or view – Variable output format – no
– Preservation of data types – usually not, but possible
5.3 Mapping query results
– Preservation of data types – usually not, but possible to deduce
– Storing keys and foreign keys
• Possible to represent relations within the table
– Embedding, ID/IDREF, XML schema
– Special features
• none
5.1 Mapping to XML 5.2 Mapping tables
5.3 Mapping query results
5. Mapping Rel2XML
5.4 Individual mapping 5.5 XSLT
5.6 Overview
• Variants for individual mapping instructions
1 2
Extended database query with transformation instructions
Standard
5.4 Individual mapping
2
3
Standard
transformation XML query language
Standard
transformation XSLT stylesheet
Database
XML document XML view
Standardized document Standardized
XML document
• (Extended) database query languages
5.4 Individual mapping
– First Idea: use basic SQL
Database
XML document
• Creating XML by using basic SQL
– Basic idea is to use string concatenation in the select clause to build XML markup
• || operator from the SQL standard
5.4 Individual mapping
postgres=# SELECT 'abc' || 'def' AS "unspecified";
• Concatenation requires values to be not NULL
– Implementation independant
SELECT '<pizzerias><name>'||Name||'</name>',
'<category>'||Category||'</category></pizzerias>' FROM PizzaDelivery;
postgres=# SELECT 'abc' || 'def' AS "unspecified";
Result:
abcdef
• Problems and limitations of basic SQL
– Valid XML documents require a header and one root element
• Workaround with additional SELECT statements
– Nesting is difficult
5.4 Individual mapping
• The output is a single table
• No dependance on previous or following SELECT statements
• Extend an SQL dialect by XML operators:
– Database query (in SQL) to select the data to be presented in XML
• Example
Select * from PizzaDelivery, Address where (Address=Aid)
construct
<PizzaDelivery>
5.4 Individual mapping
<PizzaDelivery>
<name>
{$name}
</name>
<city>{$city}</city>
<address>{$street}
{$number}</address>
</PizzaDelivery>
Access to columns from the SQL result
Arbitrary XML names Arbitrary XML element and attribute
names
• Individual mapping instructions and XML queries
– Query to the database with XML query languages is supported
5.4 Individual mapping
Standard
Database
XML document XML view
Standard
transformation XML query language
• Implementing XML queries
– Naive Implementation
• Full content of the database is transformed to an XML document
• XML query is processed on this document
5.4 Individual mapping
• XML query is processed on this document
• Very inefficient (XML document can be very large, can contain irrelevant information)
– Better: XML view on the data in a database
• XML document will not be materialized (virtual)
• XML queries are processed on the virtual document
• Much processing within the native database engine
• Example: Silkroute
– Silkroute
• Middleware beween RDBMS and XML application
• Develloped by AT&T and University of Pennsylvania
– Creation of an XML view
5.4 Individual mapping
– Creation of an XML view
• Arbitrary output format
• View is not materialized
– XML queries to the view with XML-QL or XQuery – Problems
• Derive SQL queries from a view definition
• Silkroute example
5.4 Individual mapping
Construct
<view>
from Address a, PizzaDelivery d construct
<PizzaDelivery>
<name>$d.name</name>
<address>
<city>$a.city</city>
<street>a.$street
a.$number</street>
</PizzaDelivery>
</view>
• Benefits of using standardized XML documents as intermediate format
– Less requirements, more flexibility, better compatibility
5.4 Individual mapping
Database
XML document
Standardized Standardized
XML Standard
transformation XSLT stylesheet
• Individual mapping instructions – summary
– Database output – complete or partial – Required information
• XML query
• XSLT (see next section (5.5))
• View definition
5.4 Individual mapping
• View definition
– Variable output format – yes
– Preservation of data types – usually not, but possible to deduce
– Storing keys and foreign keys
• Embedding, ID/IDREF, XML schema
– Special features
• none
5.1 Mapping to XML 5.2 Mapping tables
5.3 Mapping query results
5. Mapping Rel2XML
5.4 Individual mapping 5.5 XSLT
5.6 Overview
• XSLT
– Extensible Stylesheet Language – Transformations
– A language to describe transformations from source to target tree structures (= XML documents)
– A transformation in XSLT
5.5 XSLT
– A transformation in XSLT
• Is described by a well-formed XML document called stylesheet
• Can use elements of the XSLT namespace as well as of other namespaces
• Contains template rules to execute the transformation
XML file
XSLT Stylesheet
XML file XSLT
Processor
XSLT stylesheet XSLT tree
5.5 XSLT
• XSLT processor
XSLT stylesheet and
XML document
XSLT tree and Source tree
Transformation
process Result tree Result
document
• Template rules
– A rule consists of a pattern and a template
– The pattern is compared to the nodes of the source document tree
5.5 XSLT
– The template can be instanciated to create a part of the target tree. It can contain elements of the XSLT namespace which are instructions to create fragments
• XSLT processing model
– By processing a list of source nodes,
fragments of the target tree can be created – The list starts with the root node only
– A node is processed
• By selecting the best matching pattern from all rules
5.5 XSLT
• By selecting the best matching pattern from all rules (resolving any conflicts)
• The template of the best matching rule is instanciated with the current node as context node
– A template usually contains instructions to select further source tree nodes for processing
– Recursivly repeat the selection of matching rules,
• Structure of a stylesheet
5.5 XSLT
<xsl:stylesheet id={id}
extension-element-prefixes={token}
exclude-result-prefixes={token}
version=number>
<!-- Content: (xsl:import*, top-level-elements)-->
– Elements and attributes with the XSLT namespace must be recognized by the XSLT processor
– PIs and comments are ignored
<!-- Content: (xsl:import*, top-level-elements)-->
</xsl:stylesheet>
• Top level elements
– E.g. xsl:import, xsl:include, and most importantly xsl:template
5.5 XSLT
<xsl:template
match = {pattern}
match = {pattern}
name = {qname}
priority = {number}
mode = {qname}
<!-- Content: (xsl:param*, template) -->
</xsl:template
• A pattern specifies a set of conditions to a node
– Uses a set of alternative (|-seperated) address paths in the child and attribute axis
– The use of '/' and '//', 'id' and 'key' functions is possible
5.5 XSLT
– The use of '/' and '//', 'id' and 'key' functions is possible – Pattern predicates ('[…]') can use all XPath
expressions
• Multiple matching patterns
– If multiple patterns match a node, the conflict is resolved by priorities (cf. priority attribute)
• Imported rules have a lower priority than rules of the primary stylesheet
• Alternatives are processed as if each alternative is defined by a
5.5 XSLT
• Alternatives are processed as if each alternative is defined by a single rule
• ChildOrAttributeAxisSpecifier::QName patterns have priority 0
• ChildOrAttributeAxisSpecifier::NCName patterns have priority -0.25
• ChildOrAttributeAxisSpecifier::NodeTest patterns have priority -0.5
• XSLT contains default rules
– Process the document recursivly
– But have lower priority than rules in the stylesheet – Example:
5.5 XSLT
Example:
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
• Rules
– Can be named and be called in templates of other rules – Can have parameters which can be passed along on
their invocation, default values can be defined
– The mode attribute allows a rule to be processed multiple
5.5 XSLT
– The mode attribute allows a rule to be processed multiple times and with different results
– If the template is invoked directly with xsl:call- template or xsl:apply-template, the filter
attributes (match, mode, priority or name) are not processed
• Templates
– Can contain literal elements (non XSLT
namespace) and elements of the XSLT namespace (instructions)
– If the rule is selected, the template can construct
5.5 XSLT
– If the rule is selected, the template can construct fragments of the result tree
– Processing depends on the context
– Default behaviour is to write all elements which are not in the XSLT namespace to the result tree
– Must be valid XML
– Can contain instructions
• Instructions to process nodes recusively
5.5 XSLT
<xsl:apply-template
select = {node set expression}
mode = {qname}>
<!-- Content: (xsl:sort, xsl:with-param)* -->
</xsl:apply-template>
– Without the attribute select all children of the context node are processed
– Select can be a (XPath-) expression to select nodes
• Could result in not terminating recursion!
</xsl:apply-template>
• Instructions to create a node
5.5 XSLT
<xsl:element
name = {qname}
namespace = {uri-reference}
use-attribute-sets = {qname} >
<!-- Content: template -->
– Name attribute is required, but can be calculated
– Other create instructions are similar
• xsl:attribute, xsl:attribute-set, xsl:text (to create a text/leaf node with whitespaces),
xsl:processing-instruction, xsl:comment
<!-- Content: template -->
</xsl:element>
• Instructions for flow control
– Conditional processing
5.5 XSLT
<xsl:if
test = {boolean expression}
<!-- Content: template -->
</xsl:if>
required
– Test expression is evaluated and result is casted to a boolean. If it is true the template will be instanciated
</xsl:if>
• Instructions for flow control
• Multiple choice ("if-then-else" / "switch")
<xsl:choose
<!-- Content: (xsl:when+, xsl:otherwise?) -->
</xsl:choose>
<xsl:when
test = {boolean expression}
5.5 XSLT
– If multiple xsl:when elements are true, only the first one is processed (no "break" needed)
– If no xsl:when element is true and there is no xsl:otherwise, no content is created
test = {boolean expression}
<!-- Content: template -->
</xsl:when>
<xsl:otherwise
<!-- Content: template -->
</xsl:otherwise>
• Repetition
5.5 XSLT
<xsl:for-each
select = {node-set expression}
<!-- Content: (xsl:sort*, template) -->
</xsl:for-each>
– The template is instanciated for each node selected by the node set expression
– On instanciation the current node becomes the
context node and all selected nodes are the node list – If there is no explicit sort statement, the nodes are
• "Calculation" of output text
– The selected object is casted to a string value and is
5.5 XSLT
<xsl:value-of
select = {string expression}
disable-output-escaping = "yes" | "no" />
– The selected object is casted to a string value and is inserted as content of the instanciated text node
• Other statements for sorting, numbering, variables, …
– see http://www.w3.org/TR/xslt
• Some advice
5.5 XSLT
• Some advice
– "select" is used differently depending on its context!
– Denomination "variable" is misleading!
– Context node is changed by for-each!
5.5 XSLT
<?xml version="1.1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="resultset">
<html>
<head/>
<body>
<h1>
<xsl:text>Summary about </xsl:text>
<xsl:text>Summary about </xsl:text>
<xsl:value-of select="count(child::*)"/>
<xsl:text> Pizzeria</xsl:text>
<xsl:if test="count(child::*) > 1">
<xsl:text>s</xsl:text>
</xsl:if>
</h1>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
5.5 XSLT
<?xml version="1.0"?>
<resultset statement="SELECT * FROM t1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance">
<row> <field name="Pid">1</field>
<field name="Name">Super Pizza</field>
<field name="Category">4</field>
<field name="Location">1</field> </row>
<field name="Location">1</field> </row>
<row>…</row>
</resultset>
<xsl:template match="field[attribute::name='Name']">
<h2>
<xsl:value-of select="."/>
</h2>
5.1 Mapping to XML 5.2 Mapping tables
5.3 Mapping query results
5. Mapping Rel2XML
5.4 Individual mapping 5.5 XSLT
5.6 Overview 5.7 References
• Conclusion
– Different methods to generate XML documents from stored information exist
• Standard mapping of tables to XML
– Standard XML document: fixed output format
5. Mapping Rel2XML
Standard XML document: fixed output format
• Standard mapping of query results
– Extend database queries by XML functionality – Standard XML document
• Individual mapping instructions
– XML views on database contents
– XML query languages processed on views
1. Introduction 2. XML Basics
3. Schema definition
4. XML query languages I 5. Mapping relational data
8. XML query languages II 9. XML storage I
10. XML storage - index 11. XML storage - native
5.6 Overview
5. Mapping relational data to XML
6. SQL/XML
7. XML processing
11. XML storage - native 12. Updates / Transactions 13. Systems
14. XML Benchmarks
• Can Türker, "XML und Datenbanken", Lecture, University of Zurich, 2008 [Tür08]
• Beginning XML Databases. Gavin Powell, Wiley &
Sons, 2007, ISBN 0471791202 [Pow07]
• M. Scholl, "XML and Databases", Lecture, Uni
5.7 References
• M. Scholl, "XML and Databases", Lecture, Uni Konstanz, WS07/08 [Scholl07]
• Jon Stephens, MySQL Documentation Team, "MySQL 5.1 Reference Manual", 2007 [MySQL]
• XML & Datenbanken. Konzepte, Sprachen und
Systeme. Klettke & Meyer, Dpunkt-Verlag, 2002, ISBN
• Now, or ...
• Room: IZ 232
• Office our: Tuesday, 12:30 – 13:30 Uhr
Questions, Ideas, Comments
• Office our: Tuesday, 12:30 – 13:30 Uhr or on appointment
• Email: eckstein@ifis.cs.tu-bs.de