Title: CQL
1Implementing SRW/U and CQL Tools
- Implementing a simple SRU client
- Implementing serious SRW and SRU clients
- Implementing SRW and SRU servers
- Implementing CQL
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
2Implementing a simple SRU client
ltform method"get" action"http//z3950.loc.gov70
90/voyager"gt Query ltinput type"text"
name"query" size"40"/gtltbr/gt First record
ltinput type"text" name"startRecord" size"10"
value"1"/gtltbr/gt Number of records
ltinput type"text" name"maximumRecords"
size"10" value"1"/gtltbr/gt Schema
ltselect name"recordSchema" size"1"gt
ltoption value"marcxml"gtMarcXMLlt/optiongt
ltoption value"dc" selected"selected"gtDublin
Corelt/optiongt ltoption value"mods"gtMODSlt/o
ptiongt lt/selectgt ltinput type"hidden"
name"version" value"1.1"/gt ltinput
type"hidden" name"operation" value"searchRetrie
ve"/gt ltinput type"submit" value"Search"/gt lt/
formgt
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
3Implementing serious SRW/U clients
There are three basic approaches 1. Hand-roll
SRU URLs or SRW SOAP packets. 2. Use a SOAP
toolkit with the SRW WSDL. 3. Use an SRW/U
client toolkit.
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
4Implementing serious SRW/U clients
There are three basic approaches 1. Hand-roll
SRU URLs or SRW SOAP packets. 2. Use a SOAP
toolkit with the SRW WSDL. (There are far too
many acronyms in these approaches) 3. Use an
SRW/U client toolkit. You don't need me to tell
you how to build URLs, and I couldn't tell you
about SOAP toolkits if I wanted to. So we will
concentrate on SRW/U client toolkits.
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
5SRW/U client toolkits ZOOM
ZOOM is a standard abstract API for information
retrieval. http//zoom.z3950.org/ It was
originally conceived to lower the barrier to
Z39.50. Many of the ZOOM implementations in
high-level languages are built on top of Index
Data's ZOOM-C implementation (C, Visual Basic,
Scheme, Ruby, C and all .NET languages) Since
ZOOM-C can now speak SRW/U as well as Z39.50,
all these free IR-client toolkits inherit this
ability.
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
6ZOOM examples C
include ltiostreamgt include "zoom.hh" using
namespace ZOOM int main (int argc, char
argv) connection conn ("http//z3950.loc.gov
7090/voyager) resultSet rs (conn,
simpleQuery ("isbn0253333490")) const record
rec rs.getRecord (0) cout ltlt rec.render ()
ltlt endl
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
7ZOOM examples Visual Basic
Set zoom WScript.CreateObject("VBZOOM.ZoomFactor
y") Set zconn zoom.CreateZoomConnection( "http
//z3950.loc.gov7090/voyager) Set zquery
zoom.CreateZoomQuery("_at_attr 17 0253333490") Set
zrs zconn.Search(zquery) WScript.Echo
zrs.GetRecord(0).RenderRecord
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
8ZOOM examples Scheme
(define main (lambda (args) (let
((conn (zoomconnection_new
"http//z3950.loc.gov7090/Voyager" 0)))
(let ((r (zoomconnection_search_p
qf conn "_at_attr 17
0253333490")) (rec
(zoomrecord_get
(zoomresultset_record r 0)
"render"))) (if (pair?
rec) (display (car rec)))
0))) )
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
9ZOOM examples Scheme
(define main (lambda (args) (let
((conn (zoomconnection_new
"http//z3950.loc.gov7090/Voyager" 0)))
(let ((r (zoomconnection_search_p
qf conn "_at_attr 17
0253333490")) (rec
(zoomrecord_get
(zoomresultset_record r 0)
"render"))) (if (pair?
rec) (display (car rec)))
0))) )
WEIRD
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
10Implementing SRW/U servers
I only know of two dedicated SRW/U server
toolkits Our own Generic Frontend Server
(GFS), found in the YAZ toolkit
(http//indexdata.com/yaz) OCLC's Open Source
SRW Java classes. Most SRW/U server
implementations seem to use SOAP toolkits such as
Apache Axis. Once a toolkit handles the
marshalling, the most complex part of
implementing SRW/U is the query handling.
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
11Implementing CQL
Implementing CQL consists of two separate
parts 1. Parsing the query string into a simple
representations 2. Executing that representation
against your back-end Free parsers are available
for Java, C/C, Python, Perl and Visual Basic.
See http//zing.z3950.org/cql/ These produce
trees of objects in their respective
languages, each object representing a node of the
parse-tree, e.g. an index-relation-term triple or
an AND of two subtrees. (But no toolkit can help
you with the second of these tasks, as it depends
on what your back-end is.)
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt
12What to take away
It's trivially easy to write an SRU client as
an HTML form. ZOOM provides free toolkits for
creating clients in many languages. The YAZ
Generic Front-end Server, and the OCLC Open
Source SRW classes, help to build clients.
SOAP toolkits can be used (but don't ask me for
support). Free CQL implementations are
available for many languages.
CQL a Common Query Language
Mike Taylor ltmike_at_indexdata.comgt