|
YAZ 5.35.1
|
Retrieval utility. More...
#include <string.h>#include <yaz/retrieval.h>#include <yaz/wrbuf.h>#include <yaz/xmalloc.h>#include <yaz/nmem.h>#include <yaz/tpath.h>#include <yaz/match_glob.h>#include <yaz/proto.h>#include <yaz/oid_db.h>#include <libxml/parser.h>#include <libxml/tree.h>#include <libxml/xinclude.h>Go to the source code of this file.
Data Structures | |
| struct | yaz_retrieval_struct |
| The internal structure for yaz_retrieval_t. More... | |
| struct | yaz_retrieval_elem |
| information per 'retrieval' construct More... | |
Functions | |
| static void | yaz_retrieval_reset (yaz_retrieval_t p) |
| yaz_retrieval_t | yaz_retrieval_create () |
| void | yaz_retrieval_destroy (yaz_retrieval_t p) |
| static int | conf_retrieval (yaz_retrieval_t p, const xmlNode *ptr, struct yaz_record_conv_type *types) |
| parse retrieval XML config | |
| int | yaz_retrieval_configure_t (yaz_retrieval_t p, const xmlNode *ptr, struct yaz_record_conv_type *types) |
| int | yaz_retrieval_configure (yaz_retrieval_t p, const xmlNode *ptr) |
| int | yaz_retrieval_request (yaz_retrieval_t p, const char *schema, const Odr_oid *syntax, const char **match_schema, Odr_oid **match_syntax, yaz_record_conv_t *rc, const char **backend_schema, Odr_oid **backend_syntax) |
| const char * | yaz_retrieval_get_error (yaz_retrieval_t p) |
| void | yaz_retrieval_set_path (yaz_retrieval_t p, const char *path) |
Retrieval utility.
Definition in file retrieval.c.
|
static |
parse retrieval XML config
Definition at line 113 of file retrieval.c.
References yaz_retrieval_elem::backend_name, yaz_retrieval_elem::backend_syntax, CLASS_RECSYN, yaz_retrieval_elem::identifier, yaz_retrieval_struct::list_p, yaz_retrieval_elem::name, yaz_retrieval_elem::next, yaz_retrieval_struct::nmem, nmem_malloc(), nmem_strdup(), yaz_retrieval_struct::odr, yaz_retrieval_struct::path, yaz_retrieval_elem::record_conv, yaz_retrieval_elem::split, yaz_retrieval_elem::syntax, yaz_retrieval_struct::wr_error, wrbuf_printf(), yaz_oid_std(), yaz_record_conv_configure_t(), yaz_record_conv_create(), yaz_record_conv_destroy(), yaz_record_conv_get_error(), yaz_record_conv_set_path(), and yaz_string_to_oid_odr().
Referenced by yaz_retrieval_configure_t().
| int yaz_retrieval_configure | ( | yaz_retrieval_t | p, |
| const xmlNode * | node | ||
| ) |
configures retrieval
| p | retrieval handle |
| node | xmlNode pointer (root element of XML config) |
| 0 | success |
| -1 | failure |
On failure, call yaz_retrieval_get_error to get error string.
For retrieval:
<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>
Definition at line 292 of file retrieval.c.
References yaz_retrieval_configure_t().
Referenced by xml_config_read().
| int yaz_retrieval_configure_t | ( | yaz_retrieval_t | p, |
| const xmlNode * | node, | ||
| struct yaz_record_conv_type * | types | ||
| ) |
configures retrieval with user-defined conversion types
| p | retrieval handle |
| node | xmlNode pointer (root element of XML config) |
| types | record conversion types |
| 0 | success |
| -1 | failure |
On failure, use yaz_retrieval_get_error to get error string.
Definition at line 258 of file retrieval.c.
References conf_retrieval(), yaz_retrieval_struct::wr_error, wrbuf_printf(), and yaz_retrieval_reset().
Referenced by yaz_retrieval_configure().
| yaz_retrieval_t yaz_retrieval_create | ( | void | ) |
creates retrieval handle
Definition at line 75 of file retrieval.c.
References yaz_retrieval_struct::list, yaz_retrieval_struct::nmem, yaz_retrieval_struct::odr, odr_createmem(), ODR_ENCODE, odr_getmem, yaz_retrieval_struct::path, yaz_retrieval_struct::wr_error, wrbuf_alloc(), xmalloc, and yaz_retrieval_reset().
Referenced by gfs_server_new().
| void yaz_retrieval_destroy | ( | yaz_retrieval_t | p | ) |
destroys retrieval handle
| p | retrieval handle |
Definition at line 87 of file retrieval.c.
References yaz_retrieval_struct::odr, odr_destroy(), yaz_retrieval_struct::path, yaz_retrieval_struct::wr_error, wrbuf_destroy(), xfree, and yaz_retrieval_reset().
| const char * yaz_retrieval_get_error | ( | yaz_retrieval_t | p | ) |
returns error string (for last error)
| p | record conversion handle |
Definition at line 402 of file retrieval.c.
References yaz_retrieval_struct::wr_error, and wrbuf_cstr().
Referenced by retrieve_fetch(), and xml_config_read().
| int yaz_retrieval_request | ( | yaz_retrieval_t | p, |
| const char * | schema, | ||
| const Odr_oid * | syntax, | ||
| const char ** | match_schema, | ||
| Odr_oid ** | match_syntax, | ||
| yaz_record_conv_t * | rc, | ||
| const char ** | backend_schema, | ||
| Odr_oid ** | backend_syntax | ||
| ) |
performs retrieval request based on schema and format
| p | retrieval handle |
| schema | record schema (SRU) / element set name (Z39.50) |
| syntax | record syntax (format) |
| match_schema | matched schema (if conversion was successful) |
| match_syntax | matced syntax OID if conversion was successful) |
| rc | record conversion reference (if conversion was successful) |
| backend_schema | backend scchema (if conversion was successful) |
| backend_syntax | backend syntax (if conversion was successful) |
| 0 | success, schema and syntax matches |
| -1 | failure, use yaz_retrieval_get_error() for reason |
| 1 | schema does not match |
| 2 | syntax does not match |
| 3 | both match but not together |
Definition at line 297 of file retrieval.c.
References yaz_retrieval_elem::backend_name, yaz_retrieval_elem::backend_syntax, yaz_retrieval_elem::identifier, yaz_retrieval_struct::list, yaz_retrieval_elem::name, yaz_retrieval_elem::next, oid_oid_to_dotstring(), oid_oidcmp(), OID_STR_MAX, yaz_retrieval_elem::record_conv, yaz_retrieval_elem::split, yaz_retrieval_elem::syntax, yaz_retrieval_struct::wr_error, wrbuf_alloc(), wrbuf_cstr(), wrbuf_printf(), wrbuf_puts(), wrbuf_rewind(), wrbuf_write(), and yaz_match_glob2().
Referenced by retrieve_fetch().
|
static |
Definition at line 99 of file retrieval.c.
References yaz_retrieval_struct::list, yaz_retrieval_struct::list_p, yaz_retrieval_elem::next, yaz_retrieval_struct::odr, odr_reset(), yaz_retrieval_elem::record_conv, yaz_retrieval_struct::wr_error, wrbuf_rewind(), and yaz_record_conv_destroy().
Referenced by yaz_retrieval_configure_t(), yaz_retrieval_create(), and yaz_retrieval_destroy().
| void yaz_retrieval_set_path | ( | yaz_retrieval_t | p, |
| const char * | path | ||
| ) |
set path for opening stylesheets etc.
| p | record conversion handle |
| path | file path (UNIX style with : / Windows with ;) |
Definition at line 407 of file retrieval.c.
References yaz_retrieval_struct::path, xfree, and xstrdup.
Referenced by xml_config_read().