Association Relationship Association Relationship Transformation of XML Transformation of XML Schemas to Object–Relational Schemas to Object–Relational Databases Databases Nathalia Devina Widjaya, David Nathalia Devina Widjaya, David Taniar Taniar Wenny Rahayu, Eric Pardede Wenny Rahayu, Eric Pardede Bandung, 11 September Bandung, 11 September 2002 2002
25
Embed
Association Relationship Transformation of XML Schemas to Object–Relational Databases Nathalia Devina Widjaya, David Taniar Wenny Rahayu, Eric Pardede.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Association Relationship Association Relationship
Transformation of XML Schemas to Transformation of XML Schemas to
Conclusion and Future WorkConclusion and Future Work
BackgroundBackground
The popularity of XML is growing and is gradually accepted as the The popularity of XML is growing and is gradually accepted as the
standard for describing and interchanging data between various standard for describing and interchanging data between various
systems and databases on the Internetsystems and databases on the Internet
XML now offers XML Schema definition language as a substitution XML now offers XML Schema definition language as a substitution
of DTD. It provides richer facilities for defining and constraining the of DTD. It provides richer facilities for defining and constraining the
content of XML documentscontent of XML documents
With the wide acceptance of the OO conceptual models, more With the wide acceptance of the OO conceptual models, more
systems are modeled and expressed with OO notation. This systems are modeled and expressed with OO notation. This
situation suggests the necessity to integrate the OO conceptual situation suggests the necessity to integrate the OO conceptual
models and XML.models and XML.
ObjectivesObjectives
The goal of this work is to present a coherent way to transform the The goal of this work is to present a coherent way to transform the
XML schema into ORDB using Oracle 9XML schema into ORDB using Oracle 9i i features modelsfeatures models
This transformation is important so that all the data that are created This transformation is important so that all the data that are created
using XML schema can be transformed to the database using using XML schema can be transformed to the database using
Oracle format and features, without eliminating the object relational Oracle format and features, without eliminating the object relational
featuresfeatures
XML Schema ORDB (Oracle 9i) Translator
Objectives (2)Objectives (2) The emphasis of this paper is on the transformation of The emphasis of this paper is on the transformation of association association
relationshiprelationship to help people conveniently generate Oracle database to help people conveniently generate Oracle database
The work presented in this paper is actually part of a larger The work presented in this paper is actually part of a larger
research project on research project on Transformation from XML Schema to Object-Transformation from XML Schema to Object-
Relational Databases.Relational Databases.
(i)(i) transformation of aggregation and inheritance relationship from transformation of aggregation and inheritance relationship from
XML Schema to ORDBXML Schema to ORDB
(ii)(ii) transformation of association relationship from XML Schema transformation of association relationship from XML Schema
to ORDBto ORDB
Association RelationshipAssociation Relationship ORDB was introduced to improve RDB performance and has ORDB was introduced to improve RDB performance and has
become popular because it improves the limitations of RDB such as become popular because it improves the limitations of RDB such as
lack of support for new types and composite data valueslack of support for new types and composite data values
Since ORDB has OO features, it encapsulates the static (including Since ORDB has OO features, it encapsulates the static (including
association relationship) as well as dynamic aspects of objectsassociation relationship) as well as dynamic aspects of objects
The The associationassociation relationship represents a “connection” between relationship represents a “connection” between
object instances. Basically, it is a reference from one object to object instances. Basically, it is a reference from one object to
another that provides access paths among objects in a system. another that provides access paths among objects in a system.
The objects are connected through an association link. The link can The objects are connected through an association link. The link can
have a specified cardinality: one-to-one, one-to-many, many-to-have a specified cardinality: one-to-one, one-to-many, many-to-
manymany
Related WorkRelated Work Most existing work has focused on methods to map RDB to an XML Most existing work has focused on methods to map RDB to an XML
database for database interoperability. Some works still used DTD database for database interoperability. Some works still used DTD
and some have used XML schema. and some have used XML schema.
The previous works include mapping referential integrity constraints The previous works include mapping referential integrity constraints
from RDB to XML, semantic data modeling using XML schemas, from RDB to XML, semantic data modeling using XML schemas,
hybrid database schema to map a subset of XML documents onto hybrid database schema to map a subset of XML documents onto
database structures, generic-transforming rules from the OOCM to database structures, generic-transforming rules from the OOCM to
XML schema, etc.XML schema, etc.
The transformation of generalization and aggregation relationship The transformation of generalization and aggregation relationship
from the XML Schema to ORDB has been done earlier as a first part from the XML Schema to ORDB has been done earlier as a first part
……</element></element><element name = “office”> <element name = “office”> <attribute name = “officeid” type = “string” use = “required”/><attribute name = “officeid” type = “string” use = “required”/></element>…</element>…
CREATE OR REPLACE TYPE Office_T AS OBJECTCREATE OR REPLACE TYPE Office_T AS OBJECT (office_id(office_id VARCHAR2(10));VARCHAR2(10));
2.2. Create another object for the one with total participation, Create another object for the one with total participation,
lecture, with the attributes and a REF that refers to office typelecture, with the attributes and a REF that refers to office type
<element name = “lecture”><element name = “lecture”>……<attribute name = “lectureid” type = “string” use = “required” /><attribute name = “lectureid” type = “string” use = “required” /><attribute name = “lectureName” type = “string” use = “optional” />…<attribute name = “lectureName” type = “string” use = “optional” />…
CREATE OR REPLACE TYPE Lecture_T AS OBJECTCREATE OR REPLACE TYPE Lecture_T AS OBJECT (lecture_id(lecture_id VARCHAR2 (10),VARCHAR2 (10), lecture_namelecture_name VARCHAR2 (50),VARCHAR2 (50), lecture_officelecture_office REF office_T)REF office_T)
The example that is used in this section is the relationship between The example that is used in this section is the relationship between
customer and ordercustomer and order
Customer Order 1 has * HAS1 *
One-to-Many Relationship (2)One-to-Many Relationship (2) The Transformation steps:The Transformation steps:
1.1. An element with a complex type in XML Schema, which does An element with a complex type in XML Schema, which does
not have reference inside it, is transformed by creating an not have reference inside it, is transformed by creating an
object in ORDB with all the attributesobject in ORDB with all the attributes
<xs:element name = “customer” type = “customerType” / ><xs:element name = “customer” type = “customerType” / >……<xs:complexType name = “customerType”><xs:complexType name = “customerType”>……</xs:complexType></xs:complexType>
<xs:complexType name = “customerType”><xs:complexType name = “customerType”><xs:attribute name = “customerName” type=“xs:string”/><xs:attribute name = “customerName” type=“xs:string”/><xs:attribute name = “shippingAddress” type=”xs:string”/><xs:attribute name = “shippingAddress” type=”xs:string”/><xs:attribute name = “shippingCity” type=”xs:string”/><xs:attribute name = “shippingCity” type=”xs:string”/><xs:attribute name = “shippingState” type=”xs:string”/><xs:attribute name = “shippingState” type=”xs:string”/><xs:attribute name = “shippingPostalCode” <xs:attribute name = “shippingPostalCode” type=”xs:integer”/>type=”xs:integer”/></xs:complexType>…</xs:complexType>…
CREATE OR REPLACE TYPE Customer_T AS OBJECTCREATE OR REPLACE TYPE Customer_T AS OBJECT (customer_id(customer_id VARCHAR2 (10),VARCHAR2 (10), customer_namecustomer_name VARCHAR2 (50),VARCHAR2 (50), shipping_addressshipping_address VARCHAR2 (100),VARCHAR2 (100), shipping_cityshipping_city VARCHAR2 (20),VARCHAR2 (20), shipping_stateshipping_state VARCHAR2 (20),VARCHAR2 (20), shipping_postalcodeshipping_postalcode NUMBER)NUMBER)
<xs:element name = “student”>…<xs:element name = “student”>…<xs:attribute name =”refCourseID” type= “xs:string” />…<xs:attribute name =”refCourseID” type= “xs:string” />…<xs:attribute name = “studentid” type = “xs:string” />…<xs:attribute name = “studentid” type = “xs:string” />………<xs:element name = “course”>…<xs:element name = “course”>…<xs:attribute name =”refstudentID” type= “xs:string” />…<xs:attribute name =”refstudentID” type= “xs:string” />…<xs:attribute name = “courseid” type = “xs:string” />…<xs:attribute name = “courseid” type = “xs:string” />………
CREATE OR REPLACE TYPE Student_T AS ObjectCREATE OR REPLACE TYPE Student_T AS Object (student_id(student_id VARCHAR2 (10),VARCHAR2 (10), student_namestudent_name VARCHAR2(30))VARCHAR2(30))
CREATE OR REPLACE TYPE Course_T AS ObjectCREATE OR REPLACE TYPE Course_T AS Object (course_id(course_id VARCHAR2(10),VARCHAR2(10), course_namecourse_name VARCHAR2(30))VARCHAR2(30))
Many-to-Many RelationshipMany-to-Many Relationship (4) (4)2.2. In the XML Schema, each element will be linked to another In the XML Schema, each element will be linked to another
element by using the attribute name that refers to another element by using the attribute name that refers to another
element ID. For those elements create table for each of them element ID. For those elements create table for each of them
in ORDB and add the constraints for the attributesin ORDB and add the constraints for the attributes
……<xs:attribute name =”refCourseID” type= “xs:string” />…<xs:attribute name =”refCourseID” type= “xs:string” />………<xs:attribute name =”refstudentID” type= “xs:string” />…<xs:attribute name =”refstudentID” type= “xs:string” />…
CREATE TABLE Student OF Student_TCREATE TABLE Student OF Student_T (student_id(student_id NOT NULL,NOT NULL, PRIMARY KEY(student_id));PRIMARY KEY(student_id));
CREATE TABLE Course OF Course_TCREATE TABLE Course OF Course_T (course_id(course_id NOT NULL,NOT NULL, PRIMARY KEY (order_id));PRIMARY KEY (order_id));