2 CQL-Java - a free CQL compiler, and other CQL tools, for Java
8 CQL-Java is a Free Software project that provides:
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
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.
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
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.
33 But if you didn't know that, why are you even reading this? :-)
36 WHAT'S WHAT IN THIS DISTRIBUTION?
37 ---------------------------------
40 VERSION The version-number of this distribution
41 Changes History of releases
42 LGPL-2.1 The GNU lesser GPL (see below)
43 pom.xml Maven project file to control compilation.
44 src Source-code for the CQL-Java library and tests
45 target The compiled library file, "cql-java.jar" and javadoc
46 bin Simple shell-scripts to invoke CQL programs (parser/lexer/generator)
47 util Various testing and sanity-checking Perl scripts
48 etc Other files: PQF indexes, generator properties, etc.
50 "Installation" of this package would consist of putting the bin
51 directory on your PATH and target/cql-java.jar on your CLASSPATH.
57 Using the test-harnesses:
59 $ CQLParser 'title=foo and author=(bar or baz)'
60 $ CQLParser -c 'title=foo and author=(bar or baz)'
61 $ CQLParser -p /etc/pqf.properties 'dc.title=foo and dc.author=bar'
62 $ CQLLexer 'title=foo and author=(bar or baz)'
63 (not very interesting unless you're debugging)
64 $ CQLGenerator etc/generate.properties seed 18
66 Using the library in your own applications:
68 import org.z3950.zing.cql.*
70 // Building a parse-tree by hand
71 CQLNode n1 = new CQLTermNode("dc.author", new CQLRelation("="),
73 CQLNode n2 = new CQLTermNode("dc.title", new CQLRelation("all"),
75 CQLNode root = new CQLAndNode(n1, n2);
76 System.out.println(root.toXCQL(0));
78 // Parsing a CQL query
79 CQLParser parser = new CQLParser();
80 CQLNode root = parser.parse("title=dinosaur");
81 System.out.print(root.toXCQL(0));
82 System.out.println(root.toCQL());
83 System.out.println(root.toPQF(config));
84 // ... where `config' specifies CQL-qualfier => Z-attr mapping
90 See the automatically generated class documentation in the "target"
97 Original code and documentation by Mike Taylor, Index Data <mike@indexdata.com>
98 At present maintained by Jakub Skoczen, Index Data <jakub@indexdata.dk>
100 http://www.indexdata.com/cql-java
101 http://zing.z3950.org/cql
103 Please email me with bug-reports, wishlist items, patches, deployment
104 stories and, of course, large cash donations.
110 The CQL-Java suite is Free Software, which is pretty much legally
111 equivalent -- though not morally equivalent -- to Open Source. See
112 http://www.gnu.org/philosophy/free-software-for-freedom.html
113 for a detailed if somewhat one-sided discussion of the differences,
114 and particularly of why Free Software is an important idea.
116 CQL-Java is distributed under version 2.1 of the LGPL (GNU LESSER
117 GENERAL PUBLIC LICENSE). A copy of the licence is included in this
118 distribution, as the file LGPL-2.1. This licence does not allow you
119 to restrict the freedom of others to use derived versions of CQL-Java
120 (i.e. you must share your enhancements), but does let you do pretty
121 much anything else with it. In particular, you may deploy CQL-Java as
122 a part of a non-free larger work.
128 Adam Dickmeiss's CQL compiler, written in C.
129 Rob Sanderson's CQL compiler, written in Python.
130 Jakub Skoczen's CQL-js compiler, written in JavaScript http://git.indexdata.com/?p=cql-js.git
131 All the other free CQL compilers everyone's going to write :-)
132 The "Changes" file, including the "Still to do" section.