ea1ad0eb4c76a769c3bb4353c2f5919c8ef70ebb
[cql-java-moved-to-github.git] / etc / Grammar
1 $Id: Grammar,v 1.1 2002-10-31 22:22:01 mike Exp $
2
3 This is the CQL grammar, more or less as on the official Maintenance
4 Agency page (http://lcweb.loc.gov/z3950/agency/zing/srwu/cql.html) but
5 with a few tweaks described in my message of Tue, 29 Oct 2002 14:11:48
6 which I hope will be integrated into the official grammar.
7
8 --
9
10 cql-query         ::= cql-query boolean search-clause
11                    |  search-clause
12 boolean           ::= "and" | "or" | "not" | prox
13 search-clause     ::= "(" cql-query ")"
14                    |  [ qualifier relation ] term
15
16 relation          ::= base-relation { "/" relation-modifier }
17 base-relation     ::= numeric-relation | "exact" | "all" | "any"
18 relation-modifier ::= "relevant" | "fuzzy" | "stem"
19 numeric-relation  ::= "<" | ">" | "<=" | ">=" | "<>" | "="
20
21 prox              ::= "prox" [ "/" prox-parameters ]
22 prox-parameters   ::= [ numeric-relation ] "/" [ distance ] "/" [ unit ] "/" ordering
23                    |  [ numeric-relation ] "/" [ distance ] "/" unit
24                    |  [ numeric-relation ] "/" distance
25                    |  numeric-relation
26 unit              ::= "word" | "sentence" | "paragraph" | "element"
27 ordering          ::= "ordered" | "unordered"
28 distance          ::= non-negative-integer
29
30 qualifier         ::= [ qualifier-prefix "." ] qualifier-name
31 qualifier-prefix  ::= identifier
32 qualifier-name    ::= identifier
33 identifer         ::= string
34 term              ::= string | ""string""
35 string            ::= a character string