All sorts of changes. Generally moving towards first release.
[cql-java-moved-to-github.git] / etc / Grammar
diff --git a/etc/Grammar b/etc/Grammar
new file mode 100644 (file)
index 0000000..ea1ad0e
--- /dev/null
@@ -0,0 +1,35 @@
+$Id: Grammar,v 1.1 2002-10-31 22:22:01 mike Exp $
+
+This is the CQL grammar, more or less as on the official Maintenance
+Agency page (http://lcweb.loc.gov/z3950/agency/zing/srwu/cql.html) but
+with a few tweaks described in my message of Tue, 29 Oct 2002 14:11:48
+which I hope will be integrated into the official grammar.
+
+--
+
+cql-query         ::= cql-query boolean search-clause
+                   |  search-clause
+boolean           ::= "and" | "or" | "not" | prox
+search-clause     ::= "(" cql-query ")"
+                   |  [ qualifier relation ] term
+
+relation          ::= base-relation { "/" relation-modifier }
+base-relation     ::= numeric-relation | "exact" | "all" | "any"
+relation-modifier ::= "relevant" | "fuzzy" | "stem"
+numeric-relation  ::= "<" | ">" | "<=" | ">=" | "<>" | "="
+
+prox              ::= "prox" [ "/" prox-parameters ]
+prox-parameters   ::= [ numeric-relation ] "/" [ distance ] "/" [ unit ] "/" ordering
+                   |  [ numeric-relation ] "/" [ distance ] "/" unit
+                   |  [ numeric-relation ] "/" distance
+                   |  numeric-relation
+unit              ::= "word" | "sentence" | "paragraph" | "element"
+ordering          ::= "ordered" | "unordered"
+distance          ::= non-negative-integer
+
+qualifier         ::= [ qualifier-prefix "." ] qualifier-name
+qualifier-prefix  ::= identifier
+qualifier-name    ::= identifier
+identifer         ::= string
+term              ::= string | ""string""
+string            ::= a character string