Updated PQF grammar
[yaz-moved-to-github.git] / doc / tools.xml
index a17b902..4d19542 100644 (file)
@@ -1,5 +1,5 @@
-<!-- $Id: tools.xml,v 1.5 2001-08-13 09:42:54 adam Exp $ -->
- <chapter><title>Supporting Tools</title>
+<!-- $Id: tools.xml,v 1.11 2002-05-30 20:57:31 adam Exp $ -->
+ <chapter id="tools"><title>Supporting Tools</title>
   
   <para>
    In support of the service API - primarily the ASN module, which
@@ -7,7 +7,7 @@
    a collection of tools that support the development of applications.
   </para>
 
-  <sect1><title>Query Syntax Parsers</title>
+  <sect1 id="tools.query"><title>Query Syntax Parsers</title>
 
    <para>
     Since the type-1 (RPN) query structure has no direct, useful string
@@ -72,47 +72,43 @@ int p_query_attset (const char *arg);
      The grammar of the PQF is as follows:
     </para>
 
-    <screen>
-     Query ::= &lsqb; '@attrset' AttSet &rsqb; QueryStruct.
-
-     AttSet ::= string.
+    <literallayout>
+     query ::= top-set query-struct.
 
-     QueryStruct ::= &lsqb; Attribute &rsqb; Simple | Complex.
+     top-set ::= &lsqb; '@attrset' string &rsqb;
 
-     Attribute ::= '@attr' &lsqb; AttSet &rsqb; AttributeType '=' AttributeValue.
+     query-struct ::= attr-spec | simple | complex
 
-     AttributeType ::= integer.
+     attr-spec ::= '@attr' &lsqb; string &rsqb; string query-struct
 
-     AttributeValue ::= integer.
+     complex ::= operator query-struct query-struct.
 
-     Complex ::= Operator QueryStruct QueryStruct.
+     operator ::= '@and' | '@or' | '@not' | '@prox' proximity.
 
-     Operator ::= '@and' | '@or' | '@not' | '@prox' Proximity.
+     simple ::= result-set | term.
 
-     Simple ::= ResultSet | Term.
+     result-set ::= '@set' string.
 
-     ResultSet ::= '@set' string.
+     term ::= string
 
-     Term ::= string | '"' string '"'.
+     proximity ::= exclusion distance ordered relation which-code unit-code.
 
-     Proximity ::= Exclusion Distance Ordered Relation WhichCode UnitCode.
+     exclusion ::= '1' | '0' | 'void'.
 
-     Exclusion ::= '1' | '0' | 'void'.
+     distance ::= integer.
 
-     Distance ::= integer.
+     ordered ::= '1' | '0'.
 
-     Ordered ::= '1' | '0'.
+     relation ::= integer.
 
-     Relation ::= integer.
+     which-code ::= 'known' | 'private' | integer.
 
-     WhichCode ::= 'known' | 'private' | integer.
-
-     UnitCode ::= integer.
-    </screen>
+     unit-code ::= integer.
+    </literallayout>
 
     <para>
      You will note that the syntax above is a fairly faithful
-     representation of RPN, except for the Attibute, which has been
+     representation of RPN, except for the Attribute, which has been
      moved a step away from the term, allowing you to associate one or more
      attributes with an entire query structure. The parser will
      automatically apply the given attributes to each term as required.
@@ -156,14 +152,15 @@ int p_query_attset (const char *arg);
     </para>
 
     <para>
-     The EUROPAGATE research project working under the Libraries programme
+     The <ulink url="http://europagate.dtv.dk/">EUROPAGATE</ulink>
+     research project working under the Libraries programme
      of the European Commission's DG XIII has, amongst other useful tools,
      implemented a general-purpose CCL parser which produces an output
      structure that can be trivially converted to the internal RPN
-     representation of YAZ (The <literal>Z_RPNQuery</literal> structure).
+     representation of &yaz; (The <literal>Z_RPNQuery</literal> structure).
      Since the CCL utility - along with the rest of the software
-     produced by EUROPAGATE - is made freely available on a liberal license, it
-     is included as a supplement to YAZ.
+     produced by EUROPAGATE - is made freely available on a liberal
+     license, it is included as a supplement to &yaz;.
     </para>
 
     <sect3><title>CCL Syntax</title>
@@ -206,7 +203,7 @@ int p_query_attset (const char *arg);
                   | string
       -- Qualifiers is a list of strings separated by comma
 
-      Relation ::= '=' | '>=' | '<=' | '<>' | '>' | '<'
+      Relation ::= '=' | '>=' | '&lt;=' | '&lt;>' | '>' | '&lt;'
       -- Relational operators. This really doesn't follow the ISO8777
       -- standard.
 
@@ -386,7 +383,7 @@ struct ccl_rpn_node *ccl_find_str (CCL_bibset bibset, const char *str,
     </sect3>
    </sect2>
   </sect1>
-  <sect1><title>Object Identifiers</title>
+  <sect1 id="tools.oid"><title>Object Identifiers</title>
 
    <para>
     The basic YAZ representation of an OID is an array of integers,
@@ -417,7 +414,7 @@ struct ccl_rpn_node *ccl_find_str (CCL_bibset bibset, const char *str,
 
    <para>
     The OID module provides a higher-level representation of the
-    family of object identifers which describe the Z39.50 protocol and its
+    family of object identifiers which describe the Z39.50 protocol and its
     related objects. The definition of the module interface is given in
     the <filename>oid.h</filename> file.
    </para>
@@ -583,7 +580,7 @@ typedef struct oident
 
     The <function>oid_ent_to_oid()</function> function can be used whenever
     you need to prepare a PDU containing one or more OIDs. The separation of
-    the <literal>protocol</literal> element from the remainer of the
+    the <literal>protocol</literal> element from the remainder of the
     OID-description makes it simple to write applications that can
     communicate with either Z39.50 or OSI SR-based applications.
    </para>
@@ -632,7 +629,7 @@ typedef struct oident
 
   </sect1>
 
-  <sect1><title>Nibble Memory</title>
+  <sect1 id="tools.nmem"><title>Nibble Memory</title>
 
    <para>
     Sometimes when you need to allocate and construct a large,
@@ -660,6 +657,7 @@ typedef struct oident
     void nmem_reset(NMEM n);
     int nmem_total(NMEM n);
     void nmem_init(void);
+    void nmem_exit(void);
    </screen>
 
    <para>
@@ -675,15 +673,18 @@ typedef struct oident
     allocated on the handle.
    </para>
 
-   <note>
-    <para>
-     The nibble memory pool is shared amongst threads. POSIX
-     mutex'es and WIN32 Critical sections are introduced to keep the
-     module thread safe. On WIN32 function <function>nmem_init()</function>
-     initializes the Critical Section handle and should be called once
-     before any other nmem function is used.
-    </para>
-   </note>
+   <para>
+    The nibble memory pool is shared amongst threads. POSIX
+    mutex'es and WIN32 Critical sections are introduced to keep the
+    module thread safe. Function <function>nmem_init()</function>
+    initializes the nibble memory library and it is called automatically
+    the first time the <literal>YAZ.DLL</literal> is loaded. &yaz; uses
+    function <function>DllMain</function> to achieve this. You should
+    <emphasis>not</emphasis> call <function>nmem_init</function> or
+    <function>nmem_exit</function> unless you're absolute sure what
+    you're doing. Note that in previous &yaz; versions you'd have to call
+    <function>nmem_init</function> yourself. 
+   </para>
 
   </sect1>
  </chapter>
@@ -698,7 +699,7 @@ typedef struct oident
  sgml-indent-step:1
  sgml-indent-data:t
  sgml-parent-document: "yaz.xml"
- sgml-local-catalogs: "../../docbook/docbook.cat"
+ sgml-local-catalogs: nil
  sgml-namecase-general:t
  End:
  -->