1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
# CQL queries for testing.
# from http://www.loc.gov/z3950/agency/zing/cql/sample-queries.html
# Simple Term
cat
"cat"
comp.os.linux
ml:element
"<xml:element>"
"="
"prox/distance<3/unit=word"
("cat")
((dog))
all
prox
# Index Relation Term
title = "fish"
title == 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 = "fish frog chicken"
dc.title =/rel.algorithm=CORI squid
creator any/f.foo/b.bar>1 "sanderson taylor"
# 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
# Index Relation Term plus Boolean
bath.uniformTitle any fish and dc.title any "cat dog"
(title any/stem "fish dog" or and)
# Proximity and Boolean Modifiers
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")
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="info:srw/cql-context-set/1/dc-v1.1" dc.title="fish"
> "info:srw/cql-context-set/1/dc-v1.1" title="fish"
> foo="info:srw/cql-context-set/1/dc-v1.1" > ccg = "http://srw.cheshire3.org/contextSets/ccg/1.1/" foo.title="fish" and ccg.force=3
# Lame Searches
any or all:stem and all == any prox prox=fuzzy
(((((((((any)))))))))
""
> any > any = exact any > any
# Invalid searches [should error]
<
===
missingClause or
missingTerm any
()
(missingParen
missingParen any fish)
(emptyParens or ())
title = ("illegal parentheses")
> illegal="urn:missingQuery"
# free-form term OK)
a b
a b c
a.b c
and b c
all a
a any b
dc.title a b c and d
# free-form term (Syntax error)
a b.c
a and
# sortby
a sortby title
a or b sortby title/ascending author
|