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


typedef struct yaz_retrieval_structyaz_retrieval_t


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

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

◆ 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

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

yaz_retrieval_t yaz_retrieval_create ( void  )

◆ yaz_retrieval_destroy()

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

◆ yaz_retrieval_get_error()

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

◆ yaz_retrieval_request()

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

◆ yaz_retrieval_set_path()

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