From: Jakub Skoczen Date: Sat, 15 Mar 2014 15:08:37 +0000 (+0100) Subject: More clean up, update readme X-Git-Tag: v1.12~11 X-Git-Url: http://jira.indexdata.com/?a=commitdiff_plain;h=03ef3621fa8624d56eef1f85274de365ddafed90;p=cql-java-moved-to-github.git More clean up, update readme --- diff --git a/Changes b/Changes index db9734b..d3e03e1 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,10 @@ See the bottom of this file for a list of things still to do. The work for releases 1.0, 1.2 and 1.2.1 was sponsored by the National Library of Australia, whose help we gratefully acknowledge. +1.12 TO BE RELEASED + - rewrite the CQL lexer to better conform to CQL spec (e.g retain escapes for wildcards, etc) + - add jUnit test cases + 1.11 Tue 5 Mar 2013 13:38:18 CET - Fix problem with parsing unquoted terms that begin with a '.' - Fix problem with parsing unquoted terms that contain a '@' diff --git a/README b/README index 0120033..e01743d 100644 --- a/README +++ b/README @@ -40,16 +40,15 @@ WHAT'S WHAT IN THIS DISTRIBUTION? VERSION The version-number of this distribution Changes History of releases LGPL-2.1 The GNU lesser GPL (see below) - Makefile, Build Files to control compilation. - src Source-code for the CQL-Java library - lib The compiled library file, "cql-java.jar" - bin Simple shell-scripts to invoke the test-harnesses - docs Documentation automatically generated by "javadoc" - test Various testing and sanity-checking frameworks + pom.xml Maven project file to control compilation. + src Source-code for the CQL-Java library and tests + target The compiled library file, "cql-java.jar" and javadoc + bin Simple shell-scripts to invoke CQL programs (parser/lexer/generator) + util Various testing and sanity-checking Perl scripts etc Other files: PQF indexes, generator properties, etc. "Installation" of this package would consist of putting the bin -directory on your PATH and lib/cql-java.jar on your CLASSPATH. +directory on your PATH and target/cql-java.jar on your CLASSPATH. SYNOPSIS @@ -88,16 +87,19 @@ Using the library in your own applications: DESCRIPTION ----------- -See the automatically generated class documentation in the "doc" +See the automatically generated class documentation in the "target" subdirectory. AUTHOR ------ -Code and documentation by Mike Taylor, Index Data - http://indexdata.com +Original code and documentation by Mike Taylor, Index Data +At present maintained by Jakub Skoczen, Index Data + + http://www.indexdata.com/cql-java http://zing.z3950.org/cql + Please email me with bug-reports, wishlist items, patches, deployment stories and, of course, large cash donations. @@ -125,5 +127,6 @@ SEE ALSO Adam Dickmeiss's CQL compiler, written in C. Rob Sanderson's CQL compiler, written in Python. +Jakub Skoczen's CQL-js compiler, written in JavaScript http://git.indexdata.com/?p=cql-js.git All the other free CQL compilers everyone's going to write :-) The "Changes" file, including the "Still to do" section. diff --git a/VERSION b/VERSION index 6259340..809bdcb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8 +1.12 diff --git a/src/main/java/org/z3950/zing/cql/CQLLexer.java b/src/main/java/org/z3950/zing/cql/CQLLexer.java index 2c867ea..83bbe5b 100644 --- a/src/main/java/org/z3950/zing/cql/CQLLexer.java +++ b/src/main/java/org/z3950/zing/cql/CQLLexer.java @@ -136,7 +136,7 @@ public class CQLLexer implements CQLTokenizer { case TT_EOF: return "EOF"; case TT_WORD: - return "word: " + val; + return "word: '" + val + "'"; case '"': return "string: \"" + val + "\""; case TT_LE: diff --git a/test/random/Makefile b/test/random/Makefile deleted file mode 100644 index d3e1421..0000000 --- a/test/random/Makefile +++ /dev/null @@ -1,10 +0,0 @@ - -all: ../../target/cql-java-1.8.jar - PATH=$(PATH):../../bin CLASSPATH=../../target/cql-java-1.8.jar ./mkrandom 100 - -../../target/cql-java-1.8.jar: - cd ../../ && mvn package - -clean: - @echo "Nothing to do to 'make clean'" - diff --git a/test/random/README b/test/random/README deleted file mode 100644 index 586796b..0000000 --- a/test/random/README +++ /dev/null @@ -1,14 +0,0 @@ - -In this directory, we test the integrity of the CQL-Java tools as -follows: - -* Generate a random tree with CQLGenerate -* Take a copy -* Canonicalise it with CQLparser -c. -* Compare the before-and-after versions. - -Since the CQLGenerate output is in canonical form anyway, the -before-and-after versions should be identical. This process exercises -the comprehensiveness and bullet-proofing of the parser, as well as -the accuracy of the rendering. - diff --git a/test/random/mkrandom b/test/random/mkrandom deleted file mode 100755 index 131e9e7..0000000 --- a/test/random/mkrandom +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/perl -w - - -use strict; - -my $n = 1; -if (@ARGV > 1) { - print STDERR "Usage: $0 []\n"; - exit 1; -} elsif (@ARGV == 1) { - $n = $ARGV[0]; -} - -my $nok = 0; -for (my $i = 0; $i < $n; $i++) { - print $i+1, " of $n -- "; - my $query=`CQLGenerator ../../etc/generate.properties`; - print $query; - my $canon=`CQLParser -c '$query'`; - if ($canon eq $query) { - $nok++; - } else { - print "ERROR: canonicalised query differs from original\n"; - } -} - -print "Passed $nok/$n -- ", int(100*$nok/$n), "%\n"; diff --git a/test/regression/Makefile b/test/regression/Makefile deleted file mode 100644 index 5243e41..0000000 --- a/test/regression/Makefile +++ /dev/null @@ -1,30 +0,0 @@ - -XMLCANONICALISER = cat -# Change this to "./xmlpp.pl" if you want to check for equivalence - -test: sections/01/01.cql sections/01/01.xcql - ./runtests ../../bin/CQLParser $(XMLCANONICALISER) - -test-adam: sections/01/01.cql sections/01/01.xcql - ./runtests ../../../srw/cql/cql2xcql $(XMLCANONICALISER) - -test-rob: sections/01/01.cql sections/01/01.xcql - ./runtests ../../../rob/CQLParser.py $(XMLCANONICALISER) - -sections/01/01.cql: mktests queries.raw - ./mktests queries.raw - -sections/01/01.xcql: mkanswers - ./mkanswers ../../bin/CQLParser -# OR ./mkanswers ../../../srw/cql/cql2xcql -# OR ./mkanswers ../../../rob/CQLParser.py -# Depending on which parser you want to use as your reference - -clean: - @echo "Nothing to do to 'make clean'" - -distclean: - find sections . -name '*.cql' -exec rm \{\} \; - -refclean: - find sections . -name '*.xcql' -exec rm \{\} \; diff --git a/test/regression/README b/test/regression/README deleted file mode 100644 index 0d7b96b..0000000 --- a/test/regression/README +++ /dev/null @@ -1,92 +0,0 @@ - -If you just don't want to think about it ----------------------------------------- - -Just use "make" to run regression tests. - - -CQL-Java's regression-testing framework ---------------------------------------- - -"queries.raw" is the file of test queries as provided by Rob. -"mktests" parses the raw file into sections and individual queries -"sections" is the top-level directory created by that program. - "01", "02" etc. represent the sections within the raw file - "01/name", "02/name", etc. contain the names of the sections. - "01/01.cql", "01/02.cql" etc. are the CQL queries themselves. -"mkanswers" uses a trusted CQL compiler to generate corresponding XCQL. - "01/01.xcql", "01/02.xcql" etc. are the compiled XCQL queries. - -Apart from the CQL files, all of the files described to this point are -included in the distribution, with the "trusted" XCQL output produced -by my own compiler, and used for regression testing of new versions. -The CQL files are re-created from "queries.raw" as required. But -you're welcome to "make refclean" and rebuild it with mkanswers, to -contain the trusted compiler output of your choice. - -"runtests" compares the output of a nominated CQL compiler with -existing XCQL files. Most often, you'll use this to compare the -results of your own build of CQL-Java with those of my build. I'll -use it to test new versions, and people who've written other compilers -can use it to test their code. (The code of "runtests" and -"mkanswers" is worryingly similar: they should probably be the same -program invoked with different command-line arguments.) - -"Makefile" controls the building of all this. You'll need to edit it -if you want to use different compilers and suchlike from what's -written into it, so it may be easier to run the tests by hand -- but -it's a useful reference for the kinds of commands you might need, -anyway. In general, "make" will run the regression tests, creating -whatever CQL and/or XCQL files it needs; if you do "make refclean" -first, then the next "make" will rebuild the reference results. - -So, for example, if you think Rob Sanderson's parser, CQLParser.py, is -reliable, and you want to test my parser, CQL-Java's CQLParser class, -against its results, do this: - - make refclean - ./mktests queries.raw - ./mkanswers CQLParser.py - ./runtests ../../bin/CQLParser ./xmlpp.pl - -The second argument to ./runtests is the name of a program to use to -normalise XML, so that the trusted output and the output being tested -can be compared for equivalence rather than just for being -byte-identical. (If you want to test for byte-identical XCQL, then -use "cat" as the second argument.) xmlpp.pl is a fine XML -pretty-printer from DecisionSoft, found at - http://software.decisionsoft.com/tools.html - -"showtest" can be used to run a single test showing more details of -what goes wrong, if anything. You don't need it as part of the -regression test, but it's useful when debugging. - -Finally, "runcanon" checks that each of the queries when compiled and -decompiled back to CQL (i.e. canonicalised) remains identical when -recompiled and redecompiled. - - -Appendix: queries that should fail ----------------------------------- - -The following queries are included in Rob's master list, in a final -section called "Invalid searches [should error]". They are all -expected to fail in various ways. I've taken them out of -"queries.raw" because it's uninteresting, not to mention rather -disturbing, to watch compilers fail. More important, I think, to -demonstrate correct behaviour for the known-to-work queries. - -> -=== -cat or -index any -index any/wrong term -a prox/wrong b -() -(a -index any fish) -(cat any dog or ()) -title = ("illegal parentheses") -"quoted" any "illegal quotes" -> illegal="urn:missingQuery" -"fish" and > illegal="urn:invalidPrefixLocation" "chips" diff --git a/test/regression/mkanswers b/test/regression/mkanswers deleted file mode 100755 index 16e7dd2..0000000 --- a/test/regression/mkanswers +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl -w - - -use IO::File; -use strict; - -$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; - -if (@ARGV != 1) { - print STDERR "Usage: $0 \n"; - exit(1); -} -my $compiler = $ARGV[0]; - -while () { - my $sdir = $_; - s@sections/@@; - next if /^CVS$/ || /^10$/; # I _can't_ get CVS to stop extracting "10" - print "answering section $_ - ", read_file("$sdir/name"), "\n"; - - while (<$sdir/*.cql>) { - my $qfile = $_; - s@sections/([0-9]+/.*)\.cql@$1@; - my $query = read_file($qfile); - my $afile = $qfile; - $afile =~ s/\.cql$/.xcql/; - print " wrote $_ - $query\n"; - my $fh = new IO::File("| $compiler > $afile") - or die "can't run compiler '$compiler': $!"; - print $fh $query; - $fh->close(); - } -} - -sub read_file { - my($name) = @_; - - my $fh = new IO::File("<$name") - or die "can't read '$name': $!"; - my $contents = join('', <$fh>); - $fh->close(); - return $contents; -} diff --git a/test/regression/mktests b/test/regression/mktests deleted file mode 100755 index 78057b0..0000000 --- a/test/regression/mktests +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -w - - -use IO::File; -use strict; - -maybe_mkdir("sections"); -my $section = 0; -my $dir; -my $query; - -while (<>) { - chomp(); - s/[ \t]+$//; - next if /^$/; - - if (s/^#[ \t]*//) { - $section++; - $query = 0; - $dir = "sections/" . substr("0$section", -2); - maybe_mkdir($dir); - write_file("$dir/name", $_); - print "created section $section ($dir) - $_\n"; - next; - } - - die "query before first section header" - if !defined $dir; - - $query++; - my $filename = $dir . "/" . substr("0$query", -2) . ".cql"; - write_file($filename, $_); - $filename =~ s@sections/(.*)\.cql@$1@; - print " added $filename - $_\n"; -} - -sub write_file { - my($name, $contents) = @_; - - my $fh = new IO::File(">$name") - or die "can't create '$name': $!"; - $fh->print($contents); - $fh->close(); -} - -sub maybe_mkdir { - my($dir) = shift(); - if (mkdir $dir) { - return; - } - if ($! =~ /exists/i) { - return; - } - die "can't create directory '$dir': $!"; -} diff --git a/test/regression/queries.raw b/test/regression/queries.raw deleted file mode 100644 index 6075e69..0000000 --- a/test/regression/queries.raw +++ /dev/null @@ -1,112 +0,0 @@ - -# Simple - -cat -"cat" -comp.os.linux -xml:element -"" -"=" -"prox/distance<3/unit=word" -("cat") -((dog)) -all -prox - -# Index Relation Term - -title = "fish" -title exact fish -title any fish -title all fish -title > 9 -title >= 23 -dc.title any "fish chips" -dc.title any/stem fish -dc.fish all/stem/fuzzy "fish chips" -(title any frog) -((dc.title any/stem "frog pond")) -dc.title any "fish frog chicken" -dc.title =/rel.algorithm=CORI squid -author any/f.foo/b.bar>1 "sanderson taylor" -numberOfLegs <= 4 -numberOfLegs <> 4 -title == jaws - -# Simple Boolean - -cat or dog -cat and fish -cat not frog -(cat not frog) -"cat" not "fish food" -xml and "prox///" -fred and any -((fred or all)) -a or b and c not d - -# I/R/T plus Boolean - -bath.author any fish and dc.title all "cat dog" -(title any/stem "fish dog" or and) - -# Prox - -cat prox hat -cat prox/distance=3/unit=word/ordered hat -cat prox/distance<3 hat -"fish food" prox/unit=sentence and -title all "chips frog" prox/distance<=5 exact -(dc.author == "jones" prox/distance>5/unit=element title >= "smith") -((cat prox hat)) -a and/rel.SumOfScores b -a and/rel.algorithm=CORI b - -# Special Characters - -(cat^) -"cat" -"^cat says \"fish\"" -"cat*fish" -cat?dog -(("^cat*fishdog\"horse?")) - -# Nesting Parentheses - -(((cat or dog) or horse) and frog) -(cat and dog) or (horse and frog) -(cat and (horse or frog)) and chips - -# Prefix Maps - -> foo="http://www.loc.gov/zing/cql/dc-indexes/" dc.title="fish" -> "http://www.loc.gov/zing/cql/dc-indexes/" title="fish" -> foo="http://www.loc.gov/zing/cql/dc-indexes" > ccg = "http://srw.o-r-g.org/cql/indexSets/ccg/" foo.title="fish" and ccg.force=3 - -# Lame Searches - -any or all:stem and all contains any prox proxfuzzy -(((((((((any))))))))) -"" -> any > any = exact any > any -sortby sortby sortby -sortby sortby sortby sortby sortby - -# Sorting - -kernighan sortby title -kernighan and ritchie sortby title -dc.creator=kernighan sortby dc.title -dc.creator=kernighan sortby numberOfLegs/cql.number -dc.creator=kernighan sortby dc.title/sort.respectCase -dc.creator=kernighan sortby dc.title/sort.respectCase/sort.descending -dc.creator=kernighan sortby dc.date dc.title -dc.creator=kernighan sortby dc.date/sort.missingOmit -dc.creator=kernighan sortby dc.date/sort.missingValue=1970 ->dc="http://deepcustard.org/1.0" blah sortby dc.custardDepth ->ns1="http://uri1" >ns2="http://uri2" whatever sortby ns1.key/a/b/c=1 ns2.key2 -(>dc=x b=c) sortby d -b=(>dc=x c) sortby d -(>dc=x c1 and c2) sortby d ->dc="http://deepcustard.org" (>dc="http://dublincore.org" dc.title=jaws) sortby dc.custardDepth ->dc="http://deepcustard.org" (fish or >dc="http://dublincore.org" dc.title=jaws) sortby dc.custardDepth diff --git a/test/regression/runcanon b/test/regression/runcanon deleted file mode 100755 index 46d6a93..0000000 --- a/test/regression/runcanon +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl -w - -# -# Tests that all sample queries can be rendered into idempotent -# canoncial form. - -use IO::File; -use strict; - -$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; - -my($ntests, $ncorrect) = (0, 0); - -while () { - my $sdir = $_; - s@sections/@@; - next if /^CVS$/ || /^10$/; - print "testing section $_ - ", read_file("$sdir/name"), "\n"; - - while (<$sdir/*.cql>) { - my $qfile = $_; - s@sections/([0-9]+/.*)\.cql@$1@; - my $query = read_file($qfile); - my $canonical = `CQLParser -c '$query'`; - chomp($canonical); - my $maybe = `CQLParser -c '$canonical'`; - chomp($maybe); - print "$query // $canonical "; - $ntests++; - if ($maybe eq $canonical) { - $ncorrect++; - print " OK\n"; - } else { - print "### $maybe\n"; - } - } -} - -print sprintf("%d of %d passed: %d%%\n", - $ncorrect, $ntests, (100 * $ncorrect) / $ntests); - -sub read_file { - my($name) = @_; - - $name = "<$name" if $name !~ /\|$/; - my $fh = new IO::File("$name") - or die "can't read '$name': $!"; - my $contents = join('', <$fh>); - $fh->close(); - return $contents; -} diff --git a/test/regression/runtests b/test/regression/runtests deleted file mode 100755 index c12cd3c..0000000 --- a/test/regression/runtests +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl -w - - -use IO::File; -use strict; - -$ENV{CLASSPATH} .= ":../../src/main/java"; -$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; - -if (@ARGV != 2) { - print STDERR "Usage: $0 \n"; - exit(1); -} -my $compiler = $ARGV[0]; -my $norman = $ARGV[1]; # name of XML normaliser program -my($ntests, $ncorrect) = (0, 0); - -while () { - my $sdir = $_; - s@sections/@@; - next if /^CVS$/; - print "testing section $_ - ", read_file("$sdir/name"), "\n"; - - while (<$sdir/*.cql>) { - my $qfile = $_; - s@sections/([0-9]+/.*)\.cql@$1@; - my $query = read_file($qfile); - my $afile = $qfile; - $afile =~ s/\.cql$/.xcql/; - print " query $_ - $query "; - $ntests++; - my $correct = read_file("$norman < $afile |"); - my $tested = read_file("$compiler < $qfile | $norman |"); - if (!$tested) { - print "\n *** test compiler exited non-zero\n"; - } elsif ($tested eq $correct) { - print "OK\n"; - $ncorrect++; - } else { - print "\n *** XCQL output differs from $afile\n"; - print "=== tested ===\n$tested"; - print "=== end ===\n"; - } - } -} - -print sprintf("%d of %d passed: %d%%\n", - $ncorrect, $ntests, (100 * $ncorrect) / $ntests); - -sub read_file { - my($name) = @_; - - $name = "<$name" if $name !~ /\|$/; - my $fh = new IO::File("$name") - or die "can't read '$name': $!"; - my $contents = join('', <$fh>); - $fh->close(); - return $contents; -} diff --git a/test/regression/sections/01/.gitignore b/test/regression/sections/01/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/01/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/01/01.xcql b/test/regression/sections/01/01.xcql deleted file mode 100644 index 48aee99..0000000 --- a/test/regression/sections/01/01.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat - diff --git a/test/regression/sections/01/02.xcql b/test/regression/sections/01/02.xcql deleted file mode 100644 index 48aee99..0000000 --- a/test/regression/sections/01/02.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat - diff --git a/test/regression/sections/01/03.xcql b/test/regression/sections/01/03.xcql deleted file mode 100644 index af191d3..0000000 --- a/test/regression/sections/01/03.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - comp.os.linux - diff --git a/test/regression/sections/01/04.xcql b/test/regression/sections/01/04.xcql deleted file mode 100644 index 4141430..0000000 --- a/test/regression/sections/01/04.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - xml:element - diff --git a/test/regression/sections/01/05.xcql b/test/regression/sections/01/05.xcql deleted file mode 100644 index 6ec410e..0000000 --- a/test/regression/sections/01/05.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - <xml:element> - diff --git a/test/regression/sections/01/06.xcql b/test/regression/sections/01/06.xcql deleted file mode 100644 index da69755..0000000 --- a/test/regression/sections/01/06.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - = - diff --git a/test/regression/sections/01/07.xcql b/test/regression/sections/01/07.xcql deleted file mode 100644 index 851a5c1..0000000 --- a/test/regression/sections/01/07.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - prox/distance<3/unit=word - diff --git a/test/regression/sections/01/08.xcql b/test/regression/sections/01/08.xcql deleted file mode 100644 index 48aee99..0000000 --- a/test/regression/sections/01/08.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat - diff --git a/test/regression/sections/01/09.xcql b/test/regression/sections/01/09.xcql deleted file mode 100644 index d41b39e..0000000 --- a/test/regression/sections/01/09.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - dog - diff --git a/test/regression/sections/01/10.xcql b/test/regression/sections/01/10.xcql deleted file mode 100644 index c5ac7f6..0000000 --- a/test/regression/sections/01/10.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - all - diff --git a/test/regression/sections/01/11.xcql b/test/regression/sections/01/11.xcql deleted file mode 100644 index 88da9eb..0000000 --- a/test/regression/sections/01/11.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - prox - diff --git a/test/regression/sections/02/.gitignore b/test/regression/sections/02/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/02/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/02/01.xcql b/test/regression/sections/02/01.xcql deleted file mode 100644 index be3c9c1..0000000 --- a/test/regression/sections/02/01.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - = - - fish - diff --git a/test/regression/sections/02/02.xcql b/test/regression/sections/02/02.xcql deleted file mode 100644 index 2b78ddf..0000000 --- a/test/regression/sections/02/02.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - exact - - fish - diff --git a/test/regression/sections/02/03.xcql b/test/regression/sections/02/03.xcql deleted file mode 100644 index 62521be..0000000 --- a/test/regression/sections/02/03.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - any - - fish - diff --git a/test/regression/sections/02/04.xcql b/test/regression/sections/02/04.xcql deleted file mode 100644 index 646c973..0000000 --- a/test/regression/sections/02/04.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - all - - fish - diff --git a/test/regression/sections/02/05.xcql b/test/regression/sections/02/05.xcql deleted file mode 100644 index 92411c4..0000000 --- a/test/regression/sections/02/05.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - > - - 9 - diff --git a/test/regression/sections/02/06.xcql b/test/regression/sections/02/06.xcql deleted file mode 100644 index 6702471..0000000 --- a/test/regression/sections/02/06.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - >= - - 23 - diff --git a/test/regression/sections/02/07.xcql b/test/regression/sections/02/07.xcql deleted file mode 100644 index ba4ac78..0000000 --- a/test/regression/sections/02/07.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - dc.title - - any - - fish chips - diff --git a/test/regression/sections/02/08.xcql b/test/regression/sections/02/08.xcql deleted file mode 100644 index 1576778..0000000 --- a/test/regression/sections/02/08.xcql +++ /dev/null @@ -1,12 +0,0 @@ - - dc.title - - any - - - stem - - - - fish - diff --git a/test/regression/sections/02/09.xcql b/test/regression/sections/02/09.xcql deleted file mode 100644 index 9f8abff..0000000 --- a/test/regression/sections/02/09.xcql +++ /dev/null @@ -1,15 +0,0 @@ - - dc.fish - - all - - - stem - - - fuzzy - - - - fish chips - diff --git a/test/regression/sections/02/10.xcql b/test/regression/sections/02/10.xcql deleted file mode 100644 index d7dfe7a..0000000 --- a/test/regression/sections/02/10.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - any - - frog - diff --git a/test/regression/sections/02/11.xcql b/test/regression/sections/02/11.xcql deleted file mode 100644 index 726a36e..0000000 --- a/test/regression/sections/02/11.xcql +++ /dev/null @@ -1,12 +0,0 @@ - - dc.title - - any - - - stem - - - - frog pond - diff --git a/test/regression/sections/02/12.xcql b/test/regression/sections/02/12.xcql deleted file mode 100644 index b4bcf3b..0000000 --- a/test/regression/sections/02/12.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - dc.title - - any - - fish frog chicken - diff --git a/test/regression/sections/02/13.xcql b/test/regression/sections/02/13.xcql deleted file mode 100644 index 6f3c011..0000000 --- a/test/regression/sections/02/13.xcql +++ /dev/null @@ -1,14 +0,0 @@ - - dc.title - - = - - - rel.algorithm - = - CORI - - - - squid - diff --git a/test/regression/sections/02/14.xcql b/test/regression/sections/02/14.xcql deleted file mode 100644 index c833d26..0000000 --- a/test/regression/sections/02/14.xcql +++ /dev/null @@ -1,17 +0,0 @@ - - author - - any - - - f.foo - - - b.bar - > - 1 - - - - sanderson taylor - diff --git a/test/regression/sections/02/15.xcql b/test/regression/sections/02/15.xcql deleted file mode 100644 index 3a23abe..0000000 --- a/test/regression/sections/02/15.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - numberOfLegs - - <= - - 4 - diff --git a/test/regression/sections/02/16.xcql b/test/regression/sections/02/16.xcql deleted file mode 100644 index 0e8eccd..0000000 --- a/test/regression/sections/02/16.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - numberOfLegs - - <> - - 4 - diff --git a/test/regression/sections/02/17.xcql b/test/regression/sections/02/17.xcql deleted file mode 100644 index b2587ff..0000000 --- a/test/regression/sections/02/17.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - title - - == - - jaws - diff --git a/test/regression/sections/03/.gitignore b/test/regression/sections/03/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/03/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/03/01.xcql b/test/regression/sections/03/01.xcql deleted file mode 100644 index fc1b678..0000000 --- a/test/regression/sections/03/01.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - or - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - dog - - - diff --git a/test/regression/sections/03/02.xcql b/test/regression/sections/03/02.xcql deleted file mode 100644 index 55ae66a..0000000 --- a/test/regression/sections/03/02.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - and - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - fish - - - diff --git a/test/regression/sections/03/03.xcql b/test/regression/sections/03/03.xcql deleted file mode 100644 index 2f4f6c0..0000000 --- a/test/regression/sections/03/03.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - not - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - frog - - - diff --git a/test/regression/sections/03/04.xcql b/test/regression/sections/03/04.xcql deleted file mode 100644 index 2f4f6c0..0000000 --- a/test/regression/sections/03/04.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - not - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - frog - - - diff --git a/test/regression/sections/03/05.xcql b/test/regression/sections/03/05.xcql deleted file mode 100644 index 9ad0700..0000000 --- a/test/regression/sections/03/05.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - not - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - fish food - - - diff --git a/test/regression/sections/03/06.xcql b/test/regression/sections/03/06.xcql deleted file mode 100644 index 7b8dae8..0000000 --- a/test/regression/sections/03/06.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - and - - - - cql.serverChoice - - = - - xml - - - - - cql.serverChoice - - = - - prox/// - - - diff --git a/test/regression/sections/03/07.xcql b/test/regression/sections/03/07.xcql deleted file mode 100644 index 5e0076e..0000000 --- a/test/regression/sections/03/07.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - and - - - - cql.serverChoice - - = - - fred - - - - - cql.serverChoice - - = - - any - - - diff --git a/test/regression/sections/03/08.xcql b/test/regression/sections/03/08.xcql deleted file mode 100644 index f080d4b..0000000 --- a/test/regression/sections/03/08.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - or - - - - cql.serverChoice - - = - - fred - - - - - cql.serverChoice - - = - - all - - - diff --git a/test/regression/sections/03/09.xcql b/test/regression/sections/03/09.xcql deleted file mode 100644 index 4f3ade7..0000000 --- a/test/regression/sections/03/09.xcql +++ /dev/null @@ -1,55 +0,0 @@ - - - not - - - - - and - - - - - or - - - - cql.serverChoice - - = - - a - - - - - cql.serverChoice - - = - - b - - - - - - - cql.serverChoice - - = - - c - - - - - - - cql.serverChoice - - = - - d - - - diff --git a/test/regression/sections/04/.gitignore b/test/regression/sections/04/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/04/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/04/01.xcql b/test/regression/sections/04/01.xcql deleted file mode 100644 index 6f3ec27..0000000 --- a/test/regression/sections/04/01.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - and - - - - bath.author - - any - - fish - - - - - dc.title - - all - - cat dog - - - diff --git a/test/regression/sections/04/02.xcql b/test/regression/sections/04/02.xcql deleted file mode 100644 index 0dcb869..0000000 --- a/test/regression/sections/04/02.xcql +++ /dev/null @@ -1,28 +0,0 @@ - - - or - - - - title - - any - - - stem - - - - fish dog - - - - - cql.serverChoice - - = - - and - - - diff --git a/test/regression/sections/05/.gitignore b/test/regression/sections/05/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/05/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/05/01.xcql b/test/regression/sections/05/01.xcql deleted file mode 100644 index 406d103..0000000 --- a/test/regression/sections/05/01.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - prox - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - hat - - - diff --git a/test/regression/sections/05/02.xcql b/test/regression/sections/05/02.xcql deleted file mode 100644 index f09ab0b..0000000 --- a/test/regression/sections/05/02.xcql +++ /dev/null @@ -1,38 +0,0 @@ - - - prox - - - distance - = - 3 - - - unit - = - word - - - ordered - - - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - hat - - - diff --git a/test/regression/sections/05/03.xcql b/test/regression/sections/05/03.xcql deleted file mode 100644 index 25c5377..0000000 --- a/test/regression/sections/05/03.xcql +++ /dev/null @@ -1,30 +0,0 @@ - - - prox - - - distance - < - 3 - - - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - hat - - - diff --git a/test/regression/sections/05/04.xcql b/test/regression/sections/05/04.xcql deleted file mode 100644 index a6e2198..0000000 --- a/test/regression/sections/05/04.xcql +++ /dev/null @@ -1,30 +0,0 @@ - - - prox - - - unit - = - sentence - - - - - - cql.serverChoice - - = - - fish food - - - - - cql.serverChoice - - = - - and - - - diff --git a/test/regression/sections/05/05.xcql b/test/regression/sections/05/05.xcql deleted file mode 100644 index a59341f..0000000 --- a/test/regression/sections/05/05.xcql +++ /dev/null @@ -1,30 +0,0 @@ - - - prox - - - distance - <= - 5 - - - - - - title - - all - - chips frog - - - - - cql.serverChoice - - = - - exact - - - diff --git a/test/regression/sections/05/06.xcql b/test/regression/sections/05/06.xcql deleted file mode 100644 index 4ffea29..0000000 --- a/test/regression/sections/05/06.xcql +++ /dev/null @@ -1,35 +0,0 @@ - - - prox - - - distance - > - 5 - - - unit - = - element - - - - - - dc.author - - == - - jones - - - - - title - - >= - - smith - - - diff --git a/test/regression/sections/05/07.xcql b/test/regression/sections/05/07.xcql deleted file mode 100644 index 406d103..0000000 --- a/test/regression/sections/05/07.xcql +++ /dev/null @@ -1,23 +0,0 @@ - - - prox - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - hat - - - diff --git a/test/regression/sections/05/08.xcql b/test/regression/sections/05/08.xcql deleted file mode 100644 index b46dcfd..0000000 --- a/test/regression/sections/05/08.xcql +++ /dev/null @@ -1,28 +0,0 @@ - - - and - - - rel.sumofscores - - - - - - cql.serverChoice - - = - - a - - - - - cql.serverChoice - - = - - b - - - diff --git a/test/regression/sections/05/09.xcql b/test/regression/sections/05/09.xcql deleted file mode 100644 index 1dc3602..0000000 --- a/test/regression/sections/05/09.xcql +++ /dev/null @@ -1,30 +0,0 @@ - - - and - - - rel.algorithm - = - CORI - - - - - - cql.serverChoice - - = - - a - - - - - cql.serverChoice - - = - - b - - - diff --git a/test/regression/sections/06/.gitignore b/test/regression/sections/06/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/06/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/06/01.xcql b/test/regression/sections/06/01.xcql deleted file mode 100644 index 0dcc5fb..0000000 --- a/test/regression/sections/06/01.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat^ - diff --git a/test/regression/sections/06/02.xcql b/test/regression/sections/06/02.xcql deleted file mode 100644 index 48aee99..0000000 --- a/test/regression/sections/06/02.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat - diff --git a/test/regression/sections/06/03.xcql b/test/regression/sections/06/03.xcql deleted file mode 100644 index 9db40ae..0000000 --- a/test/regression/sections/06/03.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - ^cat says "fish" - diff --git a/test/regression/sections/06/04.xcql b/test/regression/sections/06/04.xcql deleted file mode 100644 index ee38b0e..0000000 --- a/test/regression/sections/06/04.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat*fish - diff --git a/test/regression/sections/06/05.xcql b/test/regression/sections/06/05.xcql deleted file mode 100644 index dc59539..0000000 --- a/test/regression/sections/06/05.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - cat?dog - diff --git a/test/regression/sections/06/06.xcql b/test/regression/sections/06/06.xcql deleted file mode 100644 index 9d38695..0000000 --- a/test/regression/sections/06/06.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - ^cat*fishdog"horse? - diff --git a/test/regression/sections/07/.gitignore b/test/regression/sections/07/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/07/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/07/01.xcql b/test/regression/sections/07/01.xcql deleted file mode 100644 index 3338a9f..0000000 --- a/test/regression/sections/07/01.xcql +++ /dev/null @@ -1,55 +0,0 @@ - - - and - - - - - or - - - - - or - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - dog - - - - - - - cql.serverChoice - - = - - horse - - - - - - - cql.serverChoice - - = - - frog - - - diff --git a/test/regression/sections/07/02.xcql b/test/regression/sections/07/02.xcql deleted file mode 100644 index 1324889..0000000 --- a/test/regression/sections/07/02.xcql +++ /dev/null @@ -1,55 +0,0 @@ - - - or - - - - - and - - - - cql.serverChoice - - = - - cat - - - - - cql.serverChoice - - = - - dog - - - - - - - - and - - - - cql.serverChoice - - = - - horse - - - - - cql.serverChoice - - = - - frog - - - - - diff --git a/test/regression/sections/07/03.xcql b/test/regression/sections/07/03.xcql deleted file mode 100644 index 202af98..0000000 --- a/test/regression/sections/07/03.xcql +++ /dev/null @@ -1,55 +0,0 @@ - - - and - - - - - and - - - - cql.serverChoice - - = - - cat - - - - - - or - - - - cql.serverChoice - - = - - horse - - - - - cql.serverChoice - - = - - frog - - - - - - - - - cql.serverChoice - - = - - chips - - - diff --git a/test/regression/sections/08/.gitignore b/test/regression/sections/08/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/08/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/08/01.xcql b/test/regression/sections/08/01.xcql deleted file mode 100644 index 4e2d548..0000000 --- a/test/regression/sections/08/01.xcql +++ /dev/null @@ -1,13 +0,0 @@ - - - - foo - http://www.loc.gov/zing/cql/dc-indexes/ - - - dc.title - - = - - fish - diff --git a/test/regression/sections/08/02.xcql b/test/regression/sections/08/02.xcql deleted file mode 100644 index 63ce6ad..0000000 --- a/test/regression/sections/08/02.xcql +++ /dev/null @@ -1,12 +0,0 @@ - - - - http://www.loc.gov/zing/cql/dc-indexes/ - - - title - - = - - fish - diff --git a/test/regression/sections/08/03.xcql b/test/regression/sections/08/03.xcql deleted file mode 100644 index 025c7c9..0000000 --- a/test/regression/sections/08/03.xcql +++ /dev/null @@ -1,33 +0,0 @@ - - - - foo - http://www.loc.gov/zing/cql/dc-indexes - - - ccg - http://srw.o-r-g.org/cql/indexSets/ccg/ - - - - and - - - - foo.title - - = - - fish - - - - - ccg.force - - = - - 3 - - - diff --git a/test/regression/sections/09/.gitignore b/test/regression/sections/09/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/09/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/09/01.xcql b/test/regression/sections/09/01.xcql deleted file mode 100644 index f721ed0..0000000 --- a/test/regression/sections/09/01.xcql +++ /dev/null @@ -1,39 +0,0 @@ - - - and - - - - - or - - - - cql.serverChoice - - = - - any - - - - - cql.serverChoice - - = - - all:stem - - - - - - - all contains - - any - - prox proxfuzzy - - - diff --git a/test/regression/sections/09/02.xcql b/test/regression/sections/09/02.xcql deleted file mode 100644 index dd7c8f0..0000000 --- a/test/regression/sections/09/02.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - any - diff --git a/test/regression/sections/09/03.xcql b/test/regression/sections/09/03.xcql deleted file mode 100644 index 1eeff16..0000000 --- a/test/regression/sections/09/03.xcql +++ /dev/null @@ -1,7 +0,0 @@ - - cql.serverChoice - - = - - - diff --git a/test/regression/sections/09/04.xcql b/test/regression/sections/09/04.xcql deleted file mode 100644 index aed8eca..0000000 --- a/test/regression/sections/09/04.xcql +++ /dev/null @@ -1,16 +0,0 @@ - - - - any - - - any - exact - - - any - - > - - any - diff --git a/test/regression/sections/09/05.xcql b/test/regression/sections/09/05.xcql deleted file mode 100644 index 578af0f..0000000 --- a/test/regression/sections/09/05.xcql +++ /dev/null @@ -1,12 +0,0 @@ - - cql.serverChoice - - = - - sortby - - - sortby - - - diff --git a/test/regression/sections/09/06.xcql b/test/regression/sections/09/06.xcql deleted file mode 100644 index 2e136b5..0000000 --- a/test/regression/sections/09/06.xcql +++ /dev/null @@ -1,18 +0,0 @@ - - cql.serverChoice - - = - - sortby - - - sortby - - - sortby - - - sortby - - - diff --git a/test/regression/sections/10/.gitignore b/test/regression/sections/10/.gitignore deleted file mode 100644 index b03b3d1..0000000 --- a/test/regression/sections/10/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -name -*.cql diff --git a/test/regression/sections/10/01.xcql b/test/regression/sections/10/01.xcql deleted file mode 100644 index 0c8cc74..0000000 --- a/test/regression/sections/10/01.xcql +++ /dev/null @@ -1,12 +0,0 @@ - - cql.serverChoice - - = - - kernighan - - - title - - - diff --git a/test/regression/sections/10/02.xcql b/test/regression/sections/10/02.xcql deleted file mode 100644 index dbd6407..0000000 --- a/test/regression/sections/10/02.xcql +++ /dev/null @@ -1,28 +0,0 @@ - - - and - - - - cql.serverChoice - - = - - kernighan - - - - - cql.serverChoice - - = - - ritchie - - - - - title - - - diff --git a/test/regression/sections/10/03.xcql b/test/regression/sections/10/03.xcql deleted file mode 100644 index eaef782..0000000 --- a/test/regression/sections/10/03.xcql +++ /dev/null @@ -1,12 +0,0 @@ - - dc.creator - - = - - kernighan - - - dc.title - - - diff --git a/test/regression/sections/10/04.xcql b/test/regression/sections/10/04.xcql deleted file mode 100644 index 3a32884..0000000 --- a/test/regression/sections/10/04.xcql +++ /dev/null @@ -1,17 +0,0 @@ - - dc.creator - - = - - kernighan - - - numberOfLegs - - - cql.number - - - - - diff --git a/test/regression/sections/10/05.xcql b/test/regression/sections/10/05.xcql deleted file mode 100644 index 5821b04..0000000 --- a/test/regression/sections/10/05.xcql +++ /dev/null @@ -1,17 +0,0 @@ - - dc.creator - - = - - kernighan - - - dc.title - - - sort.respectcase - - - - - diff --git a/test/regression/sections/10/06.xcql b/test/regression/sections/10/06.xcql deleted file mode 100644 index 8d232b2..0000000 --- a/test/regression/sections/10/06.xcql +++ /dev/null @@ -1,20 +0,0 @@ - - dc.creator - - = - - kernighan - - - dc.title - - - sort.respectcase - - - sort.descending - - - - - diff --git a/test/regression/sections/10/07.xcql b/test/regression/sections/10/07.xcql deleted file mode 100644 index 13737ee..0000000 --- a/test/regression/sections/10/07.xcql +++ /dev/null @@ -1,15 +0,0 @@ - - dc.creator - - = - - kernighan - - - dc.date - - - dc.title - - - diff --git a/test/regression/sections/10/08.xcql b/test/regression/sections/10/08.xcql deleted file mode 100644 index bcf2a8f..0000000 --- a/test/regression/sections/10/08.xcql +++ /dev/null @@ -1,17 +0,0 @@ - - dc.creator - - = - - kernighan - - - dc.date - - - sort.missingomit - - - - - diff --git a/test/regression/sections/10/09.xcql b/test/regression/sections/10/09.xcql deleted file mode 100644 index 8a60d51..0000000 --- a/test/regression/sections/10/09.xcql +++ /dev/null @@ -1,19 +0,0 @@ - - dc.creator - - = - - kernighan - - - dc.date - - - sort.missingvalue - = - 1970 - - - - - diff --git a/test/regression/sections/10/10.xcql b/test/regression/sections/10/10.xcql deleted file mode 100644 index cb97df6..0000000 --- a/test/regression/sections/10/10.xcql +++ /dev/null @@ -1,18 +0,0 @@ - - - - dc - http://deepcustard.org/1.0 - - - cql.serverChoice - - = - - blah - - - dc.custardDepth - - - diff --git a/test/regression/sections/10/11.xcql b/test/regression/sections/10/11.xcql deleted file mode 100644 index ba2abe7..0000000 --- a/test/regression/sections/10/11.xcql +++ /dev/null @@ -1,38 +0,0 @@ - - - - ns1 - http://uri1 - - - ns2 - http://uri2 - - - cql.serverChoice - - = - - whatever - - - ns1.key - - - a - - - b - - - c - = - 1 - - - - - ns2.key2 - - - diff --git a/test/regression/sections/10/12.xcql b/test/regression/sections/10/12.xcql deleted file mode 100644 index 06b0ac2..0000000 --- a/test/regression/sections/10/12.xcql +++ /dev/null @@ -1,18 +0,0 @@ - - - - dc - x - - - b - - = - - c - - - d - - - diff --git a/test/regression/sections/10/13.xcql b/test/regression/sections/10/13.xcql deleted file mode 100644 index 06b0ac2..0000000 --- a/test/regression/sections/10/13.xcql +++ /dev/null @@ -1,18 +0,0 @@ - - - - dc - x - - - b - - = - - c - - - d - - - diff --git a/test/regression/sections/10/14.xcql b/test/regression/sections/10/14.xcql deleted file mode 100644 index 4f9f6d2..0000000 --- a/test/regression/sections/10/14.xcql +++ /dev/null @@ -1,34 +0,0 @@ - - - - dc - x - - - - and - - - - cql.serverChoice - - = - - c1 - - - - - cql.serverChoice - - = - - c2 - - - - - d - - - diff --git a/test/regression/sections/10/15.xcql b/test/regression/sections/10/15.xcql deleted file mode 100644 index fb278bc..0000000 --- a/test/regression/sections/10/15.xcql +++ /dev/null @@ -1,22 +0,0 @@ - - - - dc - http://deepcustard.org - - - dc - http://dublincore.org - - - dc.title - - = - - jaws - - - dc.custardDepth - - - diff --git a/test/regression/sections/10/16.xcql b/test/regression/sections/10/16.xcql deleted file mode 100644 index 42b01d6..0000000 --- a/test/regression/sections/10/16.xcql +++ /dev/null @@ -1,40 +0,0 @@ - - - - dc - http://deepcustard.org - - - - or - - - - cql.serverChoice - - = - - fish - - - - - - - dc - http://dublincore.org - - - dc.title - - = - - jaws - - - - - dc.custardDepth - - - diff --git a/test/regression/showtest b/test/regression/showtest deleted file mode 100755 index 0154d9d..0000000 --- a/test/regression/showtest +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - - -if [ $# != 1 ]; then - echo "Usage: $0 " >&2 - echo " e.g. $0 01/02" >&2 - exit 1 -fi - -### Warning: nasty hard-coded choices -( echo "=== Adam ===" - ../../../srw/cql/cql2xcql < sections/$1.cql ) > /tmp/adam -( echo "=== Mike ===" - ../../bin/CQLParser < sections/$1.cql ) > /tmp/mike -sdiff -w 80 /tmp/adam /tmp/mike diff --git a/test/regression/xmlpp.pl b/test/regression/xmlpp.pl deleted file mode 100755 index 9e8abef..0000000 --- a/test/regression/xmlpp.pl +++ /dev/null @@ -1,405 +0,0 @@ -#!/usr/bin/perl -w - -# -# Copyright (c) 2002, DecisionSoft Limited All rights reserved. -# Please see: -# http://software.decisionsoft.com/license.html -# for more information. -# - -# $Revision: 1.2 $ -# -# xmlpp: XML pretty printing -# - -# For custom attribute sorting create an attributeOrdering.txt file that -# lists each attributes separated by a newline in the order you would like -# them to be sorted separated by a newline. Then use the -s option. - -use FileHandle; -use Fcntl; -use Getopt::Std; - -use vars qw($opt_h $opt_H $opt_s $opt_z $opt_t $opt_e $opt_S $opt_c $opt_n $opt_l); - -my $indent=0; -my $textContent=''; -my $lastTag=undef; -my $output; -my $inAnnotation = 0; - - -if (!getopts('nzhHsteScl:') or $opt_h) { - usage(); -} - -my $indentSize = $opt_l || 2; - -if ($opt_s){ - -# expect to find attributeOrdering.txt file in same directory -# as xmlpp is being run from - - my $scriptDir = $0; - if ($scriptDir =~ m#/#){ - $scriptDir =~ s#/[^/]+$##; - } - else{ - $scriptDir ="."; - } - - # get attribute ordering from external file - if (open(SORTLIST, "<$scriptDir/attributeOrdering.txt")) { - @sortlist = ; - chomp @sortlist; - close (SORTLIST); - @specialSort = grep(/^\w+/, @sortlist); - } - else { - print STDERR "Could not open $scriptDir/attributeOrdering.txt: $!\nWARNING attribute sorting will only be alphabetic\n\n"; - } -} - - -# set line separator to ">" speeding up parsing of XML files -# with no line breaks - -$/ = ">"; - - -my $sortAttributes = $opt_s; -my $newLineComments = $opt_c; -my $splitAttributes = $opt_t; -my $schemaHackMode = $opt_S; -my $normaliseWhiteSpace = $opt_n; - -my $filename = $ARGV[0]; -if ($opt_z && (!$filename or $filename eq '-')) { - print STDERR "Error: I can't edit STDIN in place.\n"; - usage(); -} - -if (!$opt_z && scalar(@ARGV) > 1) { - print STDERR "Warning: Multiple files specified without -z option\n"; -} - -my $fh; - -my $stdin; - -if (!$filename or $filename eq '-') { - $fh=*STDIN; - $stdin=1; -} else { - $fh = open_next_file() or exit(1); - $stdin=0; -} - -do { - $indent=0; - $textContent=''; - $lastTag=undef; - $output = ''; - my $re_name = "(?:[A-Za-z0-9_:][A-Za-z0-9_:.-]*)"; - my $re_attr = "(?:'[^']*'|\"[^\"]*\")"; - my $input; - - while ($input .= <$fh>) { - while ($input) { - if ($input =~ s/^<($re_name)((?:\s+$re_name\s*=\s*$re_attr)*\s*)(\/?)>(.*)$/$4/s ) { - my %attr; - my ($name,$attr,$selfclose) = ($1,$2,$3); - while ($attr =~ m/($re_name)\s*=\s*($re_attr)/gs) { - my ($name,$value) = ($1,$2); - $value =~ s/^["'](.*)["']$/$1/s; - $attr{$name} = $value; - } - if ($opt_e) { - parseStart($name, 0, %attr); - if ($selfclose) { parseEnd($name) } - } else { - parseStart($name, $selfclose, %attr); - } - } elsif ($input =~ s/^<\/($re_name)\s*>(.*)$/$2/s) { - parseEnd($1); - } elsif ($input =~ s/^(.*)$/$2/s) { - parseComment($1); - } elsif ($input =~ s/^([^<]+)(.*)$/$2/s) { - parseDefault($1); - } elsif ($input =~ s/^(<\?[^>]*\?>)(.*)$/$2/s) { - parsePI("$1\n"); - } elsif ($input =~ s/^(<\!DOCTYPE[^\[>]*(\[[^\]]*\])?[^>]*>)(.*)$/$3/s) { - parseDoctype("$1"); - } else { - last; - } - } - if (eof($fh)) { - last; - } - } - - - if ($input) { - $input =~ m/([^\n]+)/gs; - print STDERR "WARNING: junk remaining on input: $1\n"; - } - $fh->close(); - - if (!$opt_z) { - if(!$opt_H){ - print "$output\n" - } else { - print html_escape($output)."\n" - } - } else { - if ($input) { - print STDERR "Not overwriting file\n"; - } else { - open FOUT,"> $filename" or die "Cannot overwrite file: $!"; - if(!$opt_H){ - print FOUT "$output\n" - } else { - print FOUT html_escape($output)."\n" - } - close FOUT - } - } -} while ( - !$stdin && $opt_z && ($fh = open_next_file(\$filename)) - ); - - - -sub parseStart { - my $s = shift; - my $selfclose = shift; - my %attr = @_; - - $textContent =~ s/\s+$//; - printContent($textContent); - - if($inAnnotation) { - return; - } - - if($schemaHackMode and $s =~ m/(^|:)annotation$/) { - $inAnnotation = 1; - $textContent = ''; - $lastTag = 1; - return; - } - if (length($output)) { - $output .= "\n"; - } - - $output .= " " x ($indent * $indentSize); - $output .= "<$s"; - my @k = keys %attr; - - if ($sortAttributes && (scalar(@k) > 1) ){ - - my @alphaSorted; - my @needSpecialSort; - my @final; - my $isSpecial; - - # sort attributes alphabetically (default ordering) - @alphaSorted = sort @k; - - # read through sorted list, if attribute doesn't have specified - # sort order, push it onto the end of the final array (this maintains - # alphabetic order). Else create a list that has attributes needing - # special ordering. - foreach $attribute (@alphaSorted){ - $isSpecial = 0; - foreach $sortAttrib (@specialSort){ - if ($attribute eq $sortAttrib){ - push @needSpecialSort, $attribute; - $isSpecial = 1; - } - } - if (!$isSpecial){ - push @final, $attribute; - } - } - - # now read through the specialSort list backwards looking for - # any match in the needSpecialSort list. Unshift this onto the - # front of the final array to maintain proper order. - foreach my $attribute (reverse @specialSort){ - foreach (@needSpecialSort){ - if ($attribute eq $_){ - unshift @final, $attribute; - } - } - } - - @k = @final; - } - - foreach my $attr (@k) { - # - # Remove (min|max)Occurs = 1 if schemaHackMode - # - if ($schemaHackMode and $attr =~ m/^(minOccurs|maxOccurs)$/ and $attr{$attr} eq "1") { - next; - } - - if ($splitAttributes) { - $output .= "\n"." " x ($indent * $indentSize) ." "; - } - if ($attr{$attr} =~ /'/) { - $output .= " $attr=\"$attr{$attr}\""; - } else { - $output .= " $attr='$attr{$attr}'"; - } - } - if ($splitAttributes and @k) { - $output .= "\n"." " x ($indent * $indentSize); - } - if ($selfclose) { - $output .= " />"; - $lastTag = 0; - } else { - $output .= ">"; - $indent++; - $lastTag = 1; - } - $textContent = ''; -} - -sub parseEnd { - my $s = shift; - - if($inAnnotation) { - if($s =~ m/(^|:)annotation$/) { - $inAnnotation = 0; - } - return; - } - - if($normaliseWhiteSpace) { - $textContent =~ s/^\s*(.*?)\s*$/$1/; - } - $indent--; - printContent($textContent); - if ($lastTag == 0) { - $output .= "\n"; - $output .= " " x ($indent * $indentSize); - } - $output .= ""; - $textContent = ''; - $lastTag = 0; -} - -sub parseDefault { - my $s = shift; - if($inAnnotation) { return } - $textContent .= "$s"; -} - -sub parsePI { - my $s = shift; - $output .= "$s"; -} - -sub parseDoctype { - my $s = shift; - if ($s =~ /^([^\[]*\[)([^\]]*)(\].*)$/ms) { - $start = $1; - $DTD = $2; - $finish = $3; - $DTD =~ s/\)(.*)/ms) { - $start = $1; - $xml = $2; - $finish = $3; - $xml =~ s/\\n"; - } else { - $output .= ""; - } - $textContent=''; -} - -sub printContent { - my $s = shift; - my $printLF = shift; - my ($LF,$ret) = ("",""); - - if ($s =~ m/\n\s*$/) { - $LF = "\n"; - } - if ($s =~ m/^[\s\n]*$/) { - $ret = undef; - } else { - $output .= "$s"; - $ret = 1; - } - if ($printLF) { - $output .= $LF; - } -} - - -sub html_escape { - my $s = shift; - $s =~ s/&/&/gsm; - $s =~ s//>/gsm; - return $s; -} - -sub open_next_file { - my $filename = shift; - $$filename = shift @ARGV; - while ($$filename and ! -f $$filename) { - print STDERR "WARNING: Could not find file: $$filename\n"; - $$filename = shift @ARGV; - } - if(!$$filename) { - return undef; - } - my $fh = new FileHandle; - $fh->open("< $$filename") or die "Can't open $$filename: $!"; - return $fh; -} - -sub usage { - print STDERR < Indent each level by spaces [default: 2] -EOF - exit 1; -} - diff --git a/util/random/Makefile b/util/random/Makefile new file mode 100644 index 0000000..d3e1421 --- /dev/null +++ b/util/random/Makefile @@ -0,0 +1,10 @@ + +all: ../../target/cql-java-1.8.jar + PATH=$(PATH):../../bin CLASSPATH=../../target/cql-java-1.8.jar ./mkrandom 100 + +../../target/cql-java-1.8.jar: + cd ../../ && mvn package + +clean: + @echo "Nothing to do to 'make clean'" + diff --git a/util/random/README b/util/random/README new file mode 100644 index 0000000..586796b --- /dev/null +++ b/util/random/README @@ -0,0 +1,14 @@ + +In this directory, we test the integrity of the CQL-Java tools as +follows: + +* Generate a random tree with CQLGenerate +* Take a copy +* Canonicalise it with CQLparser -c. +* Compare the before-and-after versions. + +Since the CQLGenerate output is in canonical form anyway, the +before-and-after versions should be identical. This process exercises +the comprehensiveness and bullet-proofing of the parser, as well as +the accuracy of the rendering. + diff --git a/util/random/mkrandom b/util/random/mkrandom new file mode 100755 index 0000000..131e9e7 --- /dev/null +++ b/util/random/mkrandom @@ -0,0 +1,27 @@ +#!/usr/bin/perl -w + + +use strict; + +my $n = 1; +if (@ARGV > 1) { + print STDERR "Usage: $0 []\n"; + exit 1; +} elsif (@ARGV == 1) { + $n = $ARGV[0]; +} + +my $nok = 0; +for (my $i = 0; $i < $n; $i++) { + print $i+1, " of $n -- "; + my $query=`CQLGenerator ../../etc/generate.properties`; + print $query; + my $canon=`CQLParser -c '$query'`; + if ($canon eq $query) { + $nok++; + } else { + print "ERROR: canonicalised query differs from original\n"; + } +} + +print "Passed $nok/$n -- ", int(100*$nok/$n), "%\n"; diff --git a/util/regression/Makefile b/util/regression/Makefile new file mode 100644 index 0000000..5243e41 --- /dev/null +++ b/util/regression/Makefile @@ -0,0 +1,30 @@ + +XMLCANONICALISER = cat +# Change this to "./xmlpp.pl" if you want to check for equivalence + +test: sections/01/01.cql sections/01/01.xcql + ./runtests ../../bin/CQLParser $(XMLCANONICALISER) + +test-adam: sections/01/01.cql sections/01/01.xcql + ./runtests ../../../srw/cql/cql2xcql $(XMLCANONICALISER) + +test-rob: sections/01/01.cql sections/01/01.xcql + ./runtests ../../../rob/CQLParser.py $(XMLCANONICALISER) + +sections/01/01.cql: mktests queries.raw + ./mktests queries.raw + +sections/01/01.xcql: mkanswers + ./mkanswers ../../bin/CQLParser +# OR ./mkanswers ../../../srw/cql/cql2xcql +# OR ./mkanswers ../../../rob/CQLParser.py +# Depending on which parser you want to use as your reference + +clean: + @echo "Nothing to do to 'make clean'" + +distclean: + find sections . -name '*.cql' -exec rm \{\} \; + +refclean: + find sections . -name '*.xcql' -exec rm \{\} \; diff --git a/util/regression/README b/util/regression/README new file mode 100644 index 0000000..0d7b96b --- /dev/null +++ b/util/regression/README @@ -0,0 +1,92 @@ + +If you just don't want to think about it +---------------------------------------- + +Just use "make" to run regression tests. + + +CQL-Java's regression-testing framework +--------------------------------------- + +"queries.raw" is the file of test queries as provided by Rob. +"mktests" parses the raw file into sections and individual queries +"sections" is the top-level directory created by that program. + "01", "02" etc. represent the sections within the raw file + "01/name", "02/name", etc. contain the names of the sections. + "01/01.cql", "01/02.cql" etc. are the CQL queries themselves. +"mkanswers" uses a trusted CQL compiler to generate corresponding XCQL. + "01/01.xcql", "01/02.xcql" etc. are the compiled XCQL queries. + +Apart from the CQL files, all of the files described to this point are +included in the distribution, with the "trusted" XCQL output produced +by my own compiler, and used for regression testing of new versions. +The CQL files are re-created from "queries.raw" as required. But +you're welcome to "make refclean" and rebuild it with mkanswers, to +contain the trusted compiler output of your choice. + +"runtests" compares the output of a nominated CQL compiler with +existing XCQL files. Most often, you'll use this to compare the +results of your own build of CQL-Java with those of my build. I'll +use it to test new versions, and people who've written other compilers +can use it to test their code. (The code of "runtests" and +"mkanswers" is worryingly similar: they should probably be the same +program invoked with different command-line arguments.) + +"Makefile" controls the building of all this. You'll need to edit it +if you want to use different compilers and suchlike from what's +written into it, so it may be easier to run the tests by hand -- but +it's a useful reference for the kinds of commands you might need, +anyway. In general, "make" will run the regression tests, creating +whatever CQL and/or XCQL files it needs; if you do "make refclean" +first, then the next "make" will rebuild the reference results. + +So, for example, if you think Rob Sanderson's parser, CQLParser.py, is +reliable, and you want to test my parser, CQL-Java's CQLParser class, +against its results, do this: + + make refclean + ./mktests queries.raw + ./mkanswers CQLParser.py + ./runtests ../../bin/CQLParser ./xmlpp.pl + +The second argument to ./runtests is the name of a program to use to +normalise XML, so that the trusted output and the output being tested +can be compared for equivalence rather than just for being +byte-identical. (If you want to test for byte-identical XCQL, then +use "cat" as the second argument.) xmlpp.pl is a fine XML +pretty-printer from DecisionSoft, found at + http://software.decisionsoft.com/tools.html + +"showtest" can be used to run a single test showing more details of +what goes wrong, if anything. You don't need it as part of the +regression test, but it's useful when debugging. + +Finally, "runcanon" checks that each of the queries when compiled and +decompiled back to CQL (i.e. canonicalised) remains identical when +recompiled and redecompiled. + + +Appendix: queries that should fail +---------------------------------- + +The following queries are included in Rob's master list, in a final +section called "Invalid searches [should error]". They are all +expected to fail in various ways. I've taken them out of +"queries.raw" because it's uninteresting, not to mention rather +disturbing, to watch compilers fail. More important, I think, to +demonstrate correct behaviour for the known-to-work queries. + +> +=== +cat or +index any +index any/wrong term +a prox/wrong b +() +(a +index any fish) +(cat any dog or ()) +title = ("illegal parentheses") +"quoted" any "illegal quotes" +> illegal="urn:missingQuery" +"fish" and > illegal="urn:invalidPrefixLocation" "chips" diff --git a/util/regression/mkanswers b/util/regression/mkanswers new file mode 100755 index 0000000..16e7dd2 --- /dev/null +++ b/util/regression/mkanswers @@ -0,0 +1,43 @@ +#!/usr/bin/perl -w + + +use IO::File; +use strict; + +$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; + +if (@ARGV != 1) { + print STDERR "Usage: $0 \n"; + exit(1); +} +my $compiler = $ARGV[0]; + +while () { + my $sdir = $_; + s@sections/@@; + next if /^CVS$/ || /^10$/; # I _can't_ get CVS to stop extracting "10" + print "answering section $_ - ", read_file("$sdir/name"), "\n"; + + while (<$sdir/*.cql>) { + my $qfile = $_; + s@sections/([0-9]+/.*)\.cql@$1@; + my $query = read_file($qfile); + my $afile = $qfile; + $afile =~ s/\.cql$/.xcql/; + print " wrote $_ - $query\n"; + my $fh = new IO::File("| $compiler > $afile") + or die "can't run compiler '$compiler': $!"; + print $fh $query; + $fh->close(); + } +} + +sub read_file { + my($name) = @_; + + my $fh = new IO::File("<$name") + or die "can't read '$name': $!"; + my $contents = join('', <$fh>); + $fh->close(); + return $contents; +} diff --git a/util/regression/mktests b/util/regression/mktests new file mode 100755 index 0000000..78057b0 --- /dev/null +++ b/util/regression/mktests @@ -0,0 +1,55 @@ +#!/usr/bin/perl -w + + +use IO::File; +use strict; + +maybe_mkdir("sections"); +my $section = 0; +my $dir; +my $query; + +while (<>) { + chomp(); + s/[ \t]+$//; + next if /^$/; + + if (s/^#[ \t]*//) { + $section++; + $query = 0; + $dir = "sections/" . substr("0$section", -2); + maybe_mkdir($dir); + write_file("$dir/name", $_); + print "created section $section ($dir) - $_\n"; + next; + } + + die "query before first section header" + if !defined $dir; + + $query++; + my $filename = $dir . "/" . substr("0$query", -2) . ".cql"; + write_file($filename, $_); + $filename =~ s@sections/(.*)\.cql@$1@; + print " added $filename - $_\n"; +} + +sub write_file { + my($name, $contents) = @_; + + my $fh = new IO::File(">$name") + or die "can't create '$name': $!"; + $fh->print($contents); + $fh->close(); +} + +sub maybe_mkdir { + my($dir) = shift(); + if (mkdir $dir) { + return; + } + if ($! =~ /exists/i) { + return; + } + die "can't create directory '$dir': $!"; +} diff --git a/util/regression/queries.raw b/util/regression/queries.raw new file mode 100644 index 0000000..6075e69 --- /dev/null +++ b/util/regression/queries.raw @@ -0,0 +1,112 @@ + +# Simple + +cat +"cat" +comp.os.linux +xml:element +"" +"=" +"prox/distance<3/unit=word" +("cat") +((dog)) +all +prox + +# Index Relation Term + +title = "fish" +title exact fish +title any fish +title all fish +title > 9 +title >= 23 +dc.title any "fish chips" +dc.title any/stem fish +dc.fish all/stem/fuzzy "fish chips" +(title any frog) +((dc.title any/stem "frog pond")) +dc.title any "fish frog chicken" +dc.title =/rel.algorithm=CORI squid +author any/f.foo/b.bar>1 "sanderson taylor" +numberOfLegs <= 4 +numberOfLegs <> 4 +title == jaws + +# Simple Boolean + +cat or dog +cat and fish +cat not frog +(cat not frog) +"cat" not "fish food" +xml and "prox///" +fred and any +((fred or all)) +a or b and c not d + +# I/R/T plus Boolean + +bath.author any fish and dc.title all "cat dog" +(title any/stem "fish dog" or and) + +# Prox + +cat prox hat +cat prox/distance=3/unit=word/ordered hat +cat prox/distance<3 hat +"fish food" prox/unit=sentence and +title all "chips frog" prox/distance<=5 exact +(dc.author == "jones" prox/distance>5/unit=element title >= "smith") +((cat prox hat)) +a and/rel.SumOfScores b +a and/rel.algorithm=CORI b + +# Special Characters + +(cat^) +"cat" +"^cat says \"fish\"" +"cat*fish" +cat?dog +(("^cat*fishdog\"horse?")) + +# Nesting Parentheses + +(((cat or dog) or horse) and frog) +(cat and dog) or (horse and frog) +(cat and (horse or frog)) and chips + +# Prefix Maps + +> foo="http://www.loc.gov/zing/cql/dc-indexes/" dc.title="fish" +> "http://www.loc.gov/zing/cql/dc-indexes/" title="fish" +> foo="http://www.loc.gov/zing/cql/dc-indexes" > ccg = "http://srw.o-r-g.org/cql/indexSets/ccg/" foo.title="fish" and ccg.force=3 + +# Lame Searches + +any or all:stem and all contains any prox proxfuzzy +(((((((((any))))))))) +"" +> any > any = exact any > any +sortby sortby sortby +sortby sortby sortby sortby sortby + +# Sorting + +kernighan sortby title +kernighan and ritchie sortby title +dc.creator=kernighan sortby dc.title +dc.creator=kernighan sortby numberOfLegs/cql.number +dc.creator=kernighan sortby dc.title/sort.respectCase +dc.creator=kernighan sortby dc.title/sort.respectCase/sort.descending +dc.creator=kernighan sortby dc.date dc.title +dc.creator=kernighan sortby dc.date/sort.missingOmit +dc.creator=kernighan sortby dc.date/sort.missingValue=1970 +>dc="http://deepcustard.org/1.0" blah sortby dc.custardDepth +>ns1="http://uri1" >ns2="http://uri2" whatever sortby ns1.key/a/b/c=1 ns2.key2 +(>dc=x b=c) sortby d +b=(>dc=x c) sortby d +(>dc=x c1 and c2) sortby d +>dc="http://deepcustard.org" (>dc="http://dublincore.org" dc.title=jaws) sortby dc.custardDepth +>dc="http://deepcustard.org" (fish or >dc="http://dublincore.org" dc.title=jaws) sortby dc.custardDepth diff --git a/util/regression/runcanon b/util/regression/runcanon new file mode 100755 index 0000000..46d6a93 --- /dev/null +++ b/util/regression/runcanon @@ -0,0 +1,51 @@ +#!/usr/bin/perl -w + +# +# Tests that all sample queries can be rendered into idempotent +# canoncial form. + +use IO::File; +use strict; + +$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; + +my($ntests, $ncorrect) = (0, 0); + +while () { + my $sdir = $_; + s@sections/@@; + next if /^CVS$/ || /^10$/; + print "testing section $_ - ", read_file("$sdir/name"), "\n"; + + while (<$sdir/*.cql>) { + my $qfile = $_; + s@sections/([0-9]+/.*)\.cql@$1@; + my $query = read_file($qfile); + my $canonical = `CQLParser -c '$query'`; + chomp($canonical); + my $maybe = `CQLParser -c '$canonical'`; + chomp($maybe); + print "$query // $canonical "; + $ntests++; + if ($maybe eq $canonical) { + $ncorrect++; + print " OK\n"; + } else { + print "### $maybe\n"; + } + } +} + +print sprintf("%d of %d passed: %d%%\n", + $ncorrect, $ntests, (100 * $ncorrect) / $ntests); + +sub read_file { + my($name) = @_; + + $name = "<$name" if $name !~ /\|$/; + my $fh = new IO::File("$name") + or die "can't read '$name': $!"; + my $contents = join('', <$fh>); + $fh->close(); + return $contents; +} diff --git a/util/regression/runtests b/util/regression/runtests new file mode 100755 index 0000000..c12cd3c --- /dev/null +++ b/util/regression/runtests @@ -0,0 +1,59 @@ +#!/usr/bin/perl -w + + +use IO::File; +use strict; + +$ENV{CLASSPATH} .= ":../../src/main/java"; +$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; + +if (@ARGV != 2) { + print STDERR "Usage: $0 \n"; + exit(1); +} +my $compiler = $ARGV[0]; +my $norman = $ARGV[1]; # name of XML normaliser program +my($ntests, $ncorrect) = (0, 0); + +while () { + my $sdir = $_; + s@sections/@@; + next if /^CVS$/; + print "testing section $_ - ", read_file("$sdir/name"), "\n"; + + while (<$sdir/*.cql>) { + my $qfile = $_; + s@sections/([0-9]+/.*)\.cql@$1@; + my $query = read_file($qfile); + my $afile = $qfile; + $afile =~ s/\.cql$/.xcql/; + print " query $_ - $query "; + $ntests++; + my $correct = read_file("$norman < $afile |"); + my $tested = read_file("$compiler < $qfile | $norman |"); + if (!$tested) { + print "\n *** test compiler exited non-zero\n"; + } elsif ($tested eq $correct) { + print "OK\n"; + $ncorrect++; + } else { + print "\n *** XCQL output differs from $afile\n"; + print "=== tested ===\n$tested"; + print "=== end ===\n"; + } + } +} + +print sprintf("%d of %d passed: %d%%\n", + $ncorrect, $ntests, (100 * $ncorrect) / $ntests); + +sub read_file { + my($name) = @_; + + $name = "<$name" if $name !~ /\|$/; + my $fh = new IO::File("$name") + or die "can't read '$name': $!"; + my $contents = join('', <$fh>); + $fh->close(); + return $contents; +} diff --git a/util/regression/sections/01/.gitignore b/util/regression/sections/01/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/01/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/01/01.xcql b/util/regression/sections/01/01.xcql new file mode 100644 index 0000000..48aee99 --- /dev/null +++ b/util/regression/sections/01/01.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat + diff --git a/util/regression/sections/01/02.xcql b/util/regression/sections/01/02.xcql new file mode 100644 index 0000000..48aee99 --- /dev/null +++ b/util/regression/sections/01/02.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat + diff --git a/util/regression/sections/01/03.xcql b/util/regression/sections/01/03.xcql new file mode 100644 index 0000000..af191d3 --- /dev/null +++ b/util/regression/sections/01/03.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + comp.os.linux + diff --git a/util/regression/sections/01/04.xcql b/util/regression/sections/01/04.xcql new file mode 100644 index 0000000..4141430 --- /dev/null +++ b/util/regression/sections/01/04.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + xml:element + diff --git a/util/regression/sections/01/05.xcql b/util/regression/sections/01/05.xcql new file mode 100644 index 0000000..6ec410e --- /dev/null +++ b/util/regression/sections/01/05.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + <xml:element> + diff --git a/util/regression/sections/01/06.xcql b/util/regression/sections/01/06.xcql new file mode 100644 index 0000000..da69755 --- /dev/null +++ b/util/regression/sections/01/06.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + = + diff --git a/util/regression/sections/01/07.xcql b/util/regression/sections/01/07.xcql new file mode 100644 index 0000000..851a5c1 --- /dev/null +++ b/util/regression/sections/01/07.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + prox/distance<3/unit=word + diff --git a/util/regression/sections/01/08.xcql b/util/regression/sections/01/08.xcql new file mode 100644 index 0000000..48aee99 --- /dev/null +++ b/util/regression/sections/01/08.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat + diff --git a/util/regression/sections/01/09.xcql b/util/regression/sections/01/09.xcql new file mode 100644 index 0000000..d41b39e --- /dev/null +++ b/util/regression/sections/01/09.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + dog + diff --git a/util/regression/sections/01/10.xcql b/util/regression/sections/01/10.xcql new file mode 100644 index 0000000..c5ac7f6 --- /dev/null +++ b/util/regression/sections/01/10.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + all + diff --git a/util/regression/sections/01/11.xcql b/util/regression/sections/01/11.xcql new file mode 100644 index 0000000..88da9eb --- /dev/null +++ b/util/regression/sections/01/11.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + prox + diff --git a/util/regression/sections/02/.gitignore b/util/regression/sections/02/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/02/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/02/01.xcql b/util/regression/sections/02/01.xcql new file mode 100644 index 0000000..be3c9c1 --- /dev/null +++ b/util/regression/sections/02/01.xcql @@ -0,0 +1,7 @@ + + title + + = + + fish + diff --git a/util/regression/sections/02/02.xcql b/util/regression/sections/02/02.xcql new file mode 100644 index 0000000..2b78ddf --- /dev/null +++ b/util/regression/sections/02/02.xcql @@ -0,0 +1,7 @@ + + title + + exact + + fish + diff --git a/util/regression/sections/02/03.xcql b/util/regression/sections/02/03.xcql new file mode 100644 index 0000000..62521be --- /dev/null +++ b/util/regression/sections/02/03.xcql @@ -0,0 +1,7 @@ + + title + + any + + fish + diff --git a/util/regression/sections/02/04.xcql b/util/regression/sections/02/04.xcql new file mode 100644 index 0000000..646c973 --- /dev/null +++ b/util/regression/sections/02/04.xcql @@ -0,0 +1,7 @@ + + title + + all + + fish + diff --git a/util/regression/sections/02/05.xcql b/util/regression/sections/02/05.xcql new file mode 100644 index 0000000..92411c4 --- /dev/null +++ b/util/regression/sections/02/05.xcql @@ -0,0 +1,7 @@ + + title + + > + + 9 + diff --git a/util/regression/sections/02/06.xcql b/util/regression/sections/02/06.xcql new file mode 100644 index 0000000..6702471 --- /dev/null +++ b/util/regression/sections/02/06.xcql @@ -0,0 +1,7 @@ + + title + + >= + + 23 + diff --git a/util/regression/sections/02/07.xcql b/util/regression/sections/02/07.xcql new file mode 100644 index 0000000..ba4ac78 --- /dev/null +++ b/util/regression/sections/02/07.xcql @@ -0,0 +1,7 @@ + + dc.title + + any + + fish chips + diff --git a/util/regression/sections/02/08.xcql b/util/regression/sections/02/08.xcql new file mode 100644 index 0000000..1576778 --- /dev/null +++ b/util/regression/sections/02/08.xcql @@ -0,0 +1,12 @@ + + dc.title + + any + + + stem + + + + fish + diff --git a/util/regression/sections/02/09.xcql b/util/regression/sections/02/09.xcql new file mode 100644 index 0000000..9f8abff --- /dev/null +++ b/util/regression/sections/02/09.xcql @@ -0,0 +1,15 @@ + + dc.fish + + all + + + stem + + + fuzzy + + + + fish chips + diff --git a/util/regression/sections/02/10.xcql b/util/regression/sections/02/10.xcql new file mode 100644 index 0000000..d7dfe7a --- /dev/null +++ b/util/regression/sections/02/10.xcql @@ -0,0 +1,7 @@ + + title + + any + + frog + diff --git a/util/regression/sections/02/11.xcql b/util/regression/sections/02/11.xcql new file mode 100644 index 0000000..726a36e --- /dev/null +++ b/util/regression/sections/02/11.xcql @@ -0,0 +1,12 @@ + + dc.title + + any + + + stem + + + + frog pond + diff --git a/util/regression/sections/02/12.xcql b/util/regression/sections/02/12.xcql new file mode 100644 index 0000000..b4bcf3b --- /dev/null +++ b/util/regression/sections/02/12.xcql @@ -0,0 +1,7 @@ + + dc.title + + any + + fish frog chicken + diff --git a/util/regression/sections/02/13.xcql b/util/regression/sections/02/13.xcql new file mode 100644 index 0000000..6f3c011 --- /dev/null +++ b/util/regression/sections/02/13.xcql @@ -0,0 +1,14 @@ + + dc.title + + = + + + rel.algorithm + = + CORI + + + + squid + diff --git a/util/regression/sections/02/14.xcql b/util/regression/sections/02/14.xcql new file mode 100644 index 0000000..c833d26 --- /dev/null +++ b/util/regression/sections/02/14.xcql @@ -0,0 +1,17 @@ + + author + + any + + + f.foo + + + b.bar + > + 1 + + + + sanderson taylor + diff --git a/util/regression/sections/02/15.xcql b/util/regression/sections/02/15.xcql new file mode 100644 index 0000000..3a23abe --- /dev/null +++ b/util/regression/sections/02/15.xcql @@ -0,0 +1,7 @@ + + numberOfLegs + + <= + + 4 + diff --git a/util/regression/sections/02/16.xcql b/util/regression/sections/02/16.xcql new file mode 100644 index 0000000..0e8eccd --- /dev/null +++ b/util/regression/sections/02/16.xcql @@ -0,0 +1,7 @@ + + numberOfLegs + + <> + + 4 + diff --git a/util/regression/sections/02/17.xcql b/util/regression/sections/02/17.xcql new file mode 100644 index 0000000..b2587ff --- /dev/null +++ b/util/regression/sections/02/17.xcql @@ -0,0 +1,7 @@ + + title + + == + + jaws + diff --git a/util/regression/sections/03/.gitignore b/util/regression/sections/03/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/03/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/03/01.xcql b/util/regression/sections/03/01.xcql new file mode 100644 index 0000000..fc1b678 --- /dev/null +++ b/util/regression/sections/03/01.xcql @@ -0,0 +1,23 @@ + + + or + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + dog + + + diff --git a/util/regression/sections/03/02.xcql b/util/regression/sections/03/02.xcql new file mode 100644 index 0000000..55ae66a --- /dev/null +++ b/util/regression/sections/03/02.xcql @@ -0,0 +1,23 @@ + + + and + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + fish + + + diff --git a/util/regression/sections/03/03.xcql b/util/regression/sections/03/03.xcql new file mode 100644 index 0000000..2f4f6c0 --- /dev/null +++ b/util/regression/sections/03/03.xcql @@ -0,0 +1,23 @@ + + + not + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + frog + + + diff --git a/util/regression/sections/03/04.xcql b/util/regression/sections/03/04.xcql new file mode 100644 index 0000000..2f4f6c0 --- /dev/null +++ b/util/regression/sections/03/04.xcql @@ -0,0 +1,23 @@ + + + not + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + frog + + + diff --git a/util/regression/sections/03/05.xcql b/util/regression/sections/03/05.xcql new file mode 100644 index 0000000..9ad0700 --- /dev/null +++ b/util/regression/sections/03/05.xcql @@ -0,0 +1,23 @@ + + + not + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + fish food + + + diff --git a/util/regression/sections/03/06.xcql b/util/regression/sections/03/06.xcql new file mode 100644 index 0000000..7b8dae8 --- /dev/null +++ b/util/regression/sections/03/06.xcql @@ -0,0 +1,23 @@ + + + and + + + + cql.serverChoice + + = + + xml + + + + + cql.serverChoice + + = + + prox/// + + + diff --git a/util/regression/sections/03/07.xcql b/util/regression/sections/03/07.xcql new file mode 100644 index 0000000..5e0076e --- /dev/null +++ b/util/regression/sections/03/07.xcql @@ -0,0 +1,23 @@ + + + and + + + + cql.serverChoice + + = + + fred + + + + + cql.serverChoice + + = + + any + + + diff --git a/util/regression/sections/03/08.xcql b/util/regression/sections/03/08.xcql new file mode 100644 index 0000000..f080d4b --- /dev/null +++ b/util/regression/sections/03/08.xcql @@ -0,0 +1,23 @@ + + + or + + + + cql.serverChoice + + = + + fred + + + + + cql.serverChoice + + = + + all + + + diff --git a/util/regression/sections/03/09.xcql b/util/regression/sections/03/09.xcql new file mode 100644 index 0000000..4f3ade7 --- /dev/null +++ b/util/regression/sections/03/09.xcql @@ -0,0 +1,55 @@ + + + not + + + + + and + + + + + or + + + + cql.serverChoice + + = + + a + + + + + cql.serverChoice + + = + + b + + + + + + + cql.serverChoice + + = + + c + + + + + + + cql.serverChoice + + = + + d + + + diff --git a/util/regression/sections/04/.gitignore b/util/regression/sections/04/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/04/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/04/01.xcql b/util/regression/sections/04/01.xcql new file mode 100644 index 0000000..6f3ec27 --- /dev/null +++ b/util/regression/sections/04/01.xcql @@ -0,0 +1,23 @@ + + + and + + + + bath.author + + any + + fish + + + + + dc.title + + all + + cat dog + + + diff --git a/util/regression/sections/04/02.xcql b/util/regression/sections/04/02.xcql new file mode 100644 index 0000000..0dcb869 --- /dev/null +++ b/util/regression/sections/04/02.xcql @@ -0,0 +1,28 @@ + + + or + + + + title + + any + + + stem + + + + fish dog + + + + + cql.serverChoice + + = + + and + + + diff --git a/util/regression/sections/05/.gitignore b/util/regression/sections/05/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/05/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/05/01.xcql b/util/regression/sections/05/01.xcql new file mode 100644 index 0000000..406d103 --- /dev/null +++ b/util/regression/sections/05/01.xcql @@ -0,0 +1,23 @@ + + + prox + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + hat + + + diff --git a/util/regression/sections/05/02.xcql b/util/regression/sections/05/02.xcql new file mode 100644 index 0000000..f09ab0b --- /dev/null +++ b/util/regression/sections/05/02.xcql @@ -0,0 +1,38 @@ + + + prox + + + distance + = + 3 + + + unit + = + word + + + ordered + + + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + hat + + + diff --git a/util/regression/sections/05/03.xcql b/util/regression/sections/05/03.xcql new file mode 100644 index 0000000..25c5377 --- /dev/null +++ b/util/regression/sections/05/03.xcql @@ -0,0 +1,30 @@ + + + prox + + + distance + < + 3 + + + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + hat + + + diff --git a/util/regression/sections/05/04.xcql b/util/regression/sections/05/04.xcql new file mode 100644 index 0000000..a6e2198 --- /dev/null +++ b/util/regression/sections/05/04.xcql @@ -0,0 +1,30 @@ + + + prox + + + unit + = + sentence + + + + + + cql.serverChoice + + = + + fish food + + + + + cql.serverChoice + + = + + and + + + diff --git a/util/regression/sections/05/05.xcql b/util/regression/sections/05/05.xcql new file mode 100644 index 0000000..a59341f --- /dev/null +++ b/util/regression/sections/05/05.xcql @@ -0,0 +1,30 @@ + + + prox + + + distance + <= + 5 + + + + + + title + + all + + chips frog + + + + + cql.serverChoice + + = + + exact + + + diff --git a/util/regression/sections/05/06.xcql b/util/regression/sections/05/06.xcql new file mode 100644 index 0000000..4ffea29 --- /dev/null +++ b/util/regression/sections/05/06.xcql @@ -0,0 +1,35 @@ + + + prox + + + distance + > + 5 + + + unit + = + element + + + + + + dc.author + + == + + jones + + + + + title + + >= + + smith + + + diff --git a/util/regression/sections/05/07.xcql b/util/regression/sections/05/07.xcql new file mode 100644 index 0000000..406d103 --- /dev/null +++ b/util/regression/sections/05/07.xcql @@ -0,0 +1,23 @@ + + + prox + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + hat + + + diff --git a/util/regression/sections/05/08.xcql b/util/regression/sections/05/08.xcql new file mode 100644 index 0000000..b46dcfd --- /dev/null +++ b/util/regression/sections/05/08.xcql @@ -0,0 +1,28 @@ + + + and + + + rel.sumofscores + + + + + + cql.serverChoice + + = + + a + + + + + cql.serverChoice + + = + + b + + + diff --git a/util/regression/sections/05/09.xcql b/util/regression/sections/05/09.xcql new file mode 100644 index 0000000..1dc3602 --- /dev/null +++ b/util/regression/sections/05/09.xcql @@ -0,0 +1,30 @@ + + + and + + + rel.algorithm + = + CORI + + + + + + cql.serverChoice + + = + + a + + + + + cql.serverChoice + + = + + b + + + diff --git a/util/regression/sections/06/.gitignore b/util/regression/sections/06/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/06/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/06/01.xcql b/util/regression/sections/06/01.xcql new file mode 100644 index 0000000..0dcc5fb --- /dev/null +++ b/util/regression/sections/06/01.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat^ + diff --git a/util/regression/sections/06/02.xcql b/util/regression/sections/06/02.xcql new file mode 100644 index 0000000..48aee99 --- /dev/null +++ b/util/regression/sections/06/02.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat + diff --git a/util/regression/sections/06/03.xcql b/util/regression/sections/06/03.xcql new file mode 100644 index 0000000..9db40ae --- /dev/null +++ b/util/regression/sections/06/03.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + ^cat says "fish" + diff --git a/util/regression/sections/06/04.xcql b/util/regression/sections/06/04.xcql new file mode 100644 index 0000000..ee38b0e --- /dev/null +++ b/util/regression/sections/06/04.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat*fish + diff --git a/util/regression/sections/06/05.xcql b/util/regression/sections/06/05.xcql new file mode 100644 index 0000000..dc59539 --- /dev/null +++ b/util/regression/sections/06/05.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + cat?dog + diff --git a/util/regression/sections/06/06.xcql b/util/regression/sections/06/06.xcql new file mode 100644 index 0000000..9d38695 --- /dev/null +++ b/util/regression/sections/06/06.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + ^cat*fishdog"horse? + diff --git a/util/regression/sections/07/.gitignore b/util/regression/sections/07/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/07/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/07/01.xcql b/util/regression/sections/07/01.xcql new file mode 100644 index 0000000..3338a9f --- /dev/null +++ b/util/regression/sections/07/01.xcql @@ -0,0 +1,55 @@ + + + and + + + + + or + + + + + or + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + dog + + + + + + + cql.serverChoice + + = + + horse + + + + + + + cql.serverChoice + + = + + frog + + + diff --git a/util/regression/sections/07/02.xcql b/util/regression/sections/07/02.xcql new file mode 100644 index 0000000..1324889 --- /dev/null +++ b/util/regression/sections/07/02.xcql @@ -0,0 +1,55 @@ + + + or + + + + + and + + + + cql.serverChoice + + = + + cat + + + + + cql.serverChoice + + = + + dog + + + + + + + + and + + + + cql.serverChoice + + = + + horse + + + + + cql.serverChoice + + = + + frog + + + + + diff --git a/util/regression/sections/07/03.xcql b/util/regression/sections/07/03.xcql new file mode 100644 index 0000000..202af98 --- /dev/null +++ b/util/regression/sections/07/03.xcql @@ -0,0 +1,55 @@ + + + and + + + + + and + + + + cql.serverChoice + + = + + cat + + + + + + or + + + + cql.serverChoice + + = + + horse + + + + + cql.serverChoice + + = + + frog + + + + + + + + + cql.serverChoice + + = + + chips + + + diff --git a/util/regression/sections/08/.gitignore b/util/regression/sections/08/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/08/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/08/01.xcql b/util/regression/sections/08/01.xcql new file mode 100644 index 0000000..4e2d548 --- /dev/null +++ b/util/regression/sections/08/01.xcql @@ -0,0 +1,13 @@ + + + + foo + http://www.loc.gov/zing/cql/dc-indexes/ + + + dc.title + + = + + fish + diff --git a/util/regression/sections/08/02.xcql b/util/regression/sections/08/02.xcql new file mode 100644 index 0000000..63ce6ad --- /dev/null +++ b/util/regression/sections/08/02.xcql @@ -0,0 +1,12 @@ + + + + http://www.loc.gov/zing/cql/dc-indexes/ + + + title + + = + + fish + diff --git a/util/regression/sections/08/03.xcql b/util/regression/sections/08/03.xcql new file mode 100644 index 0000000..025c7c9 --- /dev/null +++ b/util/regression/sections/08/03.xcql @@ -0,0 +1,33 @@ + + + + foo + http://www.loc.gov/zing/cql/dc-indexes + + + ccg + http://srw.o-r-g.org/cql/indexSets/ccg/ + + + + and + + + + foo.title + + = + + fish + + + + + ccg.force + + = + + 3 + + + diff --git a/util/regression/sections/09/.gitignore b/util/regression/sections/09/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/09/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/09/01.xcql b/util/regression/sections/09/01.xcql new file mode 100644 index 0000000..f721ed0 --- /dev/null +++ b/util/regression/sections/09/01.xcql @@ -0,0 +1,39 @@ + + + and + + + + + or + + + + cql.serverChoice + + = + + any + + + + + cql.serverChoice + + = + + all:stem + + + + + + + all contains + + any + + prox proxfuzzy + + + diff --git a/util/regression/sections/09/02.xcql b/util/regression/sections/09/02.xcql new file mode 100644 index 0000000..dd7c8f0 --- /dev/null +++ b/util/regression/sections/09/02.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + any + diff --git a/util/regression/sections/09/03.xcql b/util/regression/sections/09/03.xcql new file mode 100644 index 0000000..1eeff16 --- /dev/null +++ b/util/regression/sections/09/03.xcql @@ -0,0 +1,7 @@ + + cql.serverChoice + + = + + + diff --git a/util/regression/sections/09/04.xcql b/util/regression/sections/09/04.xcql new file mode 100644 index 0000000..aed8eca --- /dev/null +++ b/util/regression/sections/09/04.xcql @@ -0,0 +1,16 @@ + + + + any + + + any + exact + + + any + + > + + any + diff --git a/util/regression/sections/09/05.xcql b/util/regression/sections/09/05.xcql new file mode 100644 index 0000000..578af0f --- /dev/null +++ b/util/regression/sections/09/05.xcql @@ -0,0 +1,12 @@ + + cql.serverChoice + + = + + sortby + + + sortby + + + diff --git a/util/regression/sections/09/06.xcql b/util/regression/sections/09/06.xcql new file mode 100644 index 0000000..2e136b5 --- /dev/null +++ b/util/regression/sections/09/06.xcql @@ -0,0 +1,18 @@ + + cql.serverChoice + + = + + sortby + + + sortby + + + sortby + + + sortby + + + diff --git a/util/regression/sections/10/.gitignore b/util/regression/sections/10/.gitignore new file mode 100644 index 0000000..b03b3d1 --- /dev/null +++ b/util/regression/sections/10/.gitignore @@ -0,0 +1,2 @@ +name +*.cql diff --git a/util/regression/sections/10/01.xcql b/util/regression/sections/10/01.xcql new file mode 100644 index 0000000..0c8cc74 --- /dev/null +++ b/util/regression/sections/10/01.xcql @@ -0,0 +1,12 @@ + + cql.serverChoice + + = + + kernighan + + + title + + + diff --git a/util/regression/sections/10/02.xcql b/util/regression/sections/10/02.xcql new file mode 100644 index 0000000..dbd6407 --- /dev/null +++ b/util/regression/sections/10/02.xcql @@ -0,0 +1,28 @@ + + + and + + + + cql.serverChoice + + = + + kernighan + + + + + cql.serverChoice + + = + + ritchie + + + + + title + + + diff --git a/util/regression/sections/10/03.xcql b/util/regression/sections/10/03.xcql new file mode 100644 index 0000000..eaef782 --- /dev/null +++ b/util/regression/sections/10/03.xcql @@ -0,0 +1,12 @@ + + dc.creator + + = + + kernighan + + + dc.title + + + diff --git a/util/regression/sections/10/04.xcql b/util/regression/sections/10/04.xcql new file mode 100644 index 0000000..3a32884 --- /dev/null +++ b/util/regression/sections/10/04.xcql @@ -0,0 +1,17 @@ + + dc.creator + + = + + kernighan + + + numberOfLegs + + + cql.number + + + + + diff --git a/util/regression/sections/10/05.xcql b/util/regression/sections/10/05.xcql new file mode 100644 index 0000000..5821b04 --- /dev/null +++ b/util/regression/sections/10/05.xcql @@ -0,0 +1,17 @@ + + dc.creator + + = + + kernighan + + + dc.title + + + sort.respectcase + + + + + diff --git a/util/regression/sections/10/06.xcql b/util/regression/sections/10/06.xcql new file mode 100644 index 0000000..8d232b2 --- /dev/null +++ b/util/regression/sections/10/06.xcql @@ -0,0 +1,20 @@ + + dc.creator + + = + + kernighan + + + dc.title + + + sort.respectcase + + + sort.descending + + + + + diff --git a/util/regression/sections/10/07.xcql b/util/regression/sections/10/07.xcql new file mode 100644 index 0000000..13737ee --- /dev/null +++ b/util/regression/sections/10/07.xcql @@ -0,0 +1,15 @@ + + dc.creator + + = + + kernighan + + + dc.date + + + dc.title + + + diff --git a/util/regression/sections/10/08.xcql b/util/regression/sections/10/08.xcql new file mode 100644 index 0000000..bcf2a8f --- /dev/null +++ b/util/regression/sections/10/08.xcql @@ -0,0 +1,17 @@ + + dc.creator + + = + + kernighan + + + dc.date + + + sort.missingomit + + + + + diff --git a/util/regression/sections/10/09.xcql b/util/regression/sections/10/09.xcql new file mode 100644 index 0000000..8a60d51 --- /dev/null +++ b/util/regression/sections/10/09.xcql @@ -0,0 +1,19 @@ + + dc.creator + + = + + kernighan + + + dc.date + + + sort.missingvalue + = + 1970 + + + + + diff --git a/util/regression/sections/10/10.xcql b/util/regression/sections/10/10.xcql new file mode 100644 index 0000000..cb97df6 --- /dev/null +++ b/util/regression/sections/10/10.xcql @@ -0,0 +1,18 @@ + + + + dc + http://deepcustard.org/1.0 + + + cql.serverChoice + + = + + blah + + + dc.custardDepth + + + diff --git a/util/regression/sections/10/11.xcql b/util/regression/sections/10/11.xcql new file mode 100644 index 0000000..ba2abe7 --- /dev/null +++ b/util/regression/sections/10/11.xcql @@ -0,0 +1,38 @@ + + + + ns1 + http://uri1 + + + ns2 + http://uri2 + + + cql.serverChoice + + = + + whatever + + + ns1.key + + + a + + + b + + + c + = + 1 + + + + + ns2.key2 + + + diff --git a/util/regression/sections/10/12.xcql b/util/regression/sections/10/12.xcql new file mode 100644 index 0000000..06b0ac2 --- /dev/null +++ b/util/regression/sections/10/12.xcql @@ -0,0 +1,18 @@ + + + + dc + x + + + b + + = + + c + + + d + + + diff --git a/util/regression/sections/10/13.xcql b/util/regression/sections/10/13.xcql new file mode 100644 index 0000000..06b0ac2 --- /dev/null +++ b/util/regression/sections/10/13.xcql @@ -0,0 +1,18 @@ + + + + dc + x + + + b + + = + + c + + + d + + + diff --git a/util/regression/sections/10/14.xcql b/util/regression/sections/10/14.xcql new file mode 100644 index 0000000..4f9f6d2 --- /dev/null +++ b/util/regression/sections/10/14.xcql @@ -0,0 +1,34 @@ + + + + dc + x + + + + and + + + + cql.serverChoice + + = + + c1 + + + + + cql.serverChoice + + = + + c2 + + + + + d + + + diff --git a/util/regression/sections/10/15.xcql b/util/regression/sections/10/15.xcql new file mode 100644 index 0000000..fb278bc --- /dev/null +++ b/util/regression/sections/10/15.xcql @@ -0,0 +1,22 @@ + + + + dc + http://deepcustard.org + + + dc + http://dublincore.org + + + dc.title + + = + + jaws + + + dc.custardDepth + + + diff --git a/util/regression/sections/10/16.xcql b/util/regression/sections/10/16.xcql new file mode 100644 index 0000000..42b01d6 --- /dev/null +++ b/util/regression/sections/10/16.xcql @@ -0,0 +1,40 @@ + + + + dc + http://deepcustard.org + + + + or + + + + cql.serverChoice + + = + + fish + + + + + + + dc + http://dublincore.org + + + dc.title + + = + + jaws + + + + + dc.custardDepth + + + diff --git a/util/regression/showtest b/util/regression/showtest new file mode 100755 index 0000000..0154d9d --- /dev/null +++ b/util/regression/showtest @@ -0,0 +1,15 @@ +#!/bin/sh + + +if [ $# != 1 ]; then + echo "Usage: $0 " >&2 + echo " e.g. $0 01/02" >&2 + exit 1 +fi + +### Warning: nasty hard-coded choices +( echo "=== Adam ===" + ../../../srw/cql/cql2xcql < sections/$1.cql ) > /tmp/adam +( echo "=== Mike ===" + ../../bin/CQLParser < sections/$1.cql ) > /tmp/mike +sdiff -w 80 /tmp/adam /tmp/mike diff --git a/util/regression/xmlpp.pl b/util/regression/xmlpp.pl new file mode 100755 index 0000000..9e8abef --- /dev/null +++ b/util/regression/xmlpp.pl @@ -0,0 +1,405 @@ +#!/usr/bin/perl -w + +# +# Copyright (c) 2002, DecisionSoft Limited All rights reserved. +# Please see: +# http://software.decisionsoft.com/license.html +# for more information. +# + +# $Revision: 1.2 $ +# +# xmlpp: XML pretty printing +# + +# For custom attribute sorting create an attributeOrdering.txt file that +# lists each attributes separated by a newline in the order you would like +# them to be sorted separated by a newline. Then use the -s option. + +use FileHandle; +use Fcntl; +use Getopt::Std; + +use vars qw($opt_h $opt_H $opt_s $opt_z $opt_t $opt_e $opt_S $opt_c $opt_n $opt_l); + +my $indent=0; +my $textContent=''; +my $lastTag=undef; +my $output; +my $inAnnotation = 0; + + +if (!getopts('nzhHsteScl:') or $opt_h) { + usage(); +} + +my $indentSize = $opt_l || 2; + +if ($opt_s){ + +# expect to find attributeOrdering.txt file in same directory +# as xmlpp is being run from + + my $scriptDir = $0; + if ($scriptDir =~ m#/#){ + $scriptDir =~ s#/[^/]+$##; + } + else{ + $scriptDir ="."; + } + + # get attribute ordering from external file + if (open(SORTLIST, "<$scriptDir/attributeOrdering.txt")) { + @sortlist = ; + chomp @sortlist; + close (SORTLIST); + @specialSort = grep(/^\w+/, @sortlist); + } + else { + print STDERR "Could not open $scriptDir/attributeOrdering.txt: $!\nWARNING attribute sorting will only be alphabetic\n\n"; + } +} + + +# set line separator to ">" speeding up parsing of XML files +# with no line breaks + +$/ = ">"; + + +my $sortAttributes = $opt_s; +my $newLineComments = $opt_c; +my $splitAttributes = $opt_t; +my $schemaHackMode = $opt_S; +my $normaliseWhiteSpace = $opt_n; + +my $filename = $ARGV[0]; +if ($opt_z && (!$filename or $filename eq '-')) { + print STDERR "Error: I can't edit STDIN in place.\n"; + usage(); +} + +if (!$opt_z && scalar(@ARGV) > 1) { + print STDERR "Warning: Multiple files specified without -z option\n"; +} + +my $fh; + +my $stdin; + +if (!$filename or $filename eq '-') { + $fh=*STDIN; + $stdin=1; +} else { + $fh = open_next_file() or exit(1); + $stdin=0; +} + +do { + $indent=0; + $textContent=''; + $lastTag=undef; + $output = ''; + my $re_name = "(?:[A-Za-z0-9_:][A-Za-z0-9_:.-]*)"; + my $re_attr = "(?:'[^']*'|\"[^\"]*\")"; + my $input; + + while ($input .= <$fh>) { + while ($input) { + if ($input =~ s/^<($re_name)((?:\s+$re_name\s*=\s*$re_attr)*\s*)(\/?)>(.*)$/$4/s ) { + my %attr; + my ($name,$attr,$selfclose) = ($1,$2,$3); + while ($attr =~ m/($re_name)\s*=\s*($re_attr)/gs) { + my ($name,$value) = ($1,$2); + $value =~ s/^["'](.*)["']$/$1/s; + $attr{$name} = $value; + } + if ($opt_e) { + parseStart($name, 0, %attr); + if ($selfclose) { parseEnd($name) } + } else { + parseStart($name, $selfclose, %attr); + } + } elsif ($input =~ s/^<\/($re_name)\s*>(.*)$/$2/s) { + parseEnd($1); + } elsif ($input =~ s/^(.*)$/$2/s) { + parseComment($1); + } elsif ($input =~ s/^([^<]+)(.*)$/$2/s) { + parseDefault($1); + } elsif ($input =~ s/^(<\?[^>]*\?>)(.*)$/$2/s) { + parsePI("$1\n"); + } elsif ($input =~ s/^(<\!DOCTYPE[^\[>]*(\[[^\]]*\])?[^>]*>)(.*)$/$3/s) { + parseDoctype("$1"); + } else { + last; + } + } + if (eof($fh)) { + last; + } + } + + + if ($input) { + $input =~ m/([^\n]+)/gs; + print STDERR "WARNING: junk remaining on input: $1\n"; + } + $fh->close(); + + if (!$opt_z) { + if(!$opt_H){ + print "$output\n" + } else { + print html_escape($output)."\n" + } + } else { + if ($input) { + print STDERR "Not overwriting file\n"; + } else { + open FOUT,"> $filename" or die "Cannot overwrite file: $!"; + if(!$opt_H){ + print FOUT "$output\n" + } else { + print FOUT html_escape($output)."\n" + } + close FOUT + } + } +} while ( + !$stdin && $opt_z && ($fh = open_next_file(\$filename)) + ); + + + +sub parseStart { + my $s = shift; + my $selfclose = shift; + my %attr = @_; + + $textContent =~ s/\s+$//; + printContent($textContent); + + if($inAnnotation) { + return; + } + + if($schemaHackMode and $s =~ m/(^|:)annotation$/) { + $inAnnotation = 1; + $textContent = ''; + $lastTag = 1; + return; + } + if (length($output)) { + $output .= "\n"; + } + + $output .= " " x ($indent * $indentSize); + $output .= "<$s"; + my @k = keys %attr; + + if ($sortAttributes && (scalar(@k) > 1) ){ + + my @alphaSorted; + my @needSpecialSort; + my @final; + my $isSpecial; + + # sort attributes alphabetically (default ordering) + @alphaSorted = sort @k; + + # read through sorted list, if attribute doesn't have specified + # sort order, push it onto the end of the final array (this maintains + # alphabetic order). Else create a list that has attributes needing + # special ordering. + foreach $attribute (@alphaSorted){ + $isSpecial = 0; + foreach $sortAttrib (@specialSort){ + if ($attribute eq $sortAttrib){ + push @needSpecialSort, $attribute; + $isSpecial = 1; + } + } + if (!$isSpecial){ + push @final, $attribute; + } + } + + # now read through the specialSort list backwards looking for + # any match in the needSpecialSort list. Unshift this onto the + # front of the final array to maintain proper order. + foreach my $attribute (reverse @specialSort){ + foreach (@needSpecialSort){ + if ($attribute eq $_){ + unshift @final, $attribute; + } + } + } + + @k = @final; + } + + foreach my $attr (@k) { + # + # Remove (min|max)Occurs = 1 if schemaHackMode + # + if ($schemaHackMode and $attr =~ m/^(minOccurs|maxOccurs)$/ and $attr{$attr} eq "1") { + next; + } + + if ($splitAttributes) { + $output .= "\n"." " x ($indent * $indentSize) ." "; + } + if ($attr{$attr} =~ /'/) { + $output .= " $attr=\"$attr{$attr}\""; + } else { + $output .= " $attr='$attr{$attr}'"; + } + } + if ($splitAttributes and @k) { + $output .= "\n"." " x ($indent * $indentSize); + } + if ($selfclose) { + $output .= " />"; + $lastTag = 0; + } else { + $output .= ">"; + $indent++; + $lastTag = 1; + } + $textContent = ''; +} + +sub parseEnd { + my $s = shift; + + if($inAnnotation) { + if($s =~ m/(^|:)annotation$/) { + $inAnnotation = 0; + } + return; + } + + if($normaliseWhiteSpace) { + $textContent =~ s/^\s*(.*?)\s*$/$1/; + } + $indent--; + printContent($textContent); + if ($lastTag == 0) { + $output .= "\n"; + $output .= " " x ($indent * $indentSize); + } + $output .= ""; + $textContent = ''; + $lastTag = 0; +} + +sub parseDefault { + my $s = shift; + if($inAnnotation) { return } + $textContent .= "$s"; +} + +sub parsePI { + my $s = shift; + $output .= "$s"; +} + +sub parseDoctype { + my $s = shift; + if ($s =~ /^([^\[]*\[)([^\]]*)(\].*)$/ms) { + $start = $1; + $DTD = $2; + $finish = $3; + $DTD =~ s/\)(.*)/ms) { + $start = $1; + $xml = $2; + $finish = $3; + $xml =~ s/\\n"; + } else { + $output .= ""; + } + $textContent=''; +} + +sub printContent { + my $s = shift; + my $printLF = shift; + my ($LF,$ret) = ("",""); + + if ($s =~ m/\n\s*$/) { + $LF = "\n"; + } + if ($s =~ m/^[\s\n]*$/) { + $ret = undef; + } else { + $output .= "$s"; + $ret = 1; + } + if ($printLF) { + $output .= $LF; + } +} + + +sub html_escape { + my $s = shift; + $s =~ s/&/&/gsm; + $s =~ s//>/gsm; + return $s; +} + +sub open_next_file { + my $filename = shift; + $$filename = shift @ARGV; + while ($$filename and ! -f $$filename) { + print STDERR "WARNING: Could not find file: $$filename\n"; + $$filename = shift @ARGV; + } + if(!$$filename) { + return undef; + } + my $fh = new FileHandle; + $fh->open("< $$filename") or die "Can't open $$filename: $!"; + return $fh; +} + +sub usage { + print STDERR < Indent each level by spaces [default: 2] +EOF + exit 1; +} +