1 $Id: README,v 1.7 2002-10-31 22:22:01 mike Exp $
3 cql-java -- a free CQL compiler for Java
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
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
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)
24 But if you didn't know that, why are you even reading this? :-)
32 $ echo "foo and (bar or baz)" | java org.z3950.zing.cql.CQLParser
36 import org.z3950.zing.cql.*
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));
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
56 See the automatically generated class documentation in the "doc"
57 subdirectory. (It's not all there yet, but it's coming.)
63 Mike Taylor <mike@z3950.org>
64 http://www.miketaylor.org.uk
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.
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 :-)
86 * Add proximity support to parser -- just the back-ends left to do.
88 * Relation modifiers could be limited to known modifiers only.
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
95 * Add CQLGenerate shell-script. Allow CQLGenerate test-harness to
96 take some arguments on command-line as well as or instead of a
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
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.
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
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.
121 * Refinements to random query generator:
122 * Generate relation modifiers
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
130 * Write fuller "javadoc" comments.
132 * Write generic test suite.