YAZ
5.34.0
|
Implements PQF parsing. More...
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <yaz/proto.h>
#include <yaz/oid_db.h>
#include <yaz/pquery.h>
Go to the source code of this file.
Data Structures | |
struct | yaz_pqf_parser |
Functions | |
static Z_RPNStructure * | rpn_structure (struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set) |
static Odr_oid * | query_oid_getvalbyname (struct yaz_pqf_parser *li, ODR o) |
static int | compare_term (struct yaz_pqf_parser *li, const char *src, size_t off) |
static int | query_token (struct yaz_pqf_parser *li) |
static int | lex (struct yaz_pqf_parser *li) |
static int | escape_string (char *out_buf, const char *in, int len) |
static int | p_query_parse_attr (struct yaz_pqf_parser *li, ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set) |
static Z_AttributeList * | get_attributeList (ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set) |
Z_AttributeList * | zget_AttributeList_use_string (ODR o, const char *name) |
creates AttributeList with type=1(use) and string value More... | |
Z_Term * | z_Term_create (ODR o, int term_type, const char *buf, size_t len) |
static Z_AttributesPlusTerm * | rpn_term_attributes (struct yaz_pqf_parser *li, ODR o, Z_AttributeList *attributes) |
static Z_AttributesPlusTerm * | rpn_term (struct yaz_pqf_parser *li, ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set) |
static Z_Operand * | rpn_simple (struct yaz_pqf_parser *li, ODR o, int num_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set) |
static Z_ProximityOperator * | rpn_proximity (struct yaz_pqf_parser *li, ODR o) |
static Z_Complex * | rpn_complex (struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, Odr_int *attr_list, char **attr_clist, Odr_oid **attr_set) |
static void | rpn_term_type (struct yaz_pqf_parser *li) |
static Z_RPNQuery * | p_query_rpn_mk (ODR o, struct yaz_pqf_parser *li) |
static void | pqf_parser_begin (struct yaz_pqf_parser *li, const char *buf) |
Z_RPNQuery * | p_query_rpn (ODR o, const char *qbuf) |
static Z_AttributeList * | p_query_scan_attributes_mk (struct yaz_pqf_parser *li, ODR o, Odr_oid **attributeSetP) |
static Z_AttributesPlusTerm * | p_query_scan_mk (struct yaz_pqf_parser *li, ODR o, Odr_oid **attributeSetP) |
YAZ_PQF_Parser | yaz_pqf_create (void) |
void | yaz_pqf_destroy (YAZ_PQF_Parser p) |
Z_RPNQuery * | yaz_pqf_parse (YAZ_PQF_Parser p, ODR o, const char *qbuf) |
Z_AttributesPlusTerm * | yaz_pqf_scan (YAZ_PQF_Parser p, ODR o, Odr_oid **attributeSetP, const char *qbuf) |
Z_AttributeList * | yaz_pqf_scan_attribute_list (YAZ_PQF_Parser p, ODR o, Odr_oid **attributeSetP, const char *qbuf) |
static Z_FacetField * | parse_facet (ODR odr, const char *facet) |
Z_FacetList * | yaz_pqf_parse_facet_list (ODR o, const char *qbuf) |
int | yaz_pqf_error (YAZ_PQF_Parser p, const char **msg, size_t *off) |
Implements PQF parsing.
Definition in file pquery.c.
|
static |
Definition at line 51 of file pquery.c.
References yaz_pqf_parser::lex_buf, and yaz_pqf_parser::lex_len.
Referenced by query_token(), and rpn_term_type().
|
static |
Definition at line 125 of file pquery.c.
Referenced by p_query_parse_attr(), parse_facet(), and rpn_term_attributes().
|
static |
Definition at line 246 of file pquery.c.
References Z_AttributeList::attributes, Z_AttributeElement::attributeSet, Z_AttributeElement::attributeType, Z_AttributeElement::complex, Z_ComplexAttribute::list, Z_AttributeList::num_attributes, Z_ComplexAttribute::num_list, Z_ComplexAttribute::num_semanticAction, Z_AttributeElement::numeric, odr_malloc(), odr_nullval(), Z_ComplexAttribute::semanticAction, Z_StringOrNumeric::string, Z_StringOrNumeric::u, Z_AttributeElement::value, Z_AttributeElement::which, Z_StringOrNumeric::which, Z_AttributeValue_complex, Z_AttributeValue_numeric, and Z_StringOrNumeric_string.
Referenced by p_query_scan_attributes_mk(), rpn_term(), and zget_AttributeList_use_string().
|
static |
Definition at line 120 of file pquery.c.
References yaz_pqf_parser::query_look, and query_token().
Referenced by p_query_parse_attr(), p_query_rpn_mk(), p_query_scan_attributes_mk(), p_query_scan_mk(), parse_facet(), rpn_complex(), rpn_proximity(), rpn_simple(), rpn_structure(), and rpn_term_type().
|
static |
Definition at line 188 of file pquery.c.
References yaz_pqf_parser::error, escape_string(), lex(), yaz_pqf_parser::lex_buf, yaz_pqf_parser::lex_len, odr_atoi(), odr_malloc(), query_oid_getvalbyname(), YAZ_PQF_ERROR_ATTSET, YAZ_PQF_ERROR_BAD_INTEGER, YAZ_PQF_ERROR_BADATTR, and YAZ_PQF_ERROR_MISSING.
Referenced by p_query_scan_attributes_mk(), and rpn_structure().
Z_RPNQuery* p_query_rpn | ( | ODR | o, |
const char * | qbuf | ||
) |
Definition at line 699 of file pquery.c.
References yaz_pqf_parser::error, yaz_pqf_parser::escape_char, yaz_pqf_parser::left_sep, p_query_rpn_mk(), pqf_parser_begin(), yaz_pqf_parser::right_sep, yaz_pqf_parser::term_type, and Z_Term_general.
Referenced by generate().
|
static |
Definition at line 648 of file pquery.c.
References Z_RPNQuery::attributeSetId, yaz_pqf_parser::error, lex(), odr_malloc(), odr_oiddup(), yaz_pqf_parser::query_look, query_oid_getvalbyname(), rpn_structure(), Z_RPNQuery::RPNStructure, yaz_oid_attset_bib_1, YAZ_PQF_ERROR_ATTSET, and YAZ_PQF_ERROR_EXTRA.
Referenced by p_query_rpn(), and yaz_pqf_parse().
|
static |
Definition at line 713 of file pquery.c.
References yaz_pqf_parser::error, get_attributeList(), lex(), odr_oiddup(), p_query_parse_attr(), yaz_pqf_parser::query_look, query_oid_getvalbyname(), rpn_term_type(), yaz_oid_attset_bib_1, YAZ_PQF_ERROR_ATTSET, YAZ_PQF_ERROR_MISSING, and YAZ_PQF_ERROR_TOOMANY.
Referenced by p_query_scan_mk(), parse_facet(), and yaz_pqf_scan_attribute_list().
|
static |
Definition at line 774 of file pquery.c.
References yaz_pqf_parser::error, lex(), p_query_scan_attributes_mk(), yaz_pqf_parser::query_look, rpn_term_attributes(), YAZ_PQF_ERROR_EXTRA, and YAZ_PQF_ERROR_MISSING.
Referenced by yaz_pqf_scan().
|
static |
Definition at line 844 of file pquery.c.
References Z_FacetField::attributes, Z_FacetTerm::count, escape_string(), lex(), yaz_pqf_parser::lex_buf, yaz_pqf_parser::lex_len, Z_FacetField::num_terms, odr_intdup(), odr_malloc(), p_query_scan_attributes_mk(), pqf_parser_begin(), yaz_pqf_parser::query_look, Z_FacetTerm::term, yaz_pqf_parser::term_type, Z_FacetField::terms, yaz_pqf_create(), yaz_pqf_destroy(), and z_Term_create().
Referenced by yaz_pqf_parse_facet_list().
|
static |
Definition at line 693 of file pquery.c.
References yaz_pqf_parser::lex_buf, yaz_pqf_parser::query_buf, and yaz_pqf_parser::query_ptr.
Referenced by p_query_rpn(), parse_facet(), yaz_pqf_parse(), yaz_pqf_scan(), and yaz_pqf_scan_attribute_list().
|
static |
Definition at line 40 of file pquery.c.
References CLASS_ATTSET, yaz_pqf_parser::lex_buf, yaz_pqf_parser::lex_len, yaz_oid_std(), and yaz_string_to_oid_odr().
Referenced by p_query_parse_attr(), p_query_rpn_mk(), and p_query_scan_attributes_mk().
|
static |
Definition at line 61 of file pquery.c.
References compare_term(), yaz_pqf_parser::escape_char, yaz_pqf_parser::left_sep, yaz_pqf_parser::lex_buf, yaz_pqf_parser::lex_len, yaz_pqf_parser::query_ptr, yaz_pqf_parser::right_sep, and yaz_isdigit.
Referenced by lex().
|
static |
Definition at line 510 of file pquery.c.
References Z_Operator::and_not, yaz_pqf_parser::error, lex(), odr_malloc(), odr_nullval(), Z_Operator::op_and, Z_Operator::op_or, Z_Operator::prox, yaz_pqf_parser::query_look, Z_Complex::roperator, rpn_proximity(), rpn_structure(), Z_Complex::s1, Z_Complex::s2, Z_Operator::u, Z_Operator::which, YAZ_PQF_ERROR_INTERNAL, Z_Operator_and, Z_Operator_and_not, Z_Operator_or, and Z_Operator_prox.
Referenced by rpn_structure().
|
static |
Definition at line 414 of file pquery.c.
References Z_ProximityOperator::distance, yaz_pqf_parser::error, Z_ProximityOperator::exclusion, Z_ProximityOperator::known, lex(), yaz_pqf_parser::lex_buf, odr_atoi(), odr_booldup(), odr_intdup(), odr_malloc(), Z_ProximityOperator::ordered, Z_ProximityOperator::relationType, Z_ProximityOperator::u, Z_ProximityOperator::which, YAZ_PQF_ERROR_BAD_INTEGER, YAZ_PQF_ERROR_MISSING, YAZ_PQF_ERROR_PROXIMITY, Z_ProximityOperator_known, and Z_ProximityOperator_private.
Referenced by rpn_complex().
|
static |
Definition at line 377 of file pquery.c.
References Z_Operand::attributesPlusTerm, yaz_pqf_parser::error, lex(), yaz_pqf_parser::lex_buf, yaz_pqf_parser::lex_len, odr_malloc(), odr_strdupn(), yaz_pqf_parser::query_look, Z_Operand::resultSetId, rpn_term(), Z_Operand::u, Z_Operand::which, YAZ_PQF_ERROR_INTERNAL, YAZ_PQF_ERROR_MISSING, Z_Operand_APT, and Z_Operand_resultSetId.
Referenced by rpn_structure().
|
static |
Definition at line 586 of file pquery.c.
References Z_RPNStructure::complex, yaz_pqf_parser::error, lex(), odr_malloc(), p_query_parse_attr(), yaz_pqf_parser::query_look, rpn_complex(), rpn_simple(), rpn_term_type(), Z_RPNStructure::simple, Z_RPNStructure::u, Z_RPNStructure::which, YAZ_PQF_ERROR_MISSING, YAZ_PQF_ERROR_TOOMANY, Z_RPNStructure_complex, and Z_RPNStructure_simple.
Referenced by p_query_rpn_mk(), and rpn_complex().
|
static |
Definition at line 370 of file pquery.c.
References get_attributeList(), and rpn_term_attributes().
Referenced by rpn_simple().
|
static |
Definition at line 356 of file pquery.c.
References Z_AttributesPlusTerm::attributes, escape_string(), yaz_pqf_parser::lex_buf, yaz_pqf_parser::lex_len, odr_malloc(), Z_AttributesPlusTerm::term, yaz_pqf_parser::term_type, and z_Term_create().
Referenced by p_query_scan_mk(), and rpn_term().
|
static |
Definition at line 559 of file pquery.c.
References compare_term(), yaz_pqf_parser::external_type, lex(), yaz_pqf_parser::query_look, yaz_pqf_parser::term_type, Z_Term_characterString, Z_Term_dateTime, Z_Term_external, Z_Term_general, Z_Term_null, Z_Term_numeric, and Z_Term_oid.
Referenced by p_query_scan_attributes_mk(), and rpn_structure().
YAZ_PQF_Parser yaz_pqf_create | ( | void | ) |
Definition at line 798 of file pquery.c.
References yaz_pqf_parser::error, yaz_pqf_parser::escape_char, yaz_pqf_parser::left_sep, yaz_pqf_parser::right_sep, yaz_pqf_parser::term_type, xmalloc, and Z_Term_general.
Referenced by ccl_rpn_query(), ccl_scan_query(), cql2pqf(), parse_facet(), srw_bend_scan(), and srw_bend_search().
void yaz_pqf_destroy | ( | YAZ_PQF_Parser | p | ) |
Definition at line 811 of file pquery.c.
References xfree.
Referenced by ccl_rpn_query(), ccl_scan_query(), cql2pqf(), parse_facet(), srw_bend_scan(), and srw_bend_search().
int yaz_pqf_error | ( | YAZ_PQF_Parser | p, |
const char ** | msg, | ||
size_t * | off | ||
) |
Definition at line 907 of file pquery.c.
References yaz_pqf_parser::error, yaz_pqf_parser::query_buf, yaz_pqf_parser::query_ptr, YAZ_PQF_ERROR_ATTSET, YAZ_PQF_ERROR_BAD_INTEGER, YAZ_PQF_ERROR_BADATTR, YAZ_PQF_ERROR_EXTRA, YAZ_PQF_ERROR_INTERNAL, YAZ_PQF_ERROR_MISSING, YAZ_PQF_ERROR_NONE, YAZ_PQF_ERROR_PROXIMITY, and YAZ_PQF_ERROR_TOOMANY.
Referenced by cql2pqf(), and srw_bend_search().
Z_RPNQuery* yaz_pqf_parse | ( | YAZ_PQF_Parser | p, |
ODR | o, | ||
const char * | qbuf | ||
) |
Definition at line 816 of file pquery.c.
References p_query_rpn_mk(), and pqf_parser_begin().
Referenced by ccl_rpn_query(), cql2pqf(), and srw_bend_search().
Z_FacetList* yaz_pqf_parse_facet_list | ( | ODR | o, |
const char * | qbuf | ||
) |
Definition at line 882 of file pquery.c.
References Z_FacetList::elements, nmem_strsplit(), Z_FacetList::num, odr_getmem, odr_malloc(), and parse_facet().
Referenced by yaz_sru_facet_request(), Z3950_send_search(), and ZOOM_connection_srw_send_search().
Z_AttributesPlusTerm* yaz_pqf_scan | ( | YAZ_PQF_Parser | p, |
ODR | o, | ||
Odr_oid ** | attributeSetP, | ||
const char * | qbuf | ||
) |
Definition at line 824 of file pquery.c.
References p_query_scan_mk(), and pqf_parser_begin().
Referenced by ccl_scan_query(), and srw_bend_scan().
Z_AttributeList* yaz_pqf_scan_attribute_list | ( | YAZ_PQF_Parser | p, |
ODR | o, | ||
Odr_oid ** | attributeSetP, | ||
const char * | qbuf | ||
) |
Definition at line 834 of file pquery.c.
References p_query_scan_attributes_mk(), and pqf_parser_begin().
Definition at line 323 of file pquery.c.
References Z_Term::characterString, Z_Term::external, Z_Term::general, Z_Term::null, Z_Term::numeric, odr_atoi(), odr_create_Odr_oct(), odr_intdup(), odr_malloc(), odr_nullval(), odr_strdupn(), Z_Term::u, Z_Term::which, Z_Term_characterString, Z_Term_external, Z_Term_general, Z_Term_null, and Z_Term_numeric.
Referenced by facet_term_create_cstr(), parse_facet(), and rpn_term_attributes().
Z_AttributeList* zget_AttributeList_use_string | ( | ODR | o, |
const char * | name | ||
) |
creates AttributeList with type=1(use) and string value
o | ODR for encoding |
name | use-value |
Definition at line 310 of file pquery.c.
References get_attributeList(), name, and odr_strdup().
Referenced by yaz_solr_decode_facet_field(), yaz_sru_facet_response(), and yaz_sru_proxy_decode_facet_field().