Some Commonly Used Annotation Attributes:
Annotation Attributes
|
Explanation |
Outline
|
Can be applied to attribute,
element or group. Take value true or false. If true, a relational table
will be created for this attribute, element or group.
|
maptoclob
|
Can be applied to attribute
or element. Take value true or false. If true, the element or attribute
will be mapped to a CLOB column.
|
edgemapping
|
Can be applied to element.
Take value true or false. If true, the subtree starting from the element
will be mapped using the edge mapping technique.
|
tablename | Can be applied to attribute, element or global group. The annotation value overwrites the table name generated by default. |
fieldname
|
Can be applied to attribute
or element. The annotation value overwrites the field name generated
by default.
|
Sqltype
|
Can be applied to attribute
or element. The value overwrites SQL type derived from schema data
type.
|
The original XML schema has a top elment IMDB, which contains a
list of SHOW elements. The SHOW Element has subelements TITLE and
YEAR of integer type, a choice group which containts alternative elements
BOXOFFICE and SEASONS, and a REVIEW element which may appear
multiple times.
<element name="IMDB" type="test:IMDBType"/>
<complexType name="IMDBType">
<complexType name="SHOWType">
|
By default the following relation tables will be generated by ShreX:
CREATE TABLE IMDB
( id_ VARCHAR(128) NOT NULL, PRIMARY KEY (id_) ); CREATE TABLE IMDB_SHOW
CREATE TABLE IMDB_SHOW_REVIEW
|
If we make the following annotations:
<element name="IMDB" type="test:IMDBType"/>
<complexType name="IMDBType">
<complexType name="SHOWType">
|
The generated relational schema is as the follow:
CREATE TABLE IMDB
( id_ VARCHAR(128) NOT NULL, PRIMARY KEY (id_) ); CREATE TABLE IMDB_SHOW
CREATE TABLE Showtitle
CREATE TABLE IMDB_SHOW_REVIEW
|
If we make an annotation for edge mapping:
<element name="IMDB" type="test:IMDBType"/>
<complexType name="IMDBType" xs:edgemapping="true">
<complexType name="SHOWType">
|
The generated relational schema is as the follow:
CREATE TABLE IMDB
( source VARCHAR(128) NOT NULL, ordinal VARCHAR(128) NOT NULL, attrname VARCHAR(128) NOT NULL, isValue VARCHAR(128) NOT NULL, value VARCHAR(128) NOT NULL, PRIMARY KEY (source,ordinal) ); |