1 $Id: README,v 1.6 2002-10-30 11:13:18 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 Se the automatically generated class documentation in the "doc"
57 subdirectory. (### It's not there yet, of course)
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
88 * Some niceties for the CQL-decompiling back-end:
89 * Don't emit redundant parentheses.
90 * Don't put spaces around relations that don't need them.
92 * Write PQN-generating back-end (will need to be driven from a
93 configuation file specifying how to represent the qualifiers,
94 relations, relation modifiers and wildcard characters as Z39.50
97 * Consider the utility of yet another back-end that translates a
98 CQLNode tree into a Type-1 query tree using the JZKit data
99 structures. That would be nice so that CQL could become a JZKit
100 query-type, but you could achieve the same effect by generating PQN,
101 and running that through JZKit's existing PQN-to-Type-1 compiler.
103 * Refinements to random query generator:
104 * Generate relation modifiers
106 * Don't always generate qualifier/relation for terms
107 * Better selection of qualifier (configurable?)
108 * Better selection of terms (from a dictionary file?)
109 * Introduce wildcard characters into generated terms
110 * Generate multi-word terms
112 * Write fuller "javadoc" comments.
114 * Write generic test suite.
116 * Fix CQLParser test harness to read query from command-line
117 arguments, if any, falling back to stdin if there are none.