ZOOM::query and subclasses

YAZ++ User's Guide and Reference
Prev | Chapter 2. ZOOM-C++ | Next

# `ZOOM::query` and subclasses

The `ZOOM::query` class is a virtual base class, representing a query to be submitted to a server. This class has no methods, but two (so far) concrete subclasses, each implementing a specific query notation.

## `ZOOM::prefixQuery`

        class prefixQuery : public query {
        public:
          prefixQuery (const char *pqn);
          ~prefixQuery ();
        };

This class enables a query to be created by compiling YAZ's cryptic but powerful Prefix Query Notation (PQN).

## `ZOOM::CCLQuery`

        class CCLQuery : public query {
        public:
          CCLQuery (const char *ccl, void *qualset);
          ~CCLQuery ();
        };

This class enables a query to be created using the simpler but less expressive Common Command Language (CCL). The qualifiers recognised by the CCL parser are specified in an external configuration file in the format described by the YAZ documentation.

If query construction fails for either type of `query` object - typically because the query string itself is not valid PQN or CCL - then an `exception` is thrown.

## Discussion

It will be readily recognised that these objects have no methods other than their constructors: their only role in life is to be used in searching, by being passed to the `resultSet` class's constructor.

Given a suitable set of CCL qualifiers, the following pairs of queries are equivalent:

        prefixQuery("dinosaur");
        CCLQuery("dinosaur");

        prefixQuery("@and complete dinosaur");
        CCLQuery("complete and dinosaur");

        prefixQuery("@and complete @or dinosaur pterosaur");
        CCLQuery("complete and (dinosaur or pterosaur)");

        prefixQuery("@attr 1=7 0253333490");
        CCLQuery("isbn=0253333490");

## References

- Section 3.3 (Query) of the ZOOM Abstract API

- The Queries section of the ZOOM-C documentation

Prev | Home | Next
`ZOOM::connection` | Up | `ZOOM::resultSet`