Handle relations, improve XML rendering (wow, was that hard.
[cql-java-moved-to-github.git] / README
1 $Id: README,v 1.4 2002-10-29 10:15:58 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 Compiler 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 either as XCQL or
10 Yaz-style Prefix Query Format (PQF).
11
12 CQL is "Common Query Language", a new query language designed under
13 the umbrella of the ZING initiative (Z39.59-International Next
14 Generation).  More information at
15         http://zing.z3950.org/cql/index.html
16
17 XCQL is "XML CQL", a representation of CQL-equivalent queries in XML
18 which is supposed to be easier to parse.  More information at
19         http://www.loc.gov/z3950/agency/zing/srwu/xcql.html
20 (not much more, though)
21
22 But if you didn't know that, why are you even reading this?  :-)
23
24
25 SYNOPSIS
26 --------
27
28 Test-harness:
29
30         $ echo "foo and (bar or baz)" | java org.z3950.zing.cql.CQLParser
31
32 Library:
33
34         import org.z3950.zing.cql.*
35
36         // Building a parse-tree by hand
37         CQLNode n1 = new CQLTermNode("dc.author", "=", "kernighan");
38         CQLNode n2 = new CQLTermNode("dc.title", "all", "elements style");
39         CQLNode root = new CQLAndNode(n1, n2);
40         System.out.println(root.toXCQL(3));
41
42         // Parsing a CQL query
43         CQLParser parser = new CQLParser();
44         CQLNode root = parser.parse("title=dinosaur");
45         System.out.println(root.toXCQL(0));
46         System.out.println(root.toCQL());
47         System.out.println(root.toPQF(qualSet));
48         // ... where `qualSet' specifies CQL-qualfier => Z-attr mapping
49
50
51 DESCRIPTION
52 -----------
53
54 Se the automatically generated class documentation in the "doc"
55 subdirectory.  (### It's not there yet, of course)
56
57
58 AUTHOR
59 ------
60
61 Mike Taylor <mike@z3950.org>
62 http://www.miketaylor.org.uk
63
64
65 LICENCE
66 -------
67
68 This software is open source, but I've not yet decided exactly what
69 licence to use.  Be good.  Assume I'm going with the GPL (most
70 restrictive) until I say otherwise.
71
72
73 SEE ALSO
74 --------
75
76 Adam Dickmeiss's CQL compiler, written in C.
77 Rob Sanderson's CQL compiler, written in Python.
78 All the other free CQL compilers everyone's going to write.
79
80
81 TO DO
82 -----
83
84 ### Finish the parser:
85 ###     * multi-character relations             DONE but ### single "<" fails!
86 ###     * word relations
87 ###     * relation modifiers
88 ###     * proximity, 
89
90 ### Finish the CXQL-rendering back end (mostly a matter of quoting
91     characters to be emitted as part of an XML document).
92         DONE
93
94 ### Finish CQL-decompiling back end (mostly a matter of quoting)
95
96 ### Write PQN-generating back end (will need to be driven from a
97     configuation file specifying how to represent the qualifiers,
98     relations, relation modifiers and wildcard characters as Z39.50
99     attributes.)
100
101 ### Write stochastic query generator, driven off MA grammar.
102
103 ### Write "javadoc" comments.
104