Add toString
[cql-java-moved-to-github.git] / README
1
2 CQL-Java - a free CQL compiler, and other CQL tools, for Java
3
4
5 INTRODUCTION
6 ------------
7
8 CQL-Java is a Free Software project that provides:
9
10 * A set of classes for representing a CQL parse tree (a base CQLNode
11   class, CQLBooleanNode and its subclasses, CQLTermNode, etc.)
12 * A CQLCompiler class (and its lexer) which builds a parse tree given
13   a CQL query as input.
14 * A selection of compiler back-ends to render out the parse tree as:
15         * XCQL (the standard XML representation)
16         * CQL (i.e. decompiling the parse-tree)
17         * PQF (Yaz-style Prefix Query Format)
18         * BER code for the Z39.50 Type-1 query
19 * A random query generator, useful for testing.
20
21 CQL is "Common Query Language", a query language designed under
22 the umbrella of the ZING initiative (Z39.59-International Next
23 Generation).  The official specification is at
24         http://www.loc.gov/standards/sru/cql/
25 and there's more (and friendlier) information at
26         http://zing.z3950.org/cql/index.html
27
28 XCQL is "XML CQL", a representation of CQL-equivalent queries in XML
29 which is supposed to be easier to parse.  The specification is at
30         http://www.loc.gov/standards/sru/xml-files/xcql.xsd
31 in the form of an XML Schema.
32
33 But if you didn't know that, why are you even reading this?  :-)
34
35
36 WHAT'S WHAT IN THIS DISTRIBUTION?
37 ---------------------------------
38
39         README          This file
40         VERSION         The version-number of this distribution
41         Changes         History of releases
42         LGPL-2.1        The GNU lesser GPL (see below)
43         Makefile, Build Files to control compilation.
44         src             Source-code for the CQL-Java library
45         lib             The compiled library file, "cql-java.jar"
46         bin             Simple shell-scripts to invoke the test-harnesses
47         docs            Documentation automatically generated by "javadoc"
48         test            Various testing and sanity-checking frameworks
49         etc             Other files: PQF indexes, generator properties, etc.
50
51 "Installation" of this package would consist of putting the bin
52 directory on your PATH and lib/cql-java.jar on your CLASSPATH.
53
54
55 SYNOPSIS
56 --------
57
58 Using the test-harnesses:
59
60         $ CQLParser 'title=foo and author=(bar or baz)'
61         $ CQLParser -c 'title=foo and author=(bar or baz)'
62         $ CQLParser -p /etc/pqf.properties 'dc.title=foo and dc.author=bar'
63         $ CQLLexer 'title=foo and author=(bar or baz)'
64                 (not very interesting unless you're debugging)
65         $ CQLGenerator etc/generate.properties seed 18
66
67 Using the library in your own applications:
68
69         import org.z3950.zing.cql.*
70
71         // Building a parse-tree by hand
72         CQLNode n1 = new CQLTermNode("dc.author", new CQLRelation("="),
73                                      "kernighan");
74         CQLNode n2 = new CQLTermNode("dc.title", new CQLRelation("all"),
75                                      "elements style");
76         CQLNode root = new CQLAndNode(n1, n2);
77         System.out.println(root.toXCQL(0));
78
79         // Parsing a CQL query
80         CQLParser parser = new CQLParser();
81         CQLNode root = parser.parse("title=dinosaur");
82         System.out.print(root.toXCQL(0));
83         System.out.println(root.toCQL());
84         System.out.println(root.toPQF(config));
85         // ... where `config' specifies CQL-qualfier => Z-attr mapping
86
87
88 DESCRIPTION
89 -----------
90
91 See the automatically generated class documentation in the "doc"
92 subdirectory.
93
94
95 AUTHOR
96 ------
97
98 Code and documentation by Mike Taylor, Index Data <mike@indexdata.com>
99         http://indexdata.com
100         http://zing.z3950.org/cql
101 Please email me with bug-reports, wishlist items, patches, deployment
102 stories and, of course, large cash donations.
103
104
105 LICENCE
106 -------
107
108 The CQL-Java suite is Free Software, which is pretty much legally
109 equivalent -- though not morally equivalent -- to Open Source.  See
110         http://www.gnu.org/philosophy/free-software-for-freedom.html
111 for a detailed if somewhat one-sided discussion of the differences,
112 and particularly of why Free Software is an important idea.
113
114 CQL-Java is distributed under version 2.1 of the LGPL (GNU LESSER
115 GENERAL PUBLIC LICENSE).  A copy of the licence is included in this
116 distribution, as the file LGPL-2.1.  This licence does not allow you
117 to restrict the freedom of others to use derived versions of CQL-Java
118 (i.e. you must share your enhancements), but does let you do pretty
119 much anything else with it.  In particular, you may deploy CQL-Java as
120 a part of a non-free larger work.
121
122
123 SEE ALSO
124 --------
125
126 Adam Dickmeiss's CQL compiler, written in C.
127 Rob Sanderson's CQL compiler, written in Python.
128 All the other free CQL compilers everyone's going to write  :-)
129 The "Changes" file, including the "Still to do" section.