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