home *** CD-ROM | disk | FTP | other *** search
/ Internet Publisher's Toolbox 2.0 / Internet Publisher's Toolbox.iso / internet / ntserver / wtsource / ztype1.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-15  |  3.9 KB  |  151 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE:
  2.    No guarantees or restrictions.  See the readme file for the full standard
  3.    disclaimer.    
  4.   
  5.    3.26.90    Harry Morris, morris@think.com
  6.    4.14.90  HWM - changed symbol for boolean query from QT_1 to 
  7.                      QT_BooleanQuery
  8. */
  9.  
  10. /* Copyright (c) CNIDR (see ../COPYRIGHT) */
  11.  
  12.  
  13. /*----------------------------------------------------------------------*/
  14. /* This file implements the type 1 query defined in appendices B & C
  15.    of the SR 1 spec.
  16.  */
  17. /*----------------------------------------------------------------------*/
  18.  
  19. #ifndef _H_Type_1_Query_
  20. #define _H_Type_1_Query_
  21.  
  22. #include "cdialect.h"
  23.  
  24. #include "zutil.h"
  25.  
  26. /*----------------------------------------------------------------------*/
  27. /* types and constants */
  28.  
  29. /* new data tags */
  30. #define    DT_AttributeList    (data_tag)44
  31. #define DT_Term            (data_tag)45
  32. #define DT_Operator        (data_tag)46
  33.  
  34. #define QT_BooleanQuery    "1"        /* standard boolean query */
  35.  
  36. /* general attribute code - use in place of any attribute */
  37. #define IGNORE    "ig"
  38.  
  39. /* use value codes */
  40. #define    UV_ISBN    "ub"
  41. #define    CORPORATE_NAME    "uc"
  42. #define    ISSN    "us"
  43. #define    PERSONAL_NAME    "up"
  44. #define    SUBJECT    "uj"
  45. #define    TITLE    "ut"
  46. #define    GEOGRAPHIC_NAME    "ug"
  47. #define    CODEN    "ud"
  48. #define    SUBJECT_SUBDIVISION    "ue"
  49. #define    SERIES_TITLE    "uf"
  50. #define    MICROFORM_GENERATION    "uh"
  51. #define    PLACE_OF_PUBLICATION    "ui"
  52. #define    NUC_CODE    "uk"
  53. #define    LANGUAGE    "ul"
  54. #define    COMBINATION_OF_USE_VALUES    "um"
  55. #define    SYSTEM_CONTROL_NUMBER    "un"
  56. #define    DATE    "uo"
  57. #define    LC_CONTROL_NUMBER    "ur"
  58. #define    MUSIC_PUBLISHERS_NUMBER    "uu"
  59. #define    GOVERNMENT_DOCUMENTS_NUMBER    "uv"
  60. #define    SUBJECT_CLASSIFICATION    "uw"
  61. #define    RECORD_TYPE    "uy"
  62.  
  63. /* relation value codes */
  64. #define    EQUAL    "re"
  65. #define    GREATER_THAN    "rg"
  66. #define    GREATER_THAN_OR_EQUAL    "ro"
  67. #define    LESS_THAN    "rl"
  68. #define    LESS_THAN_OR_EQUAL    "rp"
  69. #define    NOT_EQUAL    "rn"
  70.  
  71. /* position value codes */
  72. #define    FIRST_IN_FIELD    "pf"
  73. #define    FIRST_IN_SUBFIELD    "ps"
  74. #define    FIRST_IN_A_SUBFIELD    "pa"
  75. #define    FIRST_IN_NOT_A_SUBFIELD    "pt"
  76. #define    ANY_POSITION_IN_FIELD    "py"
  77.  
  78. /* structure value codes */
  79. #define    PHRASE    "sp"
  80. #define    WORD    "sw"
  81. #define    KEY    "sk"
  82. #define    WORD_LIST    "sl"
  83.  
  84. /* truncation value codes */
  85. #define    NO_TRUNCATION    "tn"
  86. #define    RIGHT_TRUNCATION    "tr"
  87. #define    PROC_NUM_INCLUDED_IN_SEARCH_ARG    "ti"
  88.  
  89. /* completeness value codes */
  90. #define    INCOMPLETE_SUBFIELD    "ci"
  91. #define    COMPLETE_SUBFIELD    "cs"
  92. #define    COMPLETEFIELD    "cf"
  93.  
  94. /* operator codes */
  95. #define AND    "a"
  96. #define OR    "o"
  97. #define AND_NOT    "n"
  98.  
  99. /* term types */
  100. #define TT_Attribute        1
  101. #define    TT_ResultSetID        2
  102. #define    TT_Operator            3
  103.  
  104. #define ATTRIBUTE_SIZE        3
  105. #define OPERATOR_SIZE        2
  106.  
  107. typedef struct query_term {
  108.   /* type */
  109.   long    TermType;
  110.   /* for term */
  111.   char    Use[ATTRIBUTE_SIZE];
  112.   char    Relation[ATTRIBUTE_SIZE];
  113.   char    Position[ATTRIBUTE_SIZE];
  114.   char    Structure[ATTRIBUTE_SIZE];
  115.   char    Truncation[ATTRIBUTE_SIZE];
  116.   char    Completeness[ATTRIBUTE_SIZE];
  117.   any*    Term;
  118.   /* for result set */
  119.   any*    ResultSetID;
  120.   /* for operator */
  121.   char    Operator[OPERATOR_SIZE];
  122. } query_term;
  123.  
  124. /*----------------------------------------------------------------------*/
  125. /* functions */
  126.  
  127. #ifdef __cplusplus
  128. /* declare these as C style functions */
  129. extern "C"
  130.     {
  131. #endif /* def __cplusplus */
  132.  
  133. query_term* makeAttributeTerm _AP((
  134.         char* use,char* relation,char* position,char* structure,
  135.     char* truncation,char* completeness,any* term));
  136. query_term* makeResultSetTerm _AP((any* resultSet));
  137. query_term* makeOperatorTerm _AP((char* operatorCode));
  138. void freeTerm _AP((query_term* qt));
  139. char* writeQueryTerm _AP((query_term* qt,char* buffer,long* len));
  140. char* readQueryTerm _AP((query_term** qt,char* buffer));
  141. any* writeQuery _AP((query_term** terms));
  142. query_term** readQuery _AP((any* info));
  143.  
  144. #ifdef __cplusplus
  145.     }
  146. #endif /* def __cplusplus */
  147.  
  148. /*----------------------------------------------------------------------*/
  149.  
  150. #endif
  151.