Upload
difficulttocure
View
216
Download
0
Embed Size (px)
Citation preview
7/30/2019 Presentation of the Relational Object Model
1/11
7/30/2019 Presentation of the Relational Object Model
2/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
attempted to store XML documents in RDBMS either as massive BLOB or CLOB objects or by the technique of
"shredding", which consists in breaking the document XML in fragments that can be stored into relational
tables, as DB2XML6, XML Extender dIBM7, XPERANTO[Carey et al (2000)], SilkRoute[Fernandez et al
(2002)] and others [Bohanon et al (2002), Chen et al (2003), Florescu and Kossmann (1999)].
These methods are unsatisfactory. The first requires to reassemble the XML data before making requests
and, depending on the volume, it can take time and fundamentally impact the performance, especially as these
databases, relatively new on the market are expensive and do not replace relational databases. They rather serve
as intermediate cache between Web applications and data sources to improve performance. The second breaksthe structure of the XML document and makes it lose its properties. Algorithms have been proposed to realize
the mapping between XML documents and databases, and vice versa [Lee et al (2001), Lee et al (2002), Wu et
al (2001)].
Our objective is to combine the advantages of relational databases and objects databases in a storage model
represented strictly in XML. This model is independent of any platform, it allows the storage of complex data of
any kind (text, image, sound, ...), its structure is composed of a set of collections. In our model of storage, we
adopt the global structure of the relational model by suggesting decomposing an XML document into several
collections. Thus, we eliminate one of the main problems facing the storage of large volumes of data into one
document: the repetition and the redundancy inherent to strictly hierarchical data.
We propose the creation and manipulation of XML data via SQL3 queries. Our choice of language is due to
the predomination of the relational model and to its evolution towards the objects and the possibilities it
provides precisely by the support of the complex objects.
We have developed a FRAMEWORK JAVA/XML, allowing the ultimate user write SQL3 queries in order
to specify the structure of the database, creation of types, and definition of XML documents. Throughout this
article, we present the different phases of the expression of SQL3 queries, the generation XML schema at the
storage of the valid documents in relation to generated schema.
This Solution helps define a visible correspondence between the relational-object Template and XML
Template of database. It helps automatically provide the XML storage Template which we are proposing, limit
the multiple imbrications of standard XML data, and remarkably reduce redundancy.
2. XML STORAGE TEMPLATE PROPOSES2.1. Abstract Syntax of TemplateOur solution consists of defining an XML storage Template that is based on the relational Template; its structure
is made up of a set of collections. A collection is a document which contains elements that are simple (atomic)
or compound, verifying constraints of keys and domains.
BD XML ::= {Collection }* + {Constraints }*
Collection ::= {Element }*
Element ::= {Components }*
Component ::= {Element | Attribute }
Constraints ::= {constraint key + constraint domains }
The global structure of our XML Template is similar to the relational Template, by considering relational
table as a collection XML except that the attribute of relation is atomic whereas the collection can have
components that are either attributes or elements of a simple or complex nature. We shall limit in our Template
imbrications in order to reduce redundancy of standard hierarchical XML Template and gain certain flexibility
in relation to the relational Template. We adopt such limitation in order to simplify the processing and
representation of complex (or compound) data.
2.2. Structure of the directory containing database
4 http://www.oracle.com/database/berkeley-db/xml/index.html5 http://www.dbxml.org6 http://www.informatik.fh-wiesbaden.de/~turau/DB2XML7
http://www-4.ibm.com/software/data/db2/extender/xmlext
ISSN: 0975-5462 6647
7/30/2019 Presentation of the Relational Object Model
3/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
The database is organized in the form of a set of directories; each of which corresponds to a collection. The
directory contains a file XML collectionName.xml which represents the collection. Generally, it is a large
size and entirely operates in the server memory. Operations, such as adding, deleting, updating of objects of the
collection, are so complex and cannot be applied to the entire collection.
A sub-directory of xml-objects thus contains the different objects XML in distinct files. All updating
operations will be therefore applied separately to objects XML.
+ database+ .metadata+ .resources+ collection1
- collection.xml+ xml-objects
object1.xmlobject2.xml...
+ .resources+ collection2
- collection.xml+ xml-objects
object1.xmlobject2.xml...
+ .resources+ ... other collections
Fig.1. Structure of the database.
The database also contains a directory metadata defined in the root directory which contains meta-
information on the collections. Another directory, resources is created to enclose external resources relating to
the objects of the database. There are two kinds of resource; they are namely absolute resourcesand relative
resources.
The absolute resources are independent of any collection. They are defined in the root directory of the
database to be referenced by any collection.
The relative resources are specific to each collection. They are defined in a directory of resources linked to
the collection. The correspondent objects of the collection can alone make reference to these resources.
TheGeneralArchitectureoftheApplication
Fig. 2. The general architecture of the application.
ISSN: 0975-5462 6648
7/30/2019 Presentation of the Relational Object Model
4/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
Fig.3. Diagram of main class
Figures 2 and 3 present the architecture of the application. The text SQL in entry is analyzed by SQL Parser.
The latter analyzes the syntax and produces abstract syntax trees. A NodeVisitor skims through all the absolute
syntax trees and creates objects which correspond to the queries. These objects are used to create either the
schema XML (ParseTree2Xsd) for creations of queries (DDL), or documents XML (ParseTree2XML) for
queries of insertion on the document XML (QueryTranslator).
The documents that are inserted in the database should conform to the generated schema. It is compulsory
therefore to create a validator of schema to check the coherence of the model and to allow the validation of the
documents XML of the database.
3. Mapping between Types SQL3 and Types XML SCHEMAOur goal is to present data SQL in a model XML in a way that preserves the maximum of information.
3.1. Mapping predefined types SQLTo insure the correspondence between the predefined SQL types, the strategy consists of look at a correspondent
XML Schema type that is close to a SQL type and to do a direct conversion or define a XML Schema type or
define one on the basis of retrieved information on a SQL type.
Table1. Table of correspondence between the predefined SQL types and XML SCHEMA.
SQL type XML SCHEMA type
CHARACTER,CHARACTER
VARYING,
CHARACTER LARGE OBJECT,
CLOB
VARCHAR,NCHAR
xsd:string ou restriction du type xsd:string contenant
xsd:length ou xsd :maxLength
BINARY LARGE OBJECT ou BLOB xsd:hexBinary ou xsd:base64Binary, avec la facet
xsd:maxLength
NUMERIC,DECIMAL Xsd:decimal, avec les facets xsd:precision et xsd:scale
INTEGER, BIGINT,SMALLINT Xsd:int
avec xsd:minInclusive et xsd:maxInclusive
FLAOT, REAL Xsd:float
DOUBLE PRECISION Xsd:double
BOOLEAN Xsd:Boolean
ISSN: 0975-5462 6649
7/30/2019 Presentation of the Relational Object Model
5/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
Table1 (Continued)
DATE Xsd:date
TIME Xsd:time
TIMESTAMP Xsd:dateTime
INTERVAL xsd:duration
Table 2. Example of mapping between SQL type and XML SCHEMA.
SQL type XML SCHEMA typeINTEGER
SMALLINT
DECIMAL(12,2)
BLOB(12)
CHARACTER (33)
INTERVAL YEAR(4) TO
MONTH
3.2. Mapping of User predefined TypeA SQL object type defined by the user corresponds to a complex type in XML Schema.
1. If it has to do with a distinct type, it will be translated into an extension of the as it is shown in thefollowing case:
CREATE TYPE NAME_TYPE AS CHARACTER(100);
1: Create of complexeType defined by string type
ISSN: 0975-5462 6650
7/30/2019 Presentation of the Relational Object Model
6/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
2: Define the complexType name_type with complexType stringType for constrain the restriction maxLenght
value = 100.
2. In the case of a type defined by the user which is not distinct, we create a complex type containing assequence the attributes of the defined type
CREATETYPE XOD_TYPE AS(
id CHARACTER(30),
nameCHARACTER(30),
equivalent_names REF(NAME_)ARRAY [100]
--others attributes
);
became
complexType defined
sequenceofSQL type attributes
< !element representing the SQL type attributes -->
3.3. Mapping of tablesA SQL table is transformed into a complex type element whose sequence contains the different columns of the
table. Nevertheless, one table contains also constraints relating to columns in the manner of the types defined bythe user.
A table can contain 0 with several tuples; thus the complex type will include a sequence with minOccurs
with value 0 as an attribute and an attribute maxOccurs with unbounded value.
The columns with constraint automatically become elements whereas the columns with constraints, unique
primary key become attributes as the following table shows:
Table 3. The correspondence between SQL concepts and XML SCHEMA
SQL XML SCHEMA
Table element of complex type
Column without constraint element of the sequence with complex type
Column of primary key Attribute of complex type with attribute use= "required"
Column with constraint not null element with attribute nullable="false"
Unique constraint Attribute | xsd:unique
Constraint foreign key and reference element xsd:keyRef
Table 4. The correspondance between SQL create table and XML SCHEMA
Create a table Schma XML corresponding
CREATE TABLE
colouring_compounds(
index INTUNIQUE,
description CLOB,
iupac_name
ISSN: 0975-5462 6651
7/30/2019 Presentation of the Relational Object Model
7/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
Table 4 (Continued)
CHARACTER(100)
);
3.4. Express heritage through mappingThe types as well as tables that are created from a given type and the correspondent schema will be constructed
from the extension from base type.
Table 5. Mapping of the table defined with a type
SQL XML SCHEMA
CREATE TABLE dystuffs OF XOD_TYPE (
--defining the additional columns and
constraints
);
Table 6. Mapping of the heritage
SQL XML SCHEMA
CREATE TYPE RESOURCE_TYPE
ASCHARACTER(100);
CREATETYPE RESOURCE UNDER
RESOURCE_TYPE AS(
src CHARACTER(50),
type CHARACTER(50)
);
3.5. Mapping REFERENCE type columnsREF type is directly mapped into reference in XML SCHEMA
ISSN: 0975-5462 6652
7/30/2019 Presentation of the Relational Object Model
8/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
Table 7. Mapping of the columns with reference type.
SQL XML SCHEMA
CREATE TYPE LINK
( src character(20) not null );
CREATE TYPE IMAGE_TYPE(
images ref(LINK),
-- others columns
);
...
...
3.6. Mapping types of named linesTo map the ROW type column, the column is transformed into a complex XML type whose name is and that of
the column and the sequence consists of elements representing ROW type columns. However ROW type is
recurrent because it can in its turn contain columns of this type. We therefore apply recurrent mapping:
Table 8. Mapping of column with ROW type
SQL XML Schma
CREATE TABLE dyestuffs OF
XOD_TYPE(
biological_sources ROW
(biological_source ROW
(key CHARACTER(100)
) ),
);
7/30/2019 Presentation of the Relational Object Model
9/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
The parser is based on a specification of language SQL [ANSI-ISO IEC 1999 SQL SPECIFICATION] as
a primary source of syntax SQL1999.
The syntax is described in Backus-Naur Form or BNF (Language of definition of formal languages) can be
found at the following URL:http://savage.net.au/SQL/sql-99.bnf
SQL3 grammar was not entirely implemented; the SQL instructions recognized by the parser are the queries
DDL (Data Definition Language) for the Description of the structure of the database, the creation of types and
tables, and insertion in queries DML (Data Manipulation Language).
Below, we will define a table and provide the representation of the obtained abstract syntax tree,
CREATETABLE art_objects OF XOD_TYPE(
type_of_object CHARACTER(100),
title CHARACTER(30),
collection CLOB,
owner CHARACTER(100),
historical_period CHARACTER(50),
provenance CHARACTER(100),
dimensions CHARACTER (100),
description CLOB,
creation CHARACTER(50),
images ROW(
img RESOURC ),
samples ROW(sample ROW( key CHARACTER(100) )
)
);
The syntactic tree corresponding to the precedent query
Fig.4. Sample of an abstract syntactic tree
Taking into account, the number of grammar rules SQL3 to process, we have espoused a generator of
syntactic analyser JavaCC. The tool reads the specifications of a grammar and converts it into program Java; it
provides other possibilities relative to the generation of parser such as construction of tree and debugging.
It includes module JavaCC to generate the parser and module JJTree to generate nodes. JJTree is a
preprocessor for JavaCC which inserts the syntactic trees of actions of rules of a given grammar in various parts
in the source JavaCC. It defines an interface Node which provides methods for operations such as placing the
parent of node and adding and searching children.
Fig.5. Functioning of JJTree
ISSN: 0975-5462 6654
7/30/2019 Presentation of the Relational Object Model
10/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
5. GENERATION OF SCHEMA XML AND VALIDATIONThe generation of code XML Schema should be done from a schema which complies with model XML. This
part shows the different necessary steps starting from the extraction of the data of the table and types SQL to the
generation of a hierarchical structure of elements appropriate for the norm XML. We have defined the process
of transformation:
queries of creation in schema XML, queries of insertion in documents XML, Mapping consists in browsing all the created objects, retrieving their property and transforming them
into their equivalents; i.e. in element, or sequence of elements of a simple or complex type.
A schema which is compliant with model can be derived from a conceptual schema of data using theformalism Entities-Relations. To achieve this objective, we have devised a semi-automatic method of
transformation of schema. The main steps of this method are:
The transformation of complex structures such as the relations of heritage or types of ternaryassociations;
The construction of an arborescent structure deleting some cycles and the resolution of the conflicts ofthe father,
The modification of cardinalities that are not accepted in a model; The specification of the mode layout of elements son in relation to father; The transformation of attributes of schema in elements or attributes XML.
Fig.6. Validation of documents XML against schema XML.
6. Comparaison and PerspectivesGenerally, the native database XML save documents XML by preserving the arborescent logical structure. The
system DB2XML produce a document XML which directly represents the tables and their attributes in the
document XML without taking into account the relations which can exist between the tables. The system
XPERANTO and SilkRoute provide the user with a language of construction on database. It is evident that themanager of these systems is alone capable of using this language since it is only he who knows the schema of
the database. The use of the system SilkRoute requires the knowledge of the language of the definition of views
RXL. The system XPERANTO defines a global schema in XML Schema on the entire database and then the
manager, if necessary, formulates the queries XML-QL which define the sub-views.
Our solution allows for the production in model of storage for a database XML; the big advantages of this
achievement is allow for the creation and manipulation of a database XML by queries SQL3 just in the same
way as a relational-object database, which provides the users wich several possibilities to access and manipulate
data without having to necessarily master neither XML SCHEMA, XQuery, XPATH or XSLT. On the one
hand, the adopted relational structure considerably reduces the redundancy of the standard hierarchical model
and allows the management of the relations between the collections, and on the other hand, the use of SQL3,
allows us to introduce the complex types that are provided by XML Schema. Our perspective is to extend this
work to provide a complete model of conversion of SQL3 to XML on the one hand, and to efficiently complete
the management of the relations between the collections which applied in the relational model in the form of
constraints of referential integrities.
Conclusion
The relational-object model and the XML hierarchical model have similarities and differences. Our contribution
in this work is as follows:
The prolongation of the relational model in XML format by making use of the advantages of XMLsuch as simplicity, extensibility, portability, and integrability
The introduction of the notion of object (to express heritage, definition of type ROW, array, REF )expressed in SQL3 and defined in the complex type of XML Schema.
ISSN: 0975-5462 6655
7/30/2019 Presentation of the Relational Object Model
11/11
Laila Alami Kasri et al. / International Journal of Engineering Science and Technology
Vol. 2(11), 2010, 6646-6656
The visible correspondence between SQL3 and XML Schema for the description and validation of thedata in the base.
Minimisation of imbrication and redundancy produced by the standard structure of hierarchical XML The possibility provided to the user to work with the relational data on the Web with the advantage of
having XML format; these data can easily transported and can be exploited and integrated by the
applications
The advantage of working with XML data without having to master the technological space linked to it.References
[1] Ajay Vohra ; Deepak Vohra, (2006) : Pro XML Development with Java Technology.[2] ANSI/ISO/IEC 9075-1 (1999) International Standard (IS) Database Language SQL- Part1: SQL/Framework[3] Bohannon P.; Freire J.; Roy P.; Simeon J., (2002) From XML-Schema to Relations: A Cost-Based Approach to XML Storage.
In ICDE.[4] Bray, T.; Paoli,J. and Sperberg-McQueen C. M.(Eds). (Oct 2000) : Extensible Markup Language (XML) 1.0 (2nd Edition). W3C
Recommendation, Oct. 2000. http://www.w3.org/TR/REC-xml/.
[5] Carey, M.; Florescu, D.; Ives, Z.; Lu, Y.; Shanmugasundaram, J.; Shekita, E. and Subramanian, S. (May 2000) XPERANTO:Publishing Object-Relational Data as XML. In Intl Workshop on the Web and Databases (WebDB), Dallas, TX.
[6] Chen, Y.; Davidson, S.; Hara, C. ; Zheng, Y. (Sep 2003) RRXS: redundancy reducing XML storage in relations. VLDB '2003:Proceedings of the 29th international conference on Very large data bases - Volume 29.
[7] Date, C. J.; Darwen, H. (1998): Foundation for Object/Relational databases", The third manifesto de Addison-Wesley.[8] Elmasri, R. ; Navathe, S. Conception et architecture des bases de donnes, 4 edition.[9] Eric Van Der Vlist, (June 2002) : XML Schema, O'Reilly ISBN: 0-596-00252-1.[10] Erthold Daun (2003) : Modeling Business Object with XML Schema, Morgan Kaufmann ISBN: 1-55860-816-8.[11]
Fernandez , M. ; Tan, W.C.; Suciu, D. ; Kadiyaska, Y. and Morishima, A. (Dec 2002): SilkRoute:A framework for publishingrelational data in XML. In Transactions on Database Systems (TODS), 27 (4).
[12] Fernandez, M.F.; Florescu, D.; Kang, J.; Levy, A.Y. and Suciu, D., (1998) : Overview of Strudel A web-site managementsystem, Networking and Information Systems 1 (1) 115140.
[13] Florescu, D.; Kossmann, D. (Sep 1999) : Storing and querying XML data using an RDBMS. In Bulletin of the TechnicalCommittee on Data Engineering, pages 2734.
[14] Irena Mlynkova ; Jaroslav Pokorny, XML in the world of the (Object-) relationaldatabases.[15] Irena Mlynkova ; Jaroslav Pokorny, From XML Schema to object-relational database- An XML Schema-Driven Mapping
algorithm.
[16] Kriegel, A; Boris, M. ; Trukhnov (2003): SQL Bible Wiley Publishing, Inc. ISBN: 0-7645-2584-0.[17] Lee, D.; Mani, M.; Chiu, F. and Chu, W. W. (May 2001) : Nesting-based Relational-to-XML Schema Translation, In Intl
Workshop on the Web and Databases (WebDB), Santa Barbara, CA.
[18] Lee, D.; Mani, M.; Chiu, F. and Chu, W. W. (2002) NeT \& CoT: translating relational schemas to XML schemas using semanticconstraints. In CIKM '02: Proceedings of the eleventh international conference on Information and knowledge management,
McLean, Virginia, USA.
[19] McHugh, J.; Abiteboul, S.; Goldman, R.; Quass D.and Widom, J., (1997) : Lore: A database management system forsemistructured data, SIGMOD Record 26 (3) 5466.
[20] Melton, J. (2002), SQLX : Bringing SQL and XML together.http://www.wiscorp.com/SQLX_Bringing_SQL_and_XML_Together.pdf
[21] Melton, J. Advanced SQL: 1999 - Understanding Object-Relational and Other Advanced Features Morgan Kaufmann 2002-09-09 ISBN: 1558606777.
[22] Melton, J.; Simon, A. R. SQL:1999 Understanding Relational Language Components Morgan Kaufmann, May 2001, ISBN 0-55860-456-1.
[23] Pardede, E. ; Rahayu, J. W. and Taniar, D. (2003) : New SQL standard for object-relational database applications, Proceedingsof SIIT 2003, IEEE, Delft, The Netherlands pp. 191203.
[24] Pardede, E. ; Rahayu, J. W.; Taniar, D. (2006) :Object-relational complex structures for XML Storage, information and SoftwareTechnology Volume 48, issue6, pp. 370-384.
[25] Rick F. Van Der Lans, (September 2006) : Introduction to SQL-Mastering the Relational Database Language 4th Edition 2006,Addison Wesley Professional.
[26] Sandeepan Banerjee, Implementing XML Schema inside a Relational Database[27] Stonebraker, M. ; Moore, D. ; Morgan and Kaufman, (1998) : Object relational DBMS, the next great wave.[28] Wu, X.; Ling, T.W.; Lee, M.L. and Dobbie. G., (Dec 2001) : Designing Semistructured Database Using ORA-SS Model. In
Intl Conf. on Web Information Systems Engineering (WISE), Kyoto, Japan.
[29] XML Schema Definition Language (XSD) 1.1 Part 1: Structures, http://www.w3.org/TR/2009/WD-xmlschema11-1-20090130/[30] XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes, http://www.w3.org/TR/2009/WD-xmlschema11-2-20090130/[31] XML Schema Part 0: Primer Second Edition, http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/
ISSN: 0975 5462 6656