YAZ  5.23.1
Data Structures | Functions
retrieval.c File Reference

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...


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 More...
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, 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)

Detailed Description

Retrieval utility.

Definition in file retrieval.c.

Function Documentation

static int conf_retrieval ( yaz_retrieval_t  p,
const xmlNode *  ptr,
struct yaz_record_conv_type types 
int yaz_retrieval_configure ( yaz_retrieval_t  p,
const xmlNode *  node 

configures retrieval

pretrieval handle
nodexmlNode pointer (root element of XML config)
Return values

On failure, call yaz_retrieval_get_error to get error string.

For retrieval:

   <retrieval syntax="usmarc" name="F"/>
   <retrieval syntax="usmarc" name="B"/>
   <retrieval syntax="xml" name="marcxml"
     <backend syntax="usmarc" name="F">
       <marc inputformat="marc" outputformat="marcxml"
   <retrieval syntax="xml" name="dc">
     <backend syntax="usmarc" name="F">
       <marc inputformat="marc" outputformat="marcxml"
       <xslt stylesheet="MARC21slim2DC.xsl"/>

Definition at line 285 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

pretrieval handle
nodexmlNode pointer (root element of XML config)
typesrecord conversion types
Return values

On failure, use yaz_retrieval_get_error to get error string.

Definition at line 251 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  )
void yaz_retrieval_destroy ( yaz_retrieval_t  p)

destroys retrieval handle

pretrieval handle

Definition at line 85 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)

precord conversion handle
error string

Definition at line 379 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,
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

pretrieval handle
schemarecord schema (SRU) / element set name (Z39.50)
syntaxrecord syntax (format)
match_schemamatched schema (if conversion was successful)
match_syntaxmatced syntax OID if conversion was successful)
rcrecord conversion reference (if conversion was successful)
backend_schemabackend scchema (if conversion was successful)
backend_syntaxbackend syntax (if conversion was successful)
Return values
0success, schema and syntax matches
-1failure, use yaz_retrieval_get_error() for reason
1schema does not match
2syntax does not match
3both match but not together

Definition at line 290 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::syntax, yaz_retrieval_struct::wr_error, wrbuf_printf(), wrbuf_rewind(), and yaz_match_glob().

Referenced by retrieve_fetch().

void yaz_retrieval_reset ( yaz_retrieval_t  p)
void yaz_retrieval_set_path ( yaz_retrieval_t  p,
const char *  path 

set path for opening stylesheets etc.

precord conversion handle
pathfile path (UNIX style with : / Windows with ;)

Definition at line 384 of file retrieval.c.

References yaz_retrieval_struct::path, xfree, and xstrdup.

Referenced by xml_config_read().