A continuation of http://forum.hibernate.org/viewtopic.php?p=2177835#2177835
So far, I've been plugging away at making the HQL grammar using ANTLR. It's been going well, I have the example text from sections 9.2 through 9.7 from the HQL docos parsing and producing reasonable looking ASTs (http://www.hibernate.org/hib_docs/reference/html/query-language.html). Section 9.8 has a few constructs that I think I need some clarification on: 4) The doco says (docos say? is doco plural? ;) ) : You may test the size of a collection with the special property size, or the special size() function. from eg.Cat cat where cat.kittens.size > 0 from eg.Cat cat where size(cat.kittens) > 0 I have generalized this in the grammar, so the parser will recognize anything of the form: IDENT ( '.' IDENT ) * (OPEN expression CLOSE) as a function or method call in the AST. The advantage of this approach is that new 'special functions' could be added to the system without changing the grammar. The disadvantage is of course, the parser cannot detect some errors (e.g. unknown special function name) so the rest of the system must check for this. So, is that okay? 5) The docos say: For indexed collections, you may refer to the minimum and maximum indices using minIndex and maxIndex. Similarly, you may refer to the minimum and maximum elements of a collection of basic type using minElement and maxElement. from Calendar cal where cal.holidays.maxElement > current date I don't understand how 'current date' fits in to a typical boolean expression grammar, mostly because of the space between 'current' and 'date'. Is this some type of strange keyword? Is it a typo? Here are my previous questions, for reference. 1) The BNF indicates that the 'HAVING' clause can exist without being preceeded by 'GROUP BY'. Does this make sense? Other SQL BNF's make the 'HAVING' clause an optional element of 'GROUP BY'. > No, you can't have a HAVING w/o a GROUP BY, though the rules about > HAVING + GROUP BY will change soon. 2) The following rules are not referenced in the BNF: collection: ( OPEN query CLOSE ) | ( 'elements'|'indices' OPEN path CLOSE ); quantifiedExpression: 'exists' | ( expression 'in' ) | ( expression OP 'any' | 'some' ) collection; compoundPath: path ( OPEN_BRACKET expression CLOSE_BRACKET ( '.' path )? )*; What are they for, and where should they be used? > The first two of these things are for subqueries. See the Hibernate > doco. The third is for accessing collections by index: foo.bars["x"].baz.fum 3) COUNT() has it's own special cases (e.g. '*'), but should this really be handled by the grammar? > I have no idea. Depends how easy/hard it is, I suppose.... ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel