Mike Taylor
<mike@miketaylor.org.uk>
14th April 2005.
This web-site contains super-simple implementations of both a client and a server for the ANSI/NISO-registered search-and-retrieve protocol SRU:
The client is merely an HTML form that generates and submits an
SRU-compliant URL to a nominated server. You can use it to send
queries either to
the Library of Congress SRU server
or
the very simple local one.
The only difference is the action in the HTML form.
View the client source-code.
(There is also a much shorter and uglier version of this form,
the truly trivial client, configured
to search the local database.)
View the trivial client source-code.
The server is a CGI script, written in Perl, that runs under the
Apache web browser. It is 183 lines long, or 136 lines if
comments and blank lines are ignored. It uses the
CGI
module to decode the HTTP query into parameters, and the
CQL::Parser
module to parse the query language. Then it descends through the
tree of query nodes to determine which of the set of candidate
records satisfies the query.
View the server source-code.
The database consists a small set of records harvested from the Library of Congress database; the records themselves are merely Dublin Core XML records held in text files in a well-known place. Matching of terms is done by a case-insensitive regular expression match. This ``toy'' back-end to the simple SRU server can easily be replaced by calls into a real database.
Use a simple form to search using the universal SRU-to-WebForm gateway. [More details to follow]
The entire content of this site, including both the web-pages and the code of the SRU server itself, is licenced under the Creative Commons ``by'' licence. You are free to copy, distribute and distribute the code, to make derivative works and to make commercial use of the work; your only obligation is to give the original author credit. [details]