2 * Copyright (c) 1995-2007, Index Data
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of Index Data nor the names of its contributors
13 * may be used to endorse or promote products derived from this
14 * software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 /* $Id: retrieval.h,v 1.9 2007-02-08 10:51:23 adam Exp $ */
31 * \brief Retrieval Utility
34 #ifndef YAZ_RETRIEVAL_H
35 #define YAZ_RETRIEVAL_H
38 #include <yaz/wrbuf.h>
39 #include <yaz/yconfig.h>
41 #include <yaz/record_conv.h>
45 /** retrieval handle */
46 typedef struct yaz_retrieval_struct *yaz_retrieval_t;
48 /** creates retrieval handle
49 \return retrieval handle
51 YAZ_EXPORT yaz_retrieval_t yaz_retrieval_create(void);
53 /** destroys retrieval handle
54 \param p retrieval handle
56 YAZ_EXPORT void yaz_retrieval_destroy(yaz_retrieval_t p);
58 /** configures retrieval
59 \param p retrieval handle
60 \param node xmlNode pointer (root element of XML config)
64 On failure, use yaz_retrieval_get_error to get error string.
69 <retrieval syntax="usmarc" name="F"/>
70 <retrieval syntax="usmarc" name="B"/>
71 <retrieval syntax="xml" name="marcxml"
72 identifier="info:srw/schema/1/marcxml-v1.1">
73 <backend syntax="usmarc" name="F">
74 <marc inputformat="marc" outputformat="marcxml"
75 inputcharset="marc-8"/>
78 <retrieval syntax="xml" name="dc">
79 <backend syntax="usmarc" name="F">
80 <marc inputformat="marc" outputformat="marcxml"
81 inputcharset="marc-8"/>
82 <xslt stylesheet="MARC21slim2DC.xsl"/>
89 int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *node);
92 /** performs retrieval request based on schema and format
93 \param p retrieval handle
94 \param schema record schema (SRU) / element set name (Z39.50)
95 \param syntax record syntax (format)
96 \param match_schema matched schema (if conversion was successful)
97 \param match_syntax matced syntax OID if conversion was successful)
98 \param rc record conversion reference (if conversion was successful)
99 \param backend_schema backend scchema (if conversion was successful)
100 \param backend_syntax backend syntax (if conversion was successful)
101 \retval 0 success, schema and syntax matches
102 \retval -1 failure, use yaz_retrieval_get_error() for reason
103 \retval 1 schema does not match
104 \retval 2 syntax does not match
105 \retval 3 both match but not together
108 int yaz_retrieval_request(yaz_retrieval_t p,
109 const char *schema, int *syntax,
110 const char **match_schema, int **match_syntax,
111 yaz_record_conv_t *rc,
112 const char **backend_schema,
113 int **backend_syntax);
115 /** returns error string (for last error)
116 \param p record conversion handle
120 const char *yaz_retrieval_get_error(yaz_retrieval_t p);
123 /** set path for opening stylesheets etc.
124 \param p record conversion handle
125 \param path file path (UNIX style with : / Windows with ;)
128 void yaz_retrieval_set_path(yaz_retrieval_t p, const char *path);
136 * indent-tabs-mode: nil
138 * vim: shiftwidth=4 tabstop=8 expandtab