Index: src/utils/raSqlQuery/rqlParse.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/raSqlQuery/rqlParse.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/utils/raSqlQuery/rqlParse.c	20 Nov 2009 07:41:56 -0000	1.1
+++ src/utils/raSqlQuery/rqlParse.c	20 Nov 2009 08:01:12 -0000	1.2
@@ -391,12 +391,33 @@
     }
 return p;
 }
 
+static struct rqlParse *rqlParseNot(struct tokenizer *tkz)
+/* parse out a logical not. */
+{
+char *tok = tokenizerNext(tkz);
+if (sameString(tok, "not"))
+    {
+    struct rqlParse *p = rqlParseCoerce(rqlParseCmp(tkz), rqlTypeBoolean);
+    struct rqlParse *n;
+    AllocVar(n);
+    n->op = rqlOpNot;
+    n->type = rqlTypeBoolean;
+    n->children = p;
+    return n;
+    }
+else
+    {
+    tokenizerReuse(tkz);
+    return rqlParseCmp(tkz);
+    }
+}
+
 static struct rqlParse *rqlParseAnd(struct tokenizer *tkz)
 /* Parse out and or or. */
 {
-struct rqlParse *l = rqlParseCoerce(rqlParseCmp(tkz), rqlTypeBoolean);
+struct rqlParse *l = rqlParseCoerce(rqlParseNot(tkz), rqlTypeBoolean);
 struct rqlParse *parent = NULL;
 struct rqlParse *p = l;
 for (;;)
     {
@@ -415,9 +436,9 @@
 	    parent->type = rqlTypeBoolean;
 	    parent->children = p;
 	    p = parent;
 	    }
-	struct rqlParse *r = rqlParseCoerce(rqlParseCmp(tkz), rqlTypeBoolean);
+	struct rqlParse *r = rqlParseCoerce(rqlParseNot(tkz), rqlTypeBoolean);
 	slAddTail(&parent->children, r);
 	}
     }
 }

