ed5afc8c4ea97f28b5331f3773a2943c500d127e
[cql-java-moved-to-github.git] / README
1 $Id: README,v 1.7 2002-10-31 22:22:01 mike Exp $
2
3 cql-java -- a free CQL compiler for Java
4
5
6 This project provides a set of classes for representing a CQL parse
7 tree (CQLBooleanNode, CQLTermNode, etc.) and a CQLCompiler class which
8 builds a parse tree given a CQL query as input.  It also provides
9 compiler back-ends to render out the parse tree as XCQL (the XML
10 representation), as PQF (Yaz-style Prefix Query Format) and as CQL
11 (i.e. decompiling the parse-tree).  Oh, and there's a random query
12 generator, too.
13
14 CQL is "Common Query Language", a new query language designed under
15 the umbrella of the ZING initiative (Z39.59-International Next
16 Generation).  More information at
17         http://zing.z3950.org/cql/index.html
18
19 XCQL is "XML CQL", a representation of CQL-equivalent queries in XML
20 which is supposed to be easier to parse.  More information at
21         http://www.loc.gov/z3950/agency/zing/srwu/xcql.html
22 (not much more, though)
23
24 But if you didn't know that, why are you even reading this?  :-)
25
26
27 SYNOPSIS
28 --------
29
30 Test-harness:
31
32         $ echo "foo and (bar or baz)" | java org.z3950.zing.cql.CQLParser
33
34 Library:
35
36         import org.z3950.zing.cql.*
37
38         // Building a parse-tree by hand
39         CQLNode n1 = new CQLTermNode("dc.author", "=", "kernighan");
40         CQLNode n2 = new CQLTermNode("dc.title", "all", "elements style");
41         CQLNode root = new CQLAndNode(n1, n2);
42         System.out.println(root.toXCQL(3));
43
44         // Parsing a CQL query
45         CQLParser parser = new CQLParser();
46         CQLNode root = parser.parse("title=dinosaur");
47         System.out.println(root.toXCQL(0));
48         System.out.println(root.toCQL());
49         System.out.println(root.toPQF(qualSet));
50         // ... where `qualSet' specifies CQL-qualfier => Z-attr mapping
51
52
53 DESCRIPTION
54 -----------
55
56 See the automatically generated class documentation in the "doc"
57 subdirectory.  (It's not all there yet, but it's coming.)
58
59
60 AUTHOR
61 ------
62
63 Mike Taylor <mike@z3950.org>
64 http://www.miketaylor.org.uk
65
66
67 LICENCE
68 -------
69
70 This software is open source, but I've not yet decided exactly what
71 licence to use.  Be good.  Assume I'm going with the GPL (most
72 restrictive) until I say otherwise.
73
74
75 SEE ALSO
76 --------
77
78 Adam Dickmeiss's CQL compiler, written in C.
79 Rob Sanderson's CQL compiler, written in Python.
80 All the other free CQL compilers everyone's going to write  :-)
81
82
83 TO DO
84 -----
85
86 * Add proximity support to parser -- just the back-ends left to do.
87
88 * Relation modifiers could be limited to known modifiers only.
89
90 * Fix CQLParser and CQLLexer shell-script front-ends to elegantly
91   handle their classes' test harnesses' ability to read the query from
92   the command-line arguments, if any, falling back to stdin if there
93   are none.
94
95 * Add CQLGenerate shell-script.  Allow CQLGenerate test-harness to
96   take some arguments on command-line as well as or instead of a
97   file.
98
99 * Trivial CQLCanonicalise application, which renders out its source
100   tree in a canonical form, enabling queries to be diffed for
101   semantically significant differences only.  Tests can be run by
102   generating random trees, canonicalising them, then canonicalising
103   them _again_ and checking that the before-and-after results are the
104   same.
105
106 * Some niceties for the cql-decompiling back-end:
107         * don't emit redundant parentheses.
108         * don't put spaces around relations that don't need them.
109
110 * Write pqn-generating back-end (will need to be driven from a
111   configuation file specifying how to represent the qualifiers,
112   relations, relation modifiers and wildcard characters as z39.50
113   attributes.)
114
115 * Consider the utility of yet another back-end that translates a
116   cqlnode tree into a type-1 query tree using the jzkit data
117   structures.  That would be nice so that CQL could become a JZKit
118   query-type, but you could achieve the same effect by generating PQN,
119   and running that through JZKit's existing PQN-to-Type-1 compiler.
120
121 * Refinements to random query generator:
122         * Generate relation modifiers
123         * Proximity support
124         * Don't always generate qualifier/relation for terms
125         * Better selection of qualifier (configurable?)
126         * Better selection of terms (from a dictionary file?)
127         * Introduce wildcard characters into generated terms
128         * Generate multi-word terms
129
130 * Write fuller "javadoc" comments.
131
132 * Write generic test suite.
133