node-zoom
Version:
197 lines (194 loc) • 13.5 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>6.�Retrieval Facility</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="tools.html" title="Chapter�7.�Supporting Tools"><link rel="prev" href="marc.html" title="5.�MARC"><link rel="next" href="sorting.html" title="7.�Sorting"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6.�Retrieval Facility</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="marc.html">Prev</a>�</td><th width="60%" align="center">Chapter�7.�Supporting Tools</th><td width="20%" align="right">�<a accesskey="n" href="sorting.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tools.retrieval"></a>6.�Retrieval Facility</h2></div></div></div><p>
YAZ version 2.1.20 or later includes a Retrieval facility tool
which allows a SRU/Z39.50 to describe itself and perform record
conversions. The idea is the following:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
An SRU/Z39.50 client sends a retrieval request which includes
a combination of the following parameters: syntax (format),
schema (or element set name).
</p></li><li class="listitem"><p>
The retrieval facility is invoked with parameters in a
server/proxy. The retrieval facility matches the parameters a set of
"supported" retrieval types.
If there is no match, the retrieval signals an error
(syntax and / or schema not supported).
</p></li><li class="listitem"><p>
For a successful match, the backend is invoked with the same
or altered retrieval parameters (syntax, schema). If
a record is received from the backend, it is converted to the
frontend name / syntax.
</p></li><li class="listitem"><p>
The resulting record is sent back the client and tagged with
the frontend syntax / schema.
</p></li></ul></div><p>
</p><p>
The Retrieval facility is driven by an XML configuration. The
configuration is neither Z39.50 ZeeRex or SRU ZeeRex. But it
should be easy to generate both of them from the XML configuration.
(unfortunately the two versions
of ZeeRex differ substantially in this regard).
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="tools.retrieval.format"></a>6.1.�Retrieval XML format</h3></div></div></div><p>
All elements should be covered by namespace
<code class="literal">http://indexdata.com/yaz</code> .
The root element node must be <code class="literal">retrievalinfo</code>.
</p><p>
The <code class="literal">retrievalinfo</code> must include one or
more <code class="literal">retrieval</code> elements. Each
<code class="literal">retrieval</code> defines specific combination of
syntax, name and identifier supported by this retrieval service.
</p><p>
The <code class="literal">retrieval</code> element may include any of the
following attributes:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">syntax</code> (REQUIRED)</span></dt><dd><p>
Defines the record syntax. Possible values is any
of the names defined in YAZ' OID database or a raw
OID in (n.n ... n).
</p></dd><dt><span class="term"><code class="literal">name</code> (OPTIONAL)</span></dt><dd><p>
Defines the name of the retrieval format. This can be
any string. For SRU, the value, is equivalent to schema (short-hand);
for Z39.50 it's equivalent to simple element set name.
For YAZ 3.0.24 and later this name may be specified as a glob
expression with operators
<code class="literal">*</code> and <code class="literal">?</code>.
</p></dd><dt><span class="term"><code class="literal">identifier</code> (OPTIONAL)</span></dt><dd><p>
Defines the URI schema name of the retrieval format. This can be
any string. For SRU, the value, is equivalent to URI schema.
For Z39.50, there is no equivalent.
</p></dd></dl></div><p>
</p><p>
The <code class="literal">retrieval</code> may include one
<code class="literal">backend</code> element. If a <code class="literal">backend</code>
element is given, it specifies how the records are retrieved by
some backend and how the records are converted from the backend to
the "frontend".
</p><p>
The attributes, <code class="literal">name</code> and <code class="literal">syntax</code>
may be specified for the <code class="literal">backend</code> element. These
semantics of these attributes is equivalent to those for the
<code class="literal">retrieval</code>. However, these values are passed to
the "backend".
</p><p>
The <code class="literal">backend</code> element may includes one or more
conversion instructions (as children elements). The supported
conversions are:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">marc</code></span></dt><dd><p>
The <code class="literal">marc</code> element specifies a conversion
to - and from ISO2709 encoded MARC and
<a class="ulink" href="http://www.loc.gov/standards/marcxml/" target="_top"><acronym class="acronym">MARCXML</acronym></a>/MarcXchange.
The following attributes may be specified:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">inputformat</code> (REQUIRED)</span></dt><dd><p>
Format of input. Supported values are
<code class="literal">marc</code> (for ISO2709), <code class="literal">xml</code>
(MARCXML/MarcXchange) and <code class="literal">json</code>
(<a class="ulink" href="http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json/" target="_top">MARC-in_JSON</a>).
</p></dd><dt><span class="term"><code class="literal">outputformat</code> (REQUIRED)</span></dt><dd><p>
Format of output. Supported values are
<code class="literal">line</code> (MARC line format);
<code class="literal">marcxml</code> (for MARCXML),
<code class="literal">marc</code> (ISO2709),
<code class="literal">marcxhcange</code> (for MarcXchange),
or <code class="literal">json</code>
(<a class="ulink" href="http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json/" target="_top">MARC-in_JSON </a>).
</p></dd><dt><span class="term"><code class="literal">inputcharset</code> (OPTIONAL)</span></dt><dd><p>
Encoding of input. For XML input formats, this need not
be given, but for ISO2709 based inputformats, this should
be set to the encoding used. For MARC21 records, a common
inputcharset value would be <code class="literal">marc-8</code>.
</p></dd><dt><span class="term"><code class="literal">outputcharset</code> (OPTIONAL)</span></dt><dd><p>
Encoding of output. If outputformat is XML based, it is
strongly recommened to use <code class="literal">utf-8</code>.
</p></dd></dl></div><p>
</p></dd><dt><span class="term"><code class="literal">select</code></span></dt><dd><p>
The <code class="literal">select</code> selects one or more text nodes
and decodes them as XML.
The following attributes may be specified:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">path</code> (REQUIRED)</span></dt><dd><p>
X-Path expression for selecting text nodes.
</p></dd></dl></div><p>
</p><p>
This conversion is available in YAZ 5.8.0 and later.
</p></dd><dt><span class="term"><code class="literal">solrmarc</code></span></dt><dd><p>
The <code class="literal">solrmarc</code> decodes solrmarc records.
It assumes that the input is pure solrmarc text (no escaping)
and will convert all sequences of the form #XX; to a single
character of the hexadecimal value as given by XX. The output,
presumably, is a valid ISO2709 buffer.
</p><p>
This conversion is available in YAZ 5.0.21 and later.
</p></dd><dt><span class="term"><code class="literal">xslt</code></span></dt><dd><p>
The <code class="literal">xslt</code> element specifies a conversion
via <acronym class="acronym">XSLT</acronym>. The following attributes may be specified:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">stylesheet</code> (REQUIRED)</span></dt><dd><p>
Stylesheet file.
</p></dd></dl></div><p>
</p></dd></dl></div><p>
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="tools.retrieval.examples"></a>6.2.�Retrieval Facility Examples</h3></div></div></div><div class="example"><a name="tools.retrieval.marc21"></a><p class="title"><b>Example�7.19.�MARC21 backend</b></p><div class="example-contents"><p>
A typical way to use the retrieval facility is to enable XML
for servers that only supports ISO2709 encoded MARC21 records.
</p><pre class="programlisting">
<retrievalinfo>
<retrieval syntax="usmarc" name="F"/>
<retrieval syntax="usmarc" name="B"/>
<retrieval syntax="xml" name="marcxml"
identifier="info:srw/schema/1/marcxml-v1.1">
<backend syntax="usmarc" name="F">
<marc inputformat="marc" outputformat="marcxml"
inputcharset="marc-8"/>
</backend>
</retrieval>
<retrieval syntax="xml" name="dc">
<backend syntax="usmarc" name="F">
<marc inputformat="marc" outputformat="marcxml"
inputcharset="marc-8"/>
<xslt stylesheet="MARC21slim2DC.xsl"/>
</backend>
</retrieval>
</retrievalinfo>
</pre><p>
This means that our frontend supports:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
MARC21 F(ull) records.
</p></li><li class="listitem"><p>
MARC21 B(rief) records.
</p></li><li class="listitem"><p>
MARCXML records.
</p></li><li class="listitem"><p>
Dublin core records.
</p></li></ul></div><p>
</p></div></div><br class="example-break"><div class="example"><a name="tools.retrieval.marcxml"></a><p class="title"><b>Example�7.20.�MARCXML backend</b></p><div class="example-contents"><p>
SRW/SRU and Solr backends returns records in XML.
If they return MARCXML or MarcXchange, the retrieval module
can convert those into ISO2709 formats, most commonly USMARC
(AKA MARC21).
In this example, the backend returns MARCXML for schema="marcxml".
</p><pre class="programlisting">
<retrievalinfo>
<retrieval syntax="usmarc">
<backend syntax="xml" name="marcxml">
<marc inputformat="xml" outputformat="marc"
outputcharset="marc-8"/>
</backend>
</retrieval>
<retrieval syntax="xml" name="marcxml"
identifier="info:srw/schema/1/marcxml-v1.1"/>
<retrieval syntax="xml" name="dc">
<backend syntax="xml" name="marcxml">
<xslt stylesheet="MARC21slim2DC.xsl"/>
</backend>
</retrieval>
</retrievalinfo>
</pre><p>
This means that our frontend supports:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
MARC21 records (any element set name) in MARC-8 encoding.
</p></li><li class="listitem"><p>
MARCXML records for element-set=marcxml
</p></li><li class="listitem"><p>
Dublin core records for element-set=dc.
</p></li></ul></div><p>
</p></div></div><br class="example-break"></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="tools.retrieval.api"></a>6.3.�API</h3></div></div></div><p>
It should be easy to use the retrieval systems from applications. Refer
to the headers
<code class="filename">yaz/retrieval.h</code> and
<code class="filename">yaz/record_conv.h</code>.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="marc.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="tools.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="sorting.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.�MARC�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�7.�Sorting</td></tr></table></div></body></html>