Implementing SRWU and CQL Tools 1 Implementing a

  • Slides: 12
Download presentation
Implementing SRW/U and CQL: Tools 1. Implementing a simple SRU client 2. Implementing “serious”

Implementing SRW/U and CQL: Tools 1. Implementing a simple SRU client 2. Implementing “serious” SRW and SRU clients 3. Implementing SRW and SRU servers 4. Implementing CQL – a Common Query Language Mike Taylor <mike@indexdata. com>

Implementing a simple SRU client <form method="get" action="http: //z 3950. loc. gov: 7090/voyager"> Query:

Implementing a simple SRU client <form method="get" action="http: //z 3950. loc. gov: 7090/voyager"> Query: <input type="text" name="query" size="40"/><br/> First record: <input type="text" name="start. Record" size="10" value="1"/><br/> Number of records: <input type="text" name="maximum. Records" size="10" value="1"/><br/> Schema: <select name="record. Schema" size="1"> <option value="marcxml">Marc. XML</option> <option value="dc" selected="selected">Dublin Core</option> <option value="mods">MODS</option> </select> <input type="hidden" name="version" value="1. 1"/> <input type="hidden" name="operation" value="search. Retrieve"/> CQL – a Common Language <input Query type="submit" value="Search"/> Mike Taylor <mike@indexdata. com>

Implementing “serious” SRW/U clients There are three basic approaches: 1. Hand-roll SRU URLs or

Implementing “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 <mike@indexdata. com>

Implementing “serious” SRW/U clients There are three basic approaches: 1. Hand-roll SRU URLs or

Implementing “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 <mike@indexdata. com>

SRW/U client toolkits: ZOOM is a “standard” abstract API for information retrieval. http: //zoom.

SRW/U client toolkits: ZOOM is a “standard” abstract API for information retrieval. http: //zoom. z 3950. org/ It was originally conceived to lower the barrier to Z 39. 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 Z 39. 50, all these free IR-client toolkits inherit this ability. CQL – a Common Query Language Mike Taylor <mike@indexdata. com>

ZOOM examples: C++ #include <iostream> #include "zoom. hh" using namespace ZOOM; int main (int

ZOOM examples: C++ #include <iostream> #include "zoom. hh" using namespace ZOOM; int main (int argc, char **argv) { connection conn ("http: //z 3950. loc. gov: 7090/voyager”); result. Set rs (conn, simple. Query ("isbn=0253333490")); const record &rec = rs. get. Record (0); cout << rec. render () << endl; } CQL – a Common Query Language Mike Taylor <mike@indexdata. com>

ZOOM examples: Visual Basic Set zoom = WScript. Create. Object("VBZOOM. Zoom. Factory") Set zconn

ZOOM examples: Visual Basic Set zoom = WScript. Create. Object("VBZOOM. Zoom. Factory") Set zconn = zoom. Create. Zoom. Connection( "http: //z 3950. loc. gov: 7090/voyager”) Set zquery = zoom. Create. Zoom. Query("@attr 1=7 0253333490") Set zrs = zconn. Search(zquery) WScript. Echo zrs. Get. Record(0). Render. Record CQL – a Common Query Language Mike Taylor <mike@indexdata. com>

ZOOM examples: Scheme (define main (lambda (args) (let ((conn (zoom: connection_new "http: //z 3950.

ZOOM examples: Scheme (define main (lambda (args) (let ((conn (zoom: connection_new "http: //z 3950. loc. gov: 7090/Voyager" 0))) (let* ((r (zoom: connection_search_pqf conn "@attr 1=7 0253333490")) (rec (zoom: record_get (zoom: resultset_record r 0) "render"))) (if (pair? rec) (display (car rec))) 0))) ) CQL – a Common Query Language Mike Taylor <mike@indexdata. com>

ZOOM examples: Scheme (define main (lambda (args) (let ((conn (zoom: connection_new "http: //z 3950.

ZOOM examples: Scheme (define main (lambda (args) (let ((conn (zoom: connection_new "http: //z 3950. loc. gov: 7090/Voyager" 0))) (let* ((r (zoom: connection_search_pqf conn "@attr 1=7 0253333490")) (rec (zoom: record_get (zoom: resultset_record r 0) "render"))) (if (pair? rec) (display (car rec))) 0))) ) D R I E W CQL – a Common Query Language Mike Taylor <mike@indexdata. com>

Implementing SRW/U servers I only know of two dedicated SRW/U server toolkits: * Our

Implementing 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 <mike@indexdata. com>

Implementing CQL “Implementing” CQL consists of two separate parts: 1. Parsing the query string

Implementing 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. z 3950. 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 <mike@indexdata. com>

What to take away * It's trivially easy to write an SRU client as

What 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 <mike@indexdata. com>