Hi:
I just wanted to raise a bug report regarding CQL-Java and learn if others
have encountered the same problem too. The problem has been tested on the
latest release (Version 1.3 of Wednesday 28th May 2008 [1]).
(I should also say that I have earlier reported the problem to Mike Taylor,
the author, and he duly noted it but without funding is at a loss to correct
this problem.)
The problem is the use of '-' chars in any bareword values (i.e. charString1
type productions) when preceded by digits. Note that the CQL BNF does not
require escaping for strings containing a '-' char. (Both the current
version 1.2 [2] and the upcoming 2.0 version are aligned on this. See the
production rule for charString1 below.)
Using the bundled CQLParser app one gets this behaviour:
% CQLParser 'foo = 1-bar'
Syntax error: expected boolean, got '-'
% CQLParser 'foo = bar-1'
<searchClause>
<index>foo</index>
<relation>
<value>=</value>
</relation>
<term>bar-1</term>
</searchClause>
Unfortunately this usage (leading digits and '-' char) does arise in several
cases of interest: date strings, ISSN numbers, etc. So, for example, we get
this error on a legal search clause:
% CQLParser 'date = 2003-12'
Syntax error: expected boolean, got -12
To avoid the problem one must needs quote every date value and other value
with this pattern to get the correct behavior:
% CQLParser 'date = "2003-12"'
<searchClause>
<index>date</index>
<relation>
<value>=</value>
</relation>
<term>2003-12</term>
</searchClause>
My reason for bringing this up is purely to make this bug explicit (and a
suggested workaround for overcoming it), and not to lay any accusation. If I
had the resources I would have contributed a bug fix but I have not and so
was not able to.
Cheers,
Tony
==
charString1
:=
Any sequence of characters that does not include any of the following:
whitespace
( (open parenthesis )
) (close parenthesis)
=
<
>
'"' (double quote)
/
If the final sequence is a reserved word, that token is returned instead.
Note that '.' (period) may be included, and a sequence of digits is also
permitted. Reserved words are 'and', 'or', 'not', and 'prox' (case
insensitive). When a reserved word is used in a search term, case is
preserved.
==
********************************************************************************
DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and
attachments (if any). No contracts may be concluded on behalf of Macmillan
Publishers Limited or its agents by means of e-mail communication. Macmillan
Publishers Limited Registered in England and Wales with registered number 785998
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS
********************************************************************************
|