Information Technology Reference
In-Depth Information
3.9
Translating a Relational Schema into an XML
Schema Definition (XSD)
We can also translate a relational schema into an XSD. Like DTD, an XSD is also
an XML logical schema, and it has more features than DTD. The translation process
is also very similar to Sect. 3.7. As shown in Sect. 3.7, the three processes of map-
ping relational schema into an XSD are through an EER model and XSD Graph as
follows (Fong and Cheung 2005 ).
Step 1—Reverse engineering a relational schema into an EER model.
Same as in the step 1 of Sect. 3.7.
Step 2—Reengineering an EER model to an XSD graph.
The transformation between an EER model and an XSD Graph is a semantic-
based methodology. The transformation consists of the following nine rules outlin-
ing the basic framework between the EER model and the XSD Graph. The steps are
defined for capturing relationships and constraints among entities. Besides mapping
an EER model to an XSD Graph, we preserve the data semantics of the source rela-
tional schema in a target XSD in a hierarchical tree model.
Rule 1: Deine an XML View in XSD
Similar to rule 1 in Sect. 3.7, we can abstract an XML view of EER model upon user
supervision into an XML tree as shown in Fig. 3.55 .
Rule 2: Mapping Foreign Key from RDB to XSD The “Entities” and “Attri-
butes” of the EER model are represented as Elements and Attributes of an XML
model. We use the sub-element for applying the cardinality primitive in the XML
model. If we find the multi-valued attributes, we place them as subelements with
“maxOccurs = unbounded” in the XSD. In an XML model, a unique attribute can
be represented as a “key.” Thus, the primary key of an EER model is presented by
a <key> tag in the XML model. A foreign key d is eliminated in the translated XSD
because the foreign key between a parent relation and child relations in the rela-
tional schema is mapped into the hierarchical structure between a parent element
and its child elements in an XSD. See Fig. 3.56 .
Rule 3: Mapping Isa Relationship from RDB to XSD The relationship between
the sub-type and super-type is an “isa” relationship. When we map an EER model to
an XSD Graph, we can use the “extension” tag for the “isa” relationship. The “com-
plexType” feature can be applied for this primitive in the XML model. The child
“complexType” inherits properties of the parent “complexType” by applying the
“extension” tag on the child definition. Its attributes can be added on to complete
the “complexType” definition. See Fig. 3.57 .
Rule 4: Mapping of Generalization from RDB to XSD Generalization is a con-
cept in which some entities are subtypes of other entities. The disjoint general-
ization is mapped into a complex element such that its component elements are
mutually exclusive by a “choice” keyword. The overlap generalization is mapped
Search WWH ::




Custom Search