Using a Java Query Analyzer to Translate Generic Query to SQL, XPath and XQuery
Track: Integration, Client Applications
Audience Level: Technical View
Time: Tuesday, November 16 at 16:00
Keywords: XML, XQuery, XPath, SQL, Query Language, Database, Java, Search
Abstract:
As traditional relational databases and new native XML databases are maturing as viable storage solutions for XML data, application developers are faced with SQL extended to provide XML support along with new query languages, such as XPath and XQuery.
At the Indiana University Digital Library Program, various data-driven digital library collection applications are developed. The diversity of data sources and formats in those collections requires the use of different types of databases and storage systems. For instance, relational databases are used to store image collection metadata and Dublin Core metadata to support Open Archives Initiative (OAI) data harvesting. At the same time, many academic and research data are stored in document-centric XML files, using common scholarly XML vocabularies, such as TEI (Text Encoding Initiative). To preserve the structure of these XML data, they are stored in native XML databases, which can be queried using XQuery or XPath. The nature of digital library projects requires a robust yet user friendly searching interface for retrieving data from collections. Such an interface typically allows users to submit queries that can contain Boolean operators, wildcards, multiple-word phrases, groupings with parentheses, and filters that can narrow a user's search based on parameters such as date or media type.
At the Indiana University Digital Library Program, a Java Query Analyzer (JQA) was developed to simplify interaction with heterogeneous database and storage systems. JQA interprets generic user query input, containing familiar Internet search engine operators, and transforms that user input into SQL, XPath, or XQuery statements, which can then be used to query data collections stored in a variety of relational database or native XML storage systems. It offers a transparent API (Application Programming Interface) to perform such interpretations while hiding the logics of parsing and transforming from developers.
JQA has these characteristics:
1.Transparent. JQA provides developers with a generic query API that can interact with systems supporting SQL, XPath, or XQuery. JQA provides a generic connection interface to integrate with Java database connection APIs for relational databases and XML databases.
2.Adaptive. The API can be adapted to handle query text from different searching interfaces, such as a "simple" search, "advanced" search or query-driven browsing.
3.Extensible. Very often developers need to take advantage of vendor-specific extended syntax in SQL and XPath. The query analyzer can be extended to interpret user’s queries and transform those queries into vendor-specific query languages.
4.Configurable. Developers can use a simple XML file to configure JQA. The configuration file allows developers to map generic query inputs to specific query language statements, configure query operators and syntax, and define supports for internationalization.
In this paper, I will discuss in detail the functionality, limitations, and configuration of JQA, and I will demonstrate some applications that use JQA to translate user input into SQL, XPath and simple XQuery.
XML version
HTML version
PDF version
SVG version