[ You are here:
XTF ->
Experimental Features -> SRU Servlet ]
SRU Servlet
XTF currently contains an experimental servlet that provides exposes a Zing SRW/SRU interface to an XTF repository. Here's a description taken from the
Zing web page:
Executive Summary: SRW/U is a low-barrier solution to information retrieval. The SRW/U protocol uses easily available technologies -- XML, SOAP, HTTP, URI -- to perform tasks traditionally done using proprietary solutions; it can be carried either via SOAP (SRW) or as a URL (SRU).
SRW/U allows users to search remote databases. A user sends a
searchRetrieve request which includes a query, and the server responds with a
searchRetrieve response indicating the number of records that matched the query, possibly along with some of those records formatted according to an XML schema that the user requested.
The query is represented in CQL, the "Common Query Language", designed for human readable, human writable, intuitive queries. It supports very simple queries -- for example an unqualified single term (e.g. "cat") -- but maintains the expressiveness of more complex languages, to represent arbitrarily complex queries.
The idea here is to make an XTF document repository searchable using the SRU protocol (SRU was simpler to implement than SRW.) This will hopefully allow XTF to play well in a larger world of aggregated repositories and meta-searchers.
Current development plans involve folding the SRU servlet into crossQuery, once support for CQL has been fully integrated. The stylesheets will then recognize SRU queries by their unique URL parameters and redirect to special query parsing and formatting.
As with everything else in XTF, SRU support is provided through cooperation between a Java servlet and several XSLT stylesheets. The SRU servlet operation is almost identical to
crossQuery; refer to the diagram below.

Here are the important ways that SRU servlet operation differs from crossQuery:
- The incoming query URL should obey SRU specifications, and in particular must specify a query in CQL syntax. Typically the URL will also specify an SRU version and an operation to perform (the default operation is searchRetrieve.) Here's a sample URL that talks to the SRU servlet:
http://yourserver:8080/xtf/SRU?operation=searchRetrieve;query=dc.title=apartheid
(Of course, you should adjust the port number and server name according to your own installed servlet container.)
- The SRU servlet uses a different set of stylesheets. It has its own Query Parser and Result Formatter stylesheets, located in the style/SRU subdirectory of the XTF installation. Also, the servlet has its own configuration file, found here: conf/sru.conf
- The input to the SRU Query Parser stylesheet is slightly different. The parameters are all tokenized as normal, but additional parsing is performed on the query parameter: it is parsed as a CQL query. This results in an XCQL query (that is, XML formatted CQL), and this is added to the <parameter> block for the query parameter. The query parser does the work of transforming XCQL to a valid XTF query.
- The output of the SRU Result Formatter stylesheet isn't an HTML web page, but rather an XML search result, obeying the SRW specification for results.
Here's some sample output from the SRU servlet:
<?xml version="1.0" encoding="UTF-8"?>
<srw:searchRetrieveResponse xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:srw="http://www.loc.gov/zing/srw/">
<srw:version>1.1</srw:version>
<srw:numberOfRecords>1</srw:numberOfRecords>
<srw:records>
<srw:record>
<srw:recordPacking>XML</srw:recordPacking>
<srw:recordSchema>info:srw/schema/1/dc-v1.1</srw:recordSchema>
<srw:recordData>
<srw_dc:dc xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/z3950/agency/zing/srw/dc-schema.xsd">
<dc:title>The Opening of the Apartheid Mind: Options for the New South Africa</dc:title>
<dc:creator>Heribert Adam and Kogila Moodley</dc:creator>
<dc:subject>African Studies</dc:subject>
<dc:subject>Politics</dc:subject>
<dc:subject>African History</dc:subject>
<dc:description>Refusing to be governed by what is fashionable or inoffensive, Heribert Adam and Kogila Moodley frankly address the passions and rationalities that drive politics in post-apartheid South Africa...</dc:description>
<dc:date>6/28/1993</dc:date>
<dc:type>text</dc:type>
<dc:identifier>http://ark.cdlib.org/ark:/13030/ft958009mm</dc:identifier>
<dc:relation>http://www.ucpress.edu/</dc:relation>
<dc:relation>http://escholarship.cdlib.org/</dc:relation>
<dc:rights>Public</dc:rights>
</srw_dc:dc>
</srw:recordData>
</srw:record>
</srw:records>
<srw:echoedSearchRetrieveRequest>
<srw:version>1.1</srw:version>
<srw:query>dc.title=apartheid</srw:query>
<srw:startRecord>1</srw:startRecord>
<srw:maximumRecords>20</srw:maximumRecords>
<srw:recordPacking>xml</srw:recordPacking>
<srw:recordSchema>dc</srw:recordSchema>
</srw:echoedSearchRetrieveRequest>
</srw:searchRetrieveResponse>
The servlet query parser knows how to respond to the
explain and
searchRetrieve operations. It supports only
version 1.1 of the SRU protocol, and requires
recordPacking to be xml and
recordSchema to be dc (these are the defaults, so they are optional in the URL.) Other values will produce an appropriate SRU error result.
For further information, you may peruse the stylesheets and the
SRW/SRU web page. Comments and improvements are welcome.