Integration of Heterogeneous Databases Into XML Format With Translator
Integration of Heterogeneous Databases Into XML Format With Translator
Translator
A Project report
submitted in partial fulfilment of
the requirements for the award of the degree of
Bachelor of Technology
in
Computer Science and Engineering
by
Abhishek Singh Y2.245
Anurag Singh Y2.246
Khichade Sagar Shivdas Y2.319
into XML Format with Translator” is a bonafide record of the project under-
Shivdas Y2.319, under our supervision and guidance. The project report has been
Abstract
heterogeneous databases like MySql, Oracle, Sybase, Postgre, by taking the advan-
tage of some of the latest Web technologies.It provides a global interface for these
translates this query into SQL using a translator, then retrieves data from the
database, displays the result to the user and convert it into a unified format. The
Acknowledgements
puter Engineering, NIT Calicut for his guidance and co-operation. We also ac-
We would like to extend our gratitude to the entire faculty and staff of the
CSED NITC, who stood by us in all pits and falls we had to face during the
Abhishek Singh
Anurag Singh
Contents
Chapter
1 INTRODUCTION 1
1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 DESIGN 4
2.1 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 IMPLEMENTATION 8
4 RESULTS 9
4.1 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5 CONCLUSION 19
5.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Bibliography 20
Tables
Table
Figures
Figure
INTRODUCTION
There are many different heterogeneous databases like Mysql, Oracle etc.
Here we will integrate those databases into a unified XML format. To achieve this,
we will implement a translator, which will take user query in natural language
(English) as its input and gives corresponding SQL query as output. These queries
will be applied to underlying database to fetch information from the database and
then these will be displayed to the user. At the same time fetched data will be
This XML document can be used further for other XML processing like converting
1.2 Motivation
suitable hospital in a timely fashion, and to arrange appropriate treatment for the
patient. Taking advantage of the Internet to exchange data can accelerate the
process of transfer of patient related data, it also avoid the unnecessary repeat
we must address the problems of data exchange. The most important thing for
information interchange is that the data format is common which will reduce the
2
complexity of data exchange. The World Wide Web Consortium (W3C) in 1996
suggested that the XML standard would be the solution to this problem. In a
similar way, with the rapid growth of the Internet, lots of other organizations make
use of the Internet to provide information services. In the past few years, XML has
become the standard for exchanging data on the Internet and on intranets in the
data. Starting out as a standard data exchange format for the Web, it has become
information services. As a consequence, the amount of XML data being stored and
processed is large and will be increasing at an astonishing rate. This has caused
• Different views of the same data are easy to create with style sheets.
To make this task more user friendly, a natural language interface can be pro-
vided.
Extensive study was done on topics relevant to the project. These topics
include development of translator [2] and XML [5][6][7]. We had to look into
the syntax of input user query in natural language and SQL queries (the output
dling, database connectivity, GUI etc. We can also apply XQUERY on XML data
[8][9][10].
The remaining part of the report deals with design of the project, snapshots,
work done, results obtained, conclusion and references. Details will be explained
Section 2: This section will describe the design of the whole project. It will
start from the first step in the design from where input is taken till the last step
Section 3: This section will show the snapshots obtained by running the
program.
Section 4: This section will describe the work done in the project. It will
put light on the various stages in which the implementation was done.
Section 5: This section will mainly deal with the results which were obtained
Section 6: This section will conclude the whole document. It will try to put
some light on what was achieved by doing this project and what more has to be
done.
Section 7: This section has all the references which were used while studying,
DESIGN
2.1 Configuration
This stage takes some preliminary information from user which will be used
for database connection. This will be done by a GUI where user can enter the
learning.
This stage checks for any syntax errors in the input user query/statement
error message is reported. The tool used to implement this stage is a Perl Module
known as Parse::RecDescent.
2.3 Translation
This stage translates the input user query into SQL query after syntax anal-
ysis is over. So here input will be a query in english language conforming to the
This stage executes the translated SQL query. It involves database connec-
tion and then passing the query to the database then get the resulting data back.
This is the stage where the information provided by user in configuration stage
will be used for database connection. All these things will be done by GUI. Result
This stage converts the result obtained by executing the SQL query into
IMPLEMENTATION
The project was divided into modules covering all stages and implemented
Coding for configuration part was done as one stage which involves GUI and file
handling.
The second stage was syntax analysis which is completed by writing the grammar
The third stage was the coding done for executing the SQL query (the output of
The last stage was the conversion of this data into XML format. It involves file
After doing all above we integrate it and get the code as a whole.
Chapter 4
RESULTS
4.1 Testing
The output of the program was tested with many possible input query in
natural language and compared with expected output and was observed to be
correct for all runs. Thus the code runs successfully for commands SELECT queries
with other functions like AVG, COUNT, SUM, DISTINCT. The test data was
chosen such that the errors covered could be checked. Any query which does not
Thus we have successfully done our project and we use it to convert any database
4.2 Snapshot
When you run NAT-SQL for the first time, following configuration window
will come up. You need to enter all the following information before continuing to
the NAT-SQL.
Select the type of the database if you already know or otherwise chose the option
”Do not Know”. NAT-SQL will attempt to find the database type if you do not
If type of database is not in he list (i.e. ”Other”), then the NAT-SQL cannot
proceed any further until you install the appropriate database driver.
Available sources - These are the available data sources for the selected
database type. You can either select the data source from this list or type it in the
is executed. It is strongly recommended to keep this value below 100 as this may
Since NAT-SQL does not store your password to access the database, you
need to enter the database password every time you run the program. Therefore
NAT-SQL will always bring up the following login window at the start-up.
User - user name will be asked here for the database connection
Translate the query to SQL - As the name suggests, this button calls the
NAT-SQL parser to translate your natural language query to SQL. The results of
11
Clear - clear the content in the natural language query area. Create your
own SQL - This brings up the window where you can easily create SQL statements
Execute SQL - Execute the SQL statement and display the results in the
results table. If here is an error in the SQL statement, an error message is displayed.
Note that you can only execute SELECT queries. Trying to execute any
It will give the view of the data source i.e. the names of tables and all
Here a GUI will be shown to user with table names, column names in each
tables and a space to give conditions. Here user need not remember the grammer
of the input language. He can create SQL query by just selecting the necessary
Here user has to enter the english language query. So it is necessary that
CONCLUSION
5.1 Summary
translates natural language query into SQL commands. This translator works only
for SELECT commands because here we are not giving privilege to normal user
to make any change to the underlying databases. After retrieving the data from
database, we are converting it into XML format which can be use for further pro-
cessing. Overall this project helped us to learn the development of the translator
The translator works only for SELECT commands but it can be easily ex-
by just modifying the grammar and writing actions for the same.
Bibliography