-
Notifications
You must be signed in to change notification settings - Fork 6
Description
The CQLParser throws an error which could be due to case-sensitivity when handling CQL keywords. I was testing on the example query in the LOC CQL spec (section 12) for the query dc.TitlE Any/rEl.algOriThm=cori fish soRtbY Dc.TitlE.
Both the LOC and OASIS specs mention case-insensitivity:
All parts of CQL are case insensitive apart from user supplied search terms, values for modifiers and prefix map identifiers [...]
To reproduce the issue (at latest commit: 6251e96):
CQLParser parser = new CQLParser();
String cql = "dc.TitlE Any/rEl.algOriThm=cori fish soRtbY Dc.TitlE";
parser.parse(cql);Exception in thread "main" org.z3950.zing.cql.CQLParseException: expected boolean, got '/'
at org.z3950.zing.cql.CQLParser.parseQuery(CQLParser.java:189)
at org.z3950.zing.cql.CQLParser.parseTopLevelPrefixes(CQLParser.java:134)
at org.z3950.zing.cql.CQLParser.parse(CQLParser.java:117)
// line numbers might not align as I have inserted some debug statements...While I was testing, I found that the following queries did parse differently (always as a CQLTermNode):
dc.TitlE any fishdc.TitlE ANY fishdc.TitlE Any fishdc.TitlE aNy fish
The query 1. did parse the CQLTermNode into index, CQLRelation ("any") and term ("fish").
The queries 2., 3. and 4. did parse into a CQLTermNode with only the term being filled as "dc.TitlE ANY fish"/... and default index/relation.
dc.TitlE other fishdc.TitlE Other fish
The queries 5. and 6. should probably also parse into a CQLTermNode with the CQLRelation of "other"/"Other". It currently put the full query into the CQLTermNode.term.
The LOC CQL BNF would allow for relations to be any string (even quoted). The OASIS CQL ABNF is a bit more stricter while allowing any string, it doesn't allow quoting: relation-modified → relation → relation-name → simple-name → simple-string (so no special characters).
Is this behavior intended? Can it even be fixed (due to backwards compatibility)? It is probably not according to spec if I understand the BNFs.