BNF Grammar For Zoe Query Specification



By Mark Woods, October 13, 2002

It has been a long time since I tried my hand at writing up a BNF grammar for a language. Here is my attempt at doing so for Zoe's Specification syntax. This is mostly just to help me understand the specification syntax. It would be nice to have a parser that handles the grammar and builds the specification, but I lack the cycles for that.

 
Production Comments
specification -> class qualifier  
class -> <string> class is the type of object to be returned
qualifier -> type details  
type -> keyvalue | keycomparison | and | or | not  
details -> key operator value  
details -> leftKey operator rightKey  
details -> qualifier + a list of qualifiers (and, or, not)
key -> <string> an object key (a property of class from above?)
operator -> caseInsensitiveLike | contains | equal | greaterThan | greaterThanOrEqualTo | lessThan | lessThanOrEqualTo | like | notEqual contains and like appear to not work
value -> <string> a string literal value
value -> url An object URL in Zoe syntax
value -> <dateTime>> ISO format date time
leftKey -> object.property an object and property of that object to be compared
rightKey -> object.property an object and property of that object to be compared
object -> <string> name of the object (is this a class name?)
property -> <string> property name

Additional Info

From the Zoe Mail List: objectsWithSpecification is the most complex API as it involve three levels of translation: XML-RPC -> SZQualifier -> Lucene's Query. Also keep in mind that not all the SZQualifier functionalities are supported by Lucene. Which means that some qualifier might be pretty much meaningless when translated to a Lucene query.

Also From the Zoe Mail List: "SZQualifier.KeyComparison is a subclass of SZQualifier that compares a named property of an object with a named value of another object. For example, to return all of the employees whose salaries are greater than those of their managers, you might use an expression such as "salary > manager.salary", where "salary" is the left key and "manager.salary" is the right key. The "left key" is the property of the first object that's being compared to a property in a second object. The property in the second object is the "right key". Both the left key and the right key might be key paths. You can use SZQualifier.KeyComparison to compare properties of two different objects or to compare two properties of the same object."

For more info, refer to Zoe.