2 * Copyright (C) 2005-2006, Index Data ApS
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation, in whole or in part, for any purpose, is hereby granted,
8 * 1. This copyright and permission notice appear in all copies of the
9 * software and its documentation. Notices of copyright or attribution
10 * which appear at the beginning of any file must remain unchanged.
12 * 2. The name of Index Data or the individual authors may not be used to
13 * endorse or promote products derived from this software without specific
14 * prior written permission.
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22 * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26 * $Id: retrieval.h,v 1.3 2006-05-07 14:48:24 adam Exp $
30 * \brief Retrieval Utility
33 #ifndef YAZ_RETRIEVAL_H
34 #define YAZ_RETRIEVAL_H
37 #include <yaz/wrbuf.h>
38 #include <yaz/yconfig.h>
40 #include <yaz/record_conv.h>
44 /** retrieval handle */
45 typedef struct yaz_retrieval_struct *yaz_retrieval_t;
47 /** creates retrieval handle
48 \return retrieval handle
50 YAZ_EXPORT yaz_retrieval_t yaz_retrieval_create(void);
52 /** destroys retrieval handle
53 \param p retrieval handle
55 YAZ_EXPORT void yaz_retrieval_destroy(yaz_retrieval_t p);
57 /** configures retrieval
58 \param p retrieval handle
59 \param node xmlNode pointer (root element of XML config)
63 On failure, use yaz_retrieval_get_error to get error string.
68 <retrieval syntax="usmarc" schema="marcxml"
69 identifier="info:srw/schema/1/marcxml-v1.1"
70 backendsyntax="xml" backendschema="dc"
72 <title>MARCXML</title>
74 <marc inputformat="marc" outputformat="marcxml"
75 inputcharset="marc-8"/>
76 <xslt stylesheet="marcxml2mods.xsl"/>
77 <xslt stylesheet="mods2dc.xsl"/>
84 int yaz_retrieval_configure(yaz_retrieval_t p, const void *node);
87 /** performs retrieval request based on schema and format
88 \param p retrieval handle
89 \param schema record schema (SRU) / element set name (Z39.50)
90 \param syntax record syntax (format)
91 \param match_schema matched schema (if conversion was successful)
92 \param match_syntax matced syntax OID if conversion was successful)
93 \param rc record conversion reference (if conversion was successful)
94 \param backend_schema backend scchema (if conversion was successful)
95 \param backend_syntax backend syntax (if conversion was successful)
96 \retval 0 success, schema and syntax matches
97 \retval -1 failure, use yaz_retrieval_get_error() for reason
98 \retval 1 schema does not match
99 \retval 2 syntax does not match
100 \retval 3 neither schema, nor syntax matches
101 \retval 4 both match but not together
104 int yaz_retrieval_request(yaz_retrieval_t p,
105 const char *schema, int *syntax,
106 const char **match_schema, int **match_syntax,
107 yaz_record_conv_t *rc,
108 const char **backend_schema,
109 int **backend_syntax);
111 /** returns error string (for last error)
112 \param p record conversion handle
116 const char *yaz_retrieval_get_error(yaz_retrieval_t p);
119 /** set path for opening stylesheets etc.
120 \param p record conversion handle
121 \param path file path (UNIX style with : / Windows with ;)
124 void yaz_retrieval_set_path(yaz_retrieval_t p, const char *path);
132 * indent-tabs-mode: nil
134 * vim: shiftwidth=4 tabstop=8 expandtab