2. SRU and SRW Protocol Support and Behavior

Zebra running as an SRU server supports SRU version 1.1, including CQL version 1.1. In particular, it provides support for the following elements of the protocol.

2.1. Search and Retrieval

Zebra fully supports SRU's core searchRetrieve operation, as described at http://www.loc.gov/standards/sru/sru-spec.html

One of the great strengths of SRU is that it mandates a standard query language, CQL, and that all conforming implementations can therefore be trusted to correctly interpret the same queries. It is with some shame, then, that we admit that Zebra also supports an additional query language, our own Prefix Query Format (PQF, http://indexdata.com/yaz/doc/tools.tkl#PQF). A PQF query is submitted by using the extension parameter x-pquery, in which case the query parameter must be omitted, which makes the request not valid SRU. Please don't do this.

2.2. Scan

Zebra supports SRU's scan operation, as described at http://www.loc.gov/standards/sru/scan/. Scanning using CQL syntax is the default, where the standard scanClause parameter is used.

In addition, a mutant form of SRU scan is supported, using the non-standard x-pScanClause parameter in place of the standard scanClause to scan on a PQF query clause.

2.3. Explain

Zebra fully supports SRU's core explain operation, as described at http://www.loc.gov/standards/sru/explain/index.html

The ZeeRex record explaining a database may be requested either with a fully fledged SRU request (with operation=explain and version-number specified) or with a simple HTTP GET at the server's basename. The ZeeRex record returned in response is the one embedded in the YAZ Frontend Server configuration file that is described in the Virtual Hosts documentation.

Unfortunately, the data found in the CQL-to-PQF text file must be added by hand-craft into the explain section of the YAZ Frontend Server configuration file to be able to provide a suitable explain record. Too bad, but this is all extreme new alpha stuff, and a lot of work has yet to be done ..

There is no linkeage whatsoever between the Z39.50 explain model and the SRU/SRW explain response (well, at least not implemented in Zebra, that is ..). Zebra does not provide a means using Z39.50 to obtain the ZeeRex record.

2.4. Some SRU Examples

Surf into http://localhost:9999 to get an explain response, or use

      http://localhost:9999/?version=1.1&operation=explain
     

See number of hits for a query

       http://localhost:9999/?version=1.1&operation=searchRetrieve
                       &query=text=(plant%20and%20soil)
     

Fetch record 5-7 in Dublin Core format

       http://localhost:9999/?version=1.1&operation=searchRetrieve
                       &query=text=(plant%20and%20soil)
                       &startRecord=5&maximumRecords=2&recordSchema=dc
     

Even search using PQF queries using the extended naughty verb x-pquery

      http://localhost:9999/?version=1.1&operation=searchRetrieve
                       &x-pquery=@attr%201=text%20@and%20plant%20soil
     

Or scan indexes using the extended extremely naughty verb x-pScanClause

      http://localhost:9999/?version=1.1&operation=scan
                       &x-pScanClause=@attr%201=text%20something
     

Don't do this in production code! But it's a great fast debugging aid.

2.5. Initialization, Present, Sort, Close

In the Z39.50 protocol, Initialization, Present, Sort and Close are separate operations. In SRU, however, these operations do not exist.

  • SRU has no explicit initialization handshake phase, but commences immediately with searching, scanning and explain operations.

  • Neither does SRU have a close operation, since the protocol is stateless and each request is self-contained. (It is true that multiple SRU request/response pairs may be implemented as multiple HTTP request/response pairs over a single persistent TCP/IP connection; but the closure of that connection is not a protocol-level operation.)

  • Retrieval in SRU is part of the searchRetrieve operation, in which a search is submitted and the response includes a subset of the records in the result set. There is no direct analogue of Z39.50's Present operation which requests records from an established result set. In SRU, this is achieved by sending a subsequent searchRetrieve request with the query cql.resultSetId=id where id is the identifier of the previously generated result-set.

  • Sorting in CQL is done within the searchRetrieve operation - in v1.1, by an explicit sort parameter, but the forthcoming v1.2 or v2.0 will most likely use an extension of the query language, CQL for sorting: see http://zing.z3950.org/cql/sorting.html

It can be seen, then, that while Zebra operating as an SRU server does not provide the same set of operations as when operating as a Z39.50 server, it does provide equivalent functionality.