[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (#2) 4.1.1 Grammar for Search Mechanism



On Wed, 2002-01-16 at 14:33, Doug Royer wrote:
...
>         (3) I PROPOSE the name change from SQL-MIN to CAP-QL.
>             Where CAP-QL stands for CAP QUERY LANGUAGE.
> 
>             PLEASE REVIEW.

I also prefer "CAP-QL".

> ...
> 
>       (2) ABNF is tricky stuff - PLEASE REVIEW.

  I included some corrections.

>  
>       (3) This proposes DOES NOT YET include the '(' ')' that
>           we talked about for grouping logical operators. For
>           two reasons:
> 
>               (a) Off of the top of my head, I did not know
>                   where to put them in the ABNF.

I think they could be added be replacing cap-cmps by cap-expr 
as follows:

      cap-expr = "(" cap-expr ")"
               /  cap-term

      cap-term = cap-expr SP cap-logical SP cap-expr 
               / cap-factor 
               
      cap-factor = [ "NOT" SP ] "CONTAINS(" cap-lhs "," col-literal ")"
                 / cap-lhs SP cap-oper SP col-literal
                 / cal-lhs SP "IS" SP [ "NOT" SP ] "NULL"
               
      cap-logical = "AND" / "OR"      

      cap-lhs = "PARAM(" cap-ucol "," cap-param ")"
              / cap-ucol

      cap-oper    = ( "=" 
                    / "!="
                    / "<"
                    / ">"
                    / "<="
                    / ">=" 
                    / [ "NOT" SP ] "LIKE"
                    )

NOTE: For completeness, I also added an optional "NOT" in 
front of CONTAINS, and LIKE.

PLEASE REVIEW (I'm new to ABNF).


> 
>               (b) They were just seriously re-proposed and there
>                   has been no explicit debate yet.
>     
> ...
> 
> 4.1.1.1 "VQUERY ABNF"
> 
>     search     = "BEGIN:VQUERY" CRLF
>                  [expand] querycomp
>                  "END:VQUERY" CRLF
> 
>                # If not provided, EXPAND default to FALSE
>     expand     = "EXPAND" ":" ( "TRUE" / "FALSE") CRLF


I think that EXPAND and QUERY should include the X-PARAM.

 expand     = "EXPAND" *(xparam) ":" ( "TRUE" / "FALSE") CRLF

(xparam is defined in rfc445). 

> 
>     comp-name  = "VEVENT"    / "VTODO"  / "VJOURNAL"
>                / "VTIMEZONE" / "VALARM" / "VFREEBUSY"
>                / "VAGENDA"   / "VCAR"   / "CALSTORE"
>                / iana-name   / x-name

   "comp-name" is not used in the ABNF.

> 
>     querycomp  = ( query ) / ( queryname query ) / queryname
> 
>     queryname  = "QUERYNAME:" text CRLF
> 

 queryname  = "QUERYNAME" *(xparam) ":" text CRLF
 


>     query      = "QUERY:" capselect CRLF
> 
>                  # NOTE: There is exactly one space separating
>                  # the various parts of capselect
>                  #
>     capselect  = ( "SELECT" " " cap-cols " "
>                    "FROM"   " " cap-tbl " "

 This is a detail, but I prefer the use of the core rule SP 
instead of " ". Also see comments on (1) and (2) bellow. 

e.g., 
       pselect  = ( "SELECT" SP cap-cols SP
                    "FROM"   SP cap-tbl SP


> 		   "WHERE"  " " cap-cmps
>
>                  / "SELECT" " " cap-cols " "
>                    "FROM"   " " cap-tbl
> 
>                  / "SELECT  " " cap-cols " "
>                    "FROM"   " " cap-tbl  " "
>                    "USING_PROPERTIES" " " cap-col cap-local
>                    "WHERE"  " " cap-cmps )
> 

 1. The USING_PROPERTIES property clause should accept a list.
 2. Missing space between in cal-col and cal-local


   ...
         USING_PROPERTIES" SP cap-local-decls
   ...
   
   cap-local-decls = cal-local-decl *( "," cap-local-decl )


>     cap-col     = # Any property name found in the component
>                   # named in the comp-tbl used in the FROM clause.
>                   #
>                   #   SELECT ORGANIZER FROM VEVENT ...
> 		  #
>                   # OR
>                   #
>                   # A component name of an existing component
contained
>                   # inside of the cmp-tbl used in the FROM clause.
>                   #
>                   #   SELECT VALARM FROM VEVENT ...
> 
>     cap-tbl     = ( # Any known component type
>                   / "CALSTORE"
>                   / "VAGENDA" )

The avoid confusion supported element should be explicitly listed.

   "VQUERY" should also be included (not in comp-name above).

> 
>                   # NOTE: there is NO space around the "," on
>                   # the next line
>     cap-cols    = ( cap-col / cap-col "," cap-cols )
>                   / "*"
> 
>     cap-param   = # Any parameter that may be contained in the cap-col
>                   # in the supplied PARM() function.
> 
>     cap-local   = # Any string that is composed of the characters 
>                   # that could be a cap-col name, but is not any
>                   # cap-col name. It is suggested that the
>                   # string start with "x-" to ensure it does not
>                   # conflict with any existing or future cap-col name.
>                   # This name MUST BE defined in the cap-using and
>                   # can only be used in cap-cmps of the same query.
>                   # And this name is only known and valid for the
>                   # provided query and only for the lifetime of
>                   # the query.
>
>     col-literal = "'" literal-data "'"
> 
>     literal-data= # Any data that matches the value type of the
>                   # column that is being compared. That is you can
>                   # not compare PRIORITY to "some string" because
>                   # PRIORITY has a value type of integer.
>                   # 
>                   # OR if the literal-data is proceeded by the LIKE
>                   # element it may also contain the '%' and '_'
>                   # wildcard characters.
> 
>     cap-ucol	=   cap-col / cap-local
> 
>     cap-cmp     = ( cap-ucol cap-cmd-rhs
>                   / cap-ucol cap-oper cap-literal
>                   / "PARAM(" cap-col "," cap-param ")" cap-cmp-rhs

    First argument of PARAM should be cap-ucol:
    
           / "PARAM(" cap-ucol "," cap-param ")" cap-cmp-rhs
             

> 		              / "CONTAINS(" cap-col "," col-literal ")"

 1. The first arg of CONTAINS should be cap-ucol + PARAM()
    (see suggested ABNF for sub-expressions).

 2. For completeness "NOT CONTAINS" should probably by added.   
   
   
>                   / cap-logical

                    )

Missing a closing ')'.


>                   # NOTE: there is NO space around the "," on
>                   # the next line
>     cap-cmps    = cap-cmp
>                 / cap-cmp "," cap-cmps
>                 / cap-cmp cap-logical cap-cmps
> 

 cap-cmp is not defined (cmp-oper).

>     cap-cmp-rhs = ( cap-oper col-literal
>                   / "IS NULL" )
>                   / "IS NOT NULL"
>                   / "LIKE" " " col-literal ) # Where the SQL '%' and
'_'
>                                              # Wildcard characters may
>                                              # be used in col-literal

  For completeness, "NOT LIKE" should probably by added.

> 
>     cmp-oper    = ( " = " 
>                   / " != "
>                   / " < "
>                   / " > "
>                   / " <= "
>                   / " >= " )

 "cmp-oper" is referred to as cap-oper above.

>
>     cap-logical = ( " AND " / " OR " )


>
> 4.1.2 CAP-QL notes
>
>       (1) No in-lined spaces are allowed if not in the grammar above.
> 
>       (2) Note that cmp-oper and cap-logical elements are
>       surrounded by exactly one space.
> 
>       Use: "VEVENT,VTODO" 
> 
>       Not: "VEVENT, VTODO"  (Space before or after ',' not allowed)
> 
>       Use: "DTSTART <= '20000605T131313Z'"
>  
>       Not: "DTSTART<='20000605T131313Z'" (Exactly one space surrounds
>                                           compare operators)
> 
>       Use: " AND " and " OR "            (Exactly one space surrounds
>                                           compare operators)
>  
>       Not: "AND"   and not "OR"          (Exactly one space surrounds
>                                           compare operators)

 I propose to remove (1) and (2) and to adjust the ABNF accordingly.
It only seems to add complexity (~10 lines of descriptions and 
comments in ABNF). Some spaces are required (e.g., around AND, OR),
but imposing exactly one is not needed. 

  I also propose to support tabs. This could be achieve by 
replacing most " " in the ABNF with *WSP.

WSP is defined in rfc2234 as:

   WSP = ( SP / HTAB )
   SP = %x20
   HTAB = %x09