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