15.4 Building a Query Language Environment


 
Building Parsers with Java
By Steven  John  Metsker

Table of Contents
Chapter  15.   Parsing a Query Language

    Content

Figure 15.11 shows the elements of a query language.

Figure 15.11. The elements of a query language. A user interface for a query language passes a textual query to a parser, which translates the text into an engine query. The user interface asks the engine to prove the query, something it does by drawing on facts that come from an object model.

graphics/15fig11.gif

The motivation for a query language begins with an object model and a desire to let a user issue ad hoc questions about the data in the model.The engine expects queries to arrive as query objects, so you need a strategy for translating a select statement into an engine query. The following section covers translating user queries to engine queries.

As the parser works through the user's textual query, the parser will discover parts of an engine query. You need a builder to help store progress in building the engine query. As you build, you use a speller object to verify that the query refers only to table names and variable names that occur in the object model. A pair of sections covers a query builder and a speller.

After covering these supporting classes, this chapter describes how to write a grammar for Jaql, write assemblers to build an engine query, and generate the parser from the grammar, plugging in the assemblers.

The chapter concludes with a discussion of the user environment, focusing on the UE's ability to help the user solve problems in incorrect queries.


   
Top


Building Parsers with Java
Building Parsers With Javaв„ў
ISBN: 0201719622
EAN: 2147483647
Year: 2000
Pages: 169

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net