[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [search-ws] CQL Parsing Questions
Ray Denenberg, Library of Congress wrote: > Currently: > search-clause-group = search-clause-group Boolean-modified > subquery | subquery > subquery = "(" query ")" / search-clause > > > Why can't these two be replaced by: > > search-clause-group = > > "("search-clause-group")" | search-clause | search-clause-group > Boolean-modified search-clause > > Or for better readability: > > search-clause-group = quoted-search-clause-group | > unquoted-search-clause-group > quoted-search-clause-group = "("search-clause-group")" > unquoted-search-clause-group = search-clause | search-clause-group > Boolean-modified search-clause I have to say, that I can't easily get my head around that. A few years ago I wrote a cql parser using an LL parser (Boost.Spirit) so I had to convert the BNF to a form suitable for Boost.Spirit. I've just added the following queries to the test cases: title=(A or B) title=(author=xxx) Thankfully it rejects them as bad queries. Now, either I based my parser on an old form of the BNF, or my interpretation of it was coloured by what I thought was sensible at the time. Anyway, my grammer, edited to remove all the cruft and make it a bit more BNF like, has the following constructs: comparitorSymbol = "<="| ">=" | "<>" | '='| '<' | '>'; boolean = "and" | "or" | "not" | "prox" modifier = '/' modifierName (comparitorSymbol modifierValue)?; comparitor = comparitorSymbol | namedComparitor; relation = comparitor modifier*; booleanGroup = boolean modifier*; searchClause = '(' cqlQuery ')' | (index relation)? searchTerm; scopedClause = searchClause (booleanGroup searchClause)*; prefixAssignment = '>' (prefix '=')? uri; cqlQuery = prefixAssignment* scopedClause; The searchClause and scopedClause would seem to be the important clauses. My reading is that whereever an "=" appears as part of a relation, it can only be followed by a searchTerm. Ashley. > > --Ray > > ----- Original Message ----- From: "Ashley Sanders" > <a.sanders@manchester.ac.uk> > To: "Ray Denenberg, Library of Congress" <rden@loc.gov> > Cc: "Hammond, Tony" <t.hammond@nature.com>; > <search-ws@lists.oasis-open.org> > Sent: Wednesday, September 16, 2009 7:43 AM > Subject: Re: [search-ws] CQL Parsing Questions > > >> Ray Denenberg, Library of Congress wrote: >>> Tony, addressing your first question: >>> >>> From: "Hammond, Tony" <t.hammond@nature.com> >>>> title=(author=kernighan) >>>> is equivalent to >>>> author=kernighan >>>> " >>>> >>>> and following up with him he claimed this was cooked into the BNF >>> >>> Well first take a look at this thread and see if it helps put this >>> into some perspective. >>> http://listserv.loc.gov/cgi-bin/wa?A2=ind0603&L=srw-ed&D=0&T=0&X=2C676213DF8F2521EB&P=1982 >>> This is a convoluted mess that is better ignored. The grammar has a >>> hole that lead to nonsensical queries and I think that the consensus >>> was that it is harder to fix the grammar than to just say that >>> queries like these are nonsensical. >> >> One can't feeling that if the grammer allows that, then the grammer is >> broken and should be fixed. >> >>> The real issue was a query like "title=(A or B)". Is it a >>> shorthand for - "title=A or title=B". >> >> That also looks like an horrendous piece of syntax to me. I can't >> think of any other language that allows you to specify queries like >> that. Admittedly it is often what people want to do when they first come >> across boolean statements, but I really don't think we shouldn't let >> them. Especially if it results in a nonsensical mess like >> title=(author=xxxx)). >> >> Do people feel that cql is intended for users or machines? My feeling >> is that it should be for machine-to-machine communication and therefore >> doesn't need any syntactic sugar. >> >> Ashley. >> -- >> Ashley Sanders a.sanders@manchester.ac.uk >> Copac http://copac.ac.uk A Mimas service funded by JISC >> >> --------------------------------------------------------------------- >> To unsubscribe from this mail list, you must leave the OASIS TC that >> generates this mail. Follow this link to all your TCs in OASIS at: >> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php -- Ashley Sanders a.sanders@manchester.ac.uk Copac http://copac.ac.uk A Mimas service funded by JISC
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]