From: Adam Dickmeiss Date: Mon, 27 Jan 2003 21:30:59 +0000 (+0000) Subject: CQL to RPN mappings X-Git-Tag: YAZ.2.0~56 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=c63b8160e6b822d640a4e92ca4c3d5fb79828bbc;p=yaz-moved-to-github.git CQL to RPN mappings --- diff --git a/doc/tools.xml b/doc/tools.xml index 051daf2..bb7d90c 100644 --- a/doc/tools.xml +++ b/doc/tools.xml @@ -1,4 +1,4 @@ - + Supporting Tools @@ -707,7 +707,7 @@ struct cql_node { Conversion to PQF (and Z39.50 RPN) is tricky by the fact that the resulting RPN depends on the Z39.50 target capabilities (combinations of supported attributes). - Furthermore, the CQL and SRW operates on index prefixes + In addition, the CQL and SRW operates on index prefixes (URI or strings), whereas the RPN uses Object Identifiers for attribute sets. @@ -721,7 +721,7 @@ cql_transform_t cql_transform_open_fname(const char *fname); void cql_transform_close(cql_transform_t ct); The first two functions create a tranformation handle from - either an already open FILE or from a filename. + either an already open FILE or from a filename respectively. The handle is destroyed by cql_transform_close @@ -762,7 +762,170 @@ int cql_transform_FILE(cql_transform_t ct, open FILE. - CQL to XCQL conversion + + Specification of CQL to RPN mapping + + The file supplied to functions + cql_transform_open_FILE, + cql_transform_open_fname follows + a structure found in many Unix utilities. + It consists of mapping specifications - one per line. + Lines starting with # are ignored (comments). + + + Each line is of the form + + CQL pattern = RPN equivalent + + + + An RPN pattern is a simple attribute list. Each attribute pair + takes the form: + + [set] type=value + + The attribute set is optional. + The type is the attribute type, + value the attribute value. + + + The following CQL patterns are recognized: + + + qualifier.set.name + + + + This pattern is invoked when a CQL qualifier, such as + dc.title is converted. set + and name is the index set and qualifier + name respectively. + Typically, the RPN specifies an equivalent use attribute. + + + For terms not bound by a qualifier the pattern + qualifier.srw.serverChoice is used. + Here, the prefix srw is defined as + http://www.loc.gov/zing/cql/srw-indexes/v1.0/. + If this pattern is not defined, the mapping will fail. + + + + + relation.relation + + + + This pattern specifies how a CQL relation is mapped to RPN. + pattern is name of relation + operator. Since = is used as + separator between CQL pattern and RPN, CQL relations + including = cannot be + used directly. To avoid a conflict, the names + ge, + eq, + le, + must be used for CQL operators, greater-than-or-equal, + equal, less-than-or-equal respectively. + The RPN pattern is supposed to include a relation attribute. + + + For terms not bound by a relation, the pattern + relation.scr is used. If the pattern + is not defined, the mapping will fail. + + + The special pattern, relation.* is used + when no other relation pattern is matched. + + + + + + relationModifier.mod + + + + This pattern specifies how a CQL relation modifier is mapped to RPN. + The RPN pattern is usually a relation attribute. + + + + + + structure.type + + + + This pattern specifies how a CQL structure is mapped to RPN. + Note that this CQL pattern is somewhat to similar to + CQL pattern relation. + The type is a CQL relation. + + + The pattern, structure.* is used + when no other structure pattern is matched. + Usually, the RPN equivalent specifies a structure attribute. + + + + + + position.type + + + + This pattern specifies how the anchor (position) of + CQL is mapped to RPN. + The type is one + of first, any, + last, firstAndLast. + + + The pattern, position.* is used + when no other position pattern is matched. + + + + + + set.prefix + + + + This specification defines a CQL index set for a given prefix. + The value on the right hand side is the URI for the set - + not RPN. All prefixes used in + qualifier patterns must be defined this way. + + + + + + Small CQL to RPN mapping file + + This small file defines two index sets, three qualifiers and three + relations, a position pattern and a default structure. + + + set.srw = http://www.loc.gov/zing/cql/srw-indexes/v1.0/ + set.dc = http://www.loc.gov/zing/cql/dc-indexes/v1.0/ + + qualifier.srw.serverChoice = 1=1016 + qualifier.dc.title = 1=4 + qualifier.dc.subject = 1=21 + + relation.< = 2=1 + relation.eq = 2=3 + relation.scr = 2=3 + + position.any = 3=3 6=1 + + structure.* = 4=1 + + + + CQL to XCQL conversion Conversion from CQL to XCQL is trivial and does not require a mapping to be defined.