15.1 The Role of Query Languages

Building Parsers with Java
By Steven  John  Metsker

Table of Contents
Chapter  15.   Parsing a Query Language


Query languages, particularly SQL (Structured Query Language), represent a powerful force in applied computer science. Few businesses operate without a database, and every commercial database includes some form of a query language for retrieving data. The basic idea of SQL is that a query language empowers users to pose questions about data that no developer has foreseen. When you develop your own query language, you provide your users with this ability. Users of your language can derive new results without writing Java, and indeed without feeling as if they are "programming" at all.

The object that makes query languages possible is an engine. An engine knows how to answer a query, and it knows how to look through a collection of data. The groundwork for creating a query language includes acquiring an engine, making your data accessible to the engine, and writing a parser to translate your users' textual queries into engine queries. To provide your users access to the engine's power, you can package access to your parser in a user interface. When your user enters a query, you parse the query, feed the query to the engine, and display the engine results. An engine plus a query language is one of the most powerful tools you can provide your user .

To create new query languages, you do not need a database. What you need is an engine, and the one in sjm.engine may suffice for your purposes. If you need a stronger engine, you can improve the code in sjm.engine or acquire an engine in some other way. With an engine in hand, you can create a query language parser and provide your users with the ability to issue ad hoc queries, posing questions about whatever objects are important in your domain.


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

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