YAZ  5.34.0
Typedefs | Functions
retrieval.h File Reference

Retrieval utility. More...

#include <stddef.h>
#include <yaz/wrbuf.h>
#include <yaz/yconfig.h>
#include <yaz/oid_util.h>
#include <yaz/record_conv.h>

Go to the source code of this file.

Typedefs

typedef struct yaz_retrieval_structyaz_retrieval_t
 

Functions

yaz_retrieval_t yaz_retrieval_create (void)
 
void yaz_retrieval_destroy (yaz_retrieval_t p)
 
int yaz_retrieval_configure (yaz_retrieval_t p, const xmlNode *node)
 
int yaz_retrieval_configure_t (yaz_retrieval_t p, const xmlNode *node, struct yaz_record_conv_type *types)
 
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)
 

Detailed Description

Retrieval utility.

Definition in file retrieval.h.

Typedef Documentation

◆ yaz_retrieval_t

retrieval handle

Definition at line 45 of file retrieval.h.

Function Documentation

◆ yaz_retrieval_configure()

int yaz_retrieval_configure ( yaz_retrieval_t  p,
const xmlNode *  node 
)

configures retrieval

Parameters
pretrieval handle
nodexmlNode pointer (root element of XML config)
Return values
0success
-1failure

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

◆ yaz_retrieval_configure_t()

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

Parameters
pretrieval handle
nodexmlNode pointer (root element of XML config)
typesrecord conversion types
Return values
0success
-1failure

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_create()

yaz_retrieval_t yaz_retrieval_create ( void  )

◆ yaz_retrieval_destroy()

void yaz_retrieval_destroy ( yaz_retrieval_t  p)

destroys retrieval handle

Parameters
pretrieval 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().

◆ yaz_retrieval_get_error()

const char* yaz_retrieval_get_error ( yaz_retrieval_t  p)

returns error string (for last error)

Parameters
precord conversion handle
Returns
error string

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

◆ yaz_retrieval_request()

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

Parameters
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 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().

◆ yaz_retrieval_set_path()

void yaz_retrieval_set_path ( yaz_retrieval_t  p,
const char *  path 
)

set path for opening stylesheets etc.

Parameters
precord conversion handle
pathfile 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().