1 <!-- $Id: client.xml,v 1.2 2001-08-13 09:42:54 adam Exp $ -->
2 <chapter><title>The YAZ client</title>
3 <sect1><title>Introduction</title>
5 yaz-client is a line-mode Z39.50 client. It supports a fair amount
6 of the functionality of the Z39.50-1995 standard, but some things you
7 need to enable or disable by re-compilation.
8 Its primary purpose is to exercise the
9 package, and verify that the protocol works OK.
10 For the same reason some commands offers more functionality than others.
11 Commands that exercises common Z39.50 services such as search and present
12 have more features than less common supported services, such as Extended
13 Services (ItemOrder, ItemUpdate,..).
16 <sect1><title>Invoking the YAZ client</title>
18 It can be started by typing
21 yaz-client [<replaceable>options</replaceable>] [<replaceable>zurl</replaceable>]
24 in a UNIX shell / WIN32 console. The <replaceable>zurl</replaceable>,
25 specifies a Z39.50 host and, if specified, the client first tries to
26 establish connection with the Z39.50 target on the host.
27 Options are, as usual, are prefixed by <literal>-</literal> followed
28 by a particular letter.
31 The following options are supported:
35 <literal>-m</literal> <replaceable>fname</replaceable>
37 <simpara>ISO2709 records are appended to file
38 <replaceable>fname</replaceable>. All records as returned by a target(s)
39 in Search Responses and Present Responses are appended verbatim to
44 <literal>-a</literal> <replaceable>fname</replaceable>
46 <simpara>Pretty-print log of APDUs sent and received is appended
47 to the file <replaceable>fname</replaceable>.
48 If <replaceable>fname</replaceable> is <literal>-</literal> (minus)
49 the APDU log is written to <literal>stderr</literal>.
53 <literal>-c</literal> <replaceable>fname</replaceable>
55 <simpara>Sets the filename for CCL fields to
56 <replaceable>fname</replaceable>. If this option is not given the
57 YAZ client reads CCL fields from file <literal>default.bib</literal>.
61 <literal>-v</literal> <replaceable>level</replaceable>
63 <simpara>Sets the LOG level to <replaceable>level</replaceable>.
64 Level is a sequence of tokens separated by comma. Each token
65 is a integer or a named LOG item - one of
66 <literal>fatal</literal>,
67 <literal>debug</literal>,
68 <literal>warn</literal>,
69 <literal>log</literal>,
70 <literal>all</literal>,
71 <literal>none</literal>.
76 In order to connect to Index Data's test Z39.50 server on
77 <literal>bagel.indexdata.dk</literal>, port 210 and with the
78 database name marc, one would have to type
81 yaz-client bagel.indexdata.dk:210/marc
84 In order to enable APDU log and connect to localhost, port 210 (default)
85 and database Default (default) you'd write:
88 yaz-client -a - localhost
91 <sect1><title>YAZ client commands</title>
93 When the YAZ client has read options and connected to a target, if given,
94 it will display <literal>Z ></literal> and away your command.
95 Commands are executed by hitting the return key.
96 You can always issue the command <literal>?</literal> to see the list
97 of available commands.
100 The commands are (the letters in parenthesis are short
101 names for the commands):
105 <literal>open </literal><replaceable>zurl</replaceable>
107 <term><literal>o</literal></term>
109 <para>Opens a connection to a server. The syntax for
110 <replaceable>zurl</replaceable> is the same as described
111 above for connecting from the command line.
117 [<literal>(tcp|osi)':'</literal><[<replaceable>tsel/</replaceable>]]<replaceable>host</replaceable>[:<replaceable>port</replaceable>][/<replaceable>base></replaceable>]
122 <literal>quit</literal>
124 <term><literal>q</literal></term>
126 <para>Ends YAZ client</para>
130 <literal>f </literal><replaceable>query</replaceable></term>
131 <term><literal>f</literal></term>
133 <para>Sends Search Request using the <replaceable>query</replaceable>
139 <literal>delete</literal> <replaceable>setname</replaceable></term>
141 <para>Deletes result set with name <replaceable>setname</replaceable>
142 on the server.</para>
146 <literal>base </literal><replaceable>base1</replaceable>
147 <replaceable>base2</replaceable> ...
150 <para>Sets the name(s) of the database(s) to search. One or more
151 databases may be specified separated by blanks. This commands overrides
152 the database given in <replaceable>zurl</replaceable>.
157 <literal>show </literal> [<replaceable>start</replaceable>[+<replaceable>number</replaceable>]]
159 <term><literal>s</literal></term>
161 <para>Fetches records by sending a Present Request from the start
163 <replaceable>start</replaceable>
164 a number of records given by <replaceable>number</replaceable>. If
165 <replaceable>start</replaceable> is not given the client will
166 fetch from position of the last retrieved record plus 1. If
167 <replaceable>number</replaceable> is not given one record will be
173 <literal>scan</literal> <replaceable>term</replaceable>
177 database index for a term. The syntax resembles the syntax
178 for <literal>find</literal>.
179 If you want to scan for the word <literal>water</literal> you could
186 but if you want to scan only in, say the title field, you would write
194 <literal>sort</literal> <replaceable>sortspecs</replaceable>
197 <para>Sorts a result set. The sort command takes a sequence of
198 sort specifications. A sort
199 specification holds a field (sort criteria) and is followed by flags.
200 If the sort criteria includes <literal>=</literal> it is assumed
201 that the sort SortKey is of type sortAttributes using Bib-1.
202 The integer before <literal>=</literal> is
203 the attribute type and the integer following <literal>=</literal>
204 is the attribute value.
205 If no <literal>=</literal> is in the SortKey it is treated as a
206 sortfield-type of type InternationalString.
207 Flags observed are: <literal>s</literal>
208 for case sensitive, <literal>i</literal> for case insensitive,
209 <literal><</literal> for sort ascending and <literal>></literal>
215 <literal>sort+</literal>
218 <para>Same as <literal>sort</literal> but stores the sorted
219 result set in a new result set.
224 <literal>authentication</literal> <replaceable>openauth</replaceable>
227 <para>Sets up a authentication string if a server requires
228 authentication (v2 OpenStyle). The authentication string is first
229 sent to the server when the <literal>open</literal> command is
230 issued and the Z39.50 Initialize Request is sent, so this command
231 must be used before <literal>open</literal> in order to be effective.
236 <literal>lslb</literal> <replaceable>n</replaceable>
239 <para>Sets the limit for when no records should be returned
240 together with the search result.
243 url="http://lcweb.loc.gov/z3950/agency/markup/04.html#3.2.2.1.6">
252 <literal>ssub</literal> <replaceable>n</replaceable>
255 <para>Sets the limit for when all records should be returned with
259 url="http://lcweb.loc.gov/z3950/agency/markup/04.html#3.2.2.1.6">
261 </ulink> for more details.
267 <literal>mspn</literal> <replaceable>n</replaceable>
270 <para>Sets the number of records should be returned if the
271 number of records in the result set is between the values of
272 <literal>lslb</literal> and <literal>ssub</literal>.
275 url="http://lcweb.loc.gov/z3950/agency/markup/04.html#3.2.2.1.6">
283 <literal>status</literal>
286 <para>Displays the values of <literal>lslb</literal>,
287 <literal>ssub</literal> and <literal>mspn</literal>.
292 <literal>setname</literal>
295 <para>Switches named result sets on and off. Default is on.
300 <literal>cancel</literal>
303 <para>Sends a Trigger Resource Control Request to the target.
308 <literal>format</literal> <replaceable>oid</replaceable>
311 <para>Sets the preferred transfer syntax for retrieved records.
312 yaz-client supports all the record syntaxes that currently
315 url="http://lcweb.loc.gov/z3950/agency/defns/oids.html#5">
318 for more details. Commonly used records syntaxes include usmarc,
324 <literal>elements</literal> <replaceable>e</replaceable>
327 <para>Sets the element set name for the records. Many targets support
328 element sets are B (for brief) and F (for full).
333 <literal>close</literal>
336 <para>Sends a Z39.50 Close APDU and closes connection with the peer
341 <literal>querytype</literal> <replaceable>type</replaceable>
344 <para>Sets the query type as used by command <literal>find</literal>.
345 The following is supported: <literal>prefix</literal> for
346 <link linkend="PQF">Prefix Query Notation</link> (Type-1 Query);
347 <literal>ccl</literal> for CCL search (Type-2
348 Query) or <literal>ccl2rpn</literal> for
349 <link linkend="CCL">CCL</link> to RPN conversion (Type-1 Query).
354 <literal>attributeset</literal> <replaceable>set</replaceable>
358 Sets attribute set OID for prefix queries (RPN, Type-1).
363 <literal>refid</literal> <replaceable>id</replaceable>
366 <para>Sets reference ID for Z39.50 Request(s).
371 <literal>itemorder</literal>
372 <replaceable>type</replaceable> <replaceable>no</replaceable>
375 <para>Sends an Item Order Request using the ILL External.
376 <replaceable>type</replaceable> is either 1 or 2 which corresponds to
377 ILL-Profile 1 and 2 respectively. The <replaceable>no</replaceable>
378 is the Result Set position of the record to be ordered.
383 <literal>update</literal>
386 <para>Sends Item Update Request. This command sends a "minimal"
387 PDU to the target supplying the last received record from the target.
388 If no record has been received from the target this command is ignored
389 and nothing is sent to the target.
395 <sect1><title>Searching</title>
397 The simplest example of a Prefix Query would be something like
405 In those queries no attributes was specified.
406 This leaves it up to the server what fields to search but
407 most servers will search in all fields. Some servers does not
408 support this feature though, and require that some attributes
409 are defined. To add one attribute you could do:
413 where we search in the title field, since the use(1) is title(4).
414 If we want to search in the author field <emphasis>and</emphasis>
415 in the title field, and in the title field using right truncation
416 it could look something like this:
418 f @and @attr 1=1003 knuth @attr 1=4 @attr 5=1 computer
420 Finally using a mix of Bib-1 and GILS attributes could look
423 f @attrset Bib-1 @and @attr GILS 1=2008 Washington @attr 1=21 weather
425 For the full specification of the Prefix Query see the section
426 <link linkend="PQF">Prefix Query Format</link>.
431 <!-- Keep this comment at the end of the file
436 sgml-minimize-attributes:nil
437 sgml-always-quote-attributes:t
440 sgml-parent-document: "yaz.xml"
441 sgml-local-catalogs: "../../docbook/docbook.cat"
442 sgml-namecase-general:t