Calendaring and Scheduling                                      D. Royer
Internet-Draft                                           INET-Consulting
Expires: April 3, 2004                                   October 4, 2003


           CAP (Calendar Access Protocol) sorting extension.
                        draft-royer-cap-sort-02

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. Note that other
   groups may also distribute working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time. It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at http://
   www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on April 3, 2004.

Copyright Notice

   Copyright (C) The Internet Society (2003). All Rights Reserved.

Abstract

   Small devices may not have sufficient memory to store and then sort
   query results from a CAP server. This memo suggests an expendable CAP
   CAPABILITY extension called "CAP-SORT" and a new parameters "SORT"
   and "LOCALE". This memo specifies an optional minimum sort order and
   and locale sort extension. These extensions will only effect CUA's
   that have specifically requested these extensions be used in the
   session or for specific queries.

   The reader should be familiar with the CAP protocol prior to reading
   this memo.






Royer                    Expires April 3, 2004                  [Page 1]

Internet-Draft                  CAP-SORT                    October 2003


Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  MINIMUM-SORT value . . . . . . . . . . . . . . . . . . . . . .  4
   2.1 Ordering of Numeric Results  . . . . . . . . . . . . . . . . .  4
   2.2 Ordering of Date/Date-Time Results . . . . . . . . . . . . . .  4
   3.  LOCALE-SORT value  . . . . . . . . . . . . . . . . . . . . . .  6
   4.  LOCALE parameter . . . . . . . . . . . . . . . . . . . . . . .  7
   5.  SORT parameter . . . . . . . . . . . . . . . . . . . . . . . .  8
   6.  CAP-SORT property  . . . . . . . . . . . . . . . . . . . . . .  9
   7.  ORDERBY Extension  . . . . . . . . . . . . . . . . . . . . . . 10
       Author's Address . . . . . . . . . . . . . . . . . . . . . . . 10
   A.  Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . 11
       Intellectual Property and Copyright Statements . . . . . . . . 12





































Royer                    Expires April 3, 2004                  [Page 2]

Internet-Draft                  CAP-SORT                    October 2003


1. Introduction

   This is an extension to the CAP "GET-CAPABILITY" command result set.
   A CS that supports this extension supplies the "CAP-SORT" property in
   its "GET-CAPABILITY" reply supplying the versions of sorting the CS
   supports.

   If the CUA wishes to have the results sorted it must return to the CS
   a valid "CAP-SORT" property value.

   (1) Supply the "CAP-SORT" property as one of the values returned by
   the CUA in its "GET-CAPABILITY" reply to the CS. The contents of the
   "CAP-SORT" sent by the CUA must be from the set supplied to it from
   the CS "GET-CAPABILITY" command reply "CAP-SORT" property value.

   (2) Supply the "SORT" parameter to a "QUERY" property using one of
   the values returned in the "CAP-SORT" properly supplied by the CS.

   This memo defines two sort capabilities called "MINIMUM-SORT" and
   "LOCALE-SORT". The "MINIMUM-SORT" and "LOCALE-SORT" values can be
   used in the "CAP-SORT" property and in the "SORT" parameter as
   values.

   Examples:


   CAP-SORT:MINIMUM-SORT,LOCALE-SORT

   QUERY;SORT="LOCALE-SORT":SELECT SUMMARY FROM VEVENT

   QUERY;SORT="LOCALE-SORT";LOCALE="fr_FR":SELECT SUMMARY FROM VEVENT

   QUERY;SORT="LOCALE-SORT":SELECT DESCRIPTION,SUMMARY FROM VEVENT


















Royer                    Expires April 3, 2004                  [Page 3]

Internet-Draft                  CAP-SORT                    October 2003


2. MINIMUM-SORT value

   If the CS supplies "MINIMUM-SORT" as one of its values it returns in
   a "CAP-SORT" property value and the CUA sends "MINIMUM-SORT" as one
   of its values in a "CAP-SORT" property value or in a "SORT" parameter
   value then it is defined to cause the CS to perform sorting as
   defined in this section.

   If supplied as described above to a "QUERY" property, then the query
   results will be sorted as defined the three sections that follow.

2.1 Ordering of Numeric Results

   Sorting will take place in the order the columns are supplied in the
   QUERY command. The CS MUST sort at least the first column. The CS MAY
   sort additional columns.

   Float and integer values MUST BE sorted by their numeric value.  This
   means the result of a sort on an integer value type will be:


          1, 2, 100, 1000

      and not

          1, 100, 1000, 2


      This means the result of a sort on an float value type will be:


          1.1, 2.23, 100.332, 1000.12

      and not

          1.1, 100.332, 1000.12, 2.23



2.2 Ordering of Date/Date-Time Results

   Date and date time values will be sorted by their equivalent value in
   UTC.  No matter what the returned time zone in the result set
   returns.  This is so that if multiple components are returned each in
   a unique time zone, the results will be sorted in UTC.  This does not
   mean the values MUST BE converted to UTC in the data returned to the
   CUA.  It means the CS must do the sort in UTC.




Royer                    Expires April 3, 2004                  [Page 4]

Internet-Draft                  CAP-SORT                    October 2003


   If the cap-cols is only "*" and nothing else and the result set has a
   DTSTART, then:

   If EXPAND=FALSE sorting will be by the "DTSTART" property value
   ascending as if it were in UTC.

   If EXPAND=TRUE sorting will be by the "RECURRENCE-ID" property value
   ascending as if it were in UTC.

   If one or more "DTSTART" or "RECURRENCE-ID" property values in
   multiple components have exactly the same value, the order for those
   matching components is unspecified.

   If the selected component(s) do not contain a "DTSTART" property or a
   "RECURRENCE-ID" property, then the order is unspecified.

   If an instance does not have a "RECURRENCE-ID" property and the query
   compares "RECURRENCE-ID" properties (comparing a RECURRENCE-ID to the
   date or date/time of a single instance object), then the CS MUST
   compare the "DTSTART" property value as if it were a "RECURRENCE-ID"
   even for single instance objects that do not contain a "RECURRENCE-
   ID" property.

   A component with a DATE and no TIME value is returned before objects
   with both a DATE and TIME value when the dates of those two (or more)
   objects are the same, sorted by date.

























Royer                    Expires April 3, 2004                  [Page 5]

Internet-Draft                  CAP-SORT                    October 2003


3. LOCALE-SORT value

   If the CS supplies "LOCALE-SORT" as one of its values it returned in
   a "CAP-SORT" property value and the CUA sends "LOCALE-SORT" as one of
   its values in a "CAP-SORT" property value or in a "SORT" parameter
   value then it is defined to cause the CS to perform sorting as
   defined in this section.

   Values are sorted according to the locale sorting order as specified
   in the command. Or the value set by the latest "SET-LOCALE" CAP
   command, Or the value of the "DEFAULT-LOCALE" property if supplied by
   the CUA in its "GET-CAPABILITY" reply to the CS. Or the calendar
   locale if known and in that order. Or the CS locale if the calendar
   does not have any locale set. And the locale to use for the sort is
   determined in that order.

   If supplied as described above to a "QUERY" property, then the locale
   to be used in sorting.

































Royer                    Expires April 3, 2004                  [Page 6]

Internet-Draft                  CAP-SORT                    October 2003


4. LOCALE parameter

   Parameter Name: LOCALE

   Purpose: To specify the locale to be used.

   Format Definition: The property parameter is defined by the following
   notation:


   ; paramtext is defined in RFC2445
   ;
   localeparam    = "LOCALE" "=" paramtext


   Description: Defined the locale to be used.

   If the "LOCALE" parameter value supplied in the "QUERY" property must
   be from the set supplied by the CS in the "DEFAULT-LOCALE" property
   sent to the CUA by the CS in its "GET-CAPABILITY" command reply.































Royer                    Expires April 3, 2004                  [Page 7]

Internet-Draft                  CAP-SORT                    October 2003


5. SORT parameter

   Parameter Name: SORT

   Purpose: To specify the type of SORT to be used.

   Format Definition: The property parameter is defined by the following
   notation:


   ; paramtext is defined in RFC2445
   ;
   sortparam    = "SORT" "=" sorttype

   ; One or more of these values may be supplied but
   ; not more than once.

   sorttype     = "MINIMUM-SORT"
                / "LOCALE-SORT"
                / x-sort
                / iana-sort

   x-sort      = ; A param-value as defined in RFC 2445
                 ; that starts with "x-" or "X-".

   iana-sort   = ; Any sort method defined by IANA.


   Description: Define the sort method to be used. The value supplied
   MUST BE from the set supplied by the CS in the "CAP-SORT" property
   value in the CSs "GET-CAPABILITY" reply.

   If supplied as described above, then the sort method to be used in
   sorting is the value of the "SORT" parameter.

















Royer                    Expires April 3, 2004                  [Page 8]

Internet-Draft                  CAP-SORT                    October 2003


6. CAP-SORT property

   Property Name: CAP-SORT

   Purpose: This property defines the calendar scale used for the
   calendar information specified in the iCalendar object.

   Value Type: TEXT

   Property Parameters: Non-standard property parameters can be
   specified on this property.

   Conformance: Property can be specified in an iCalendar object.

   Description:

   Format Definition: The property is defined by the following notation:


   cap-sort      = "CAP-SORT" capsortparam ":" capsortvalue CRLF

   capsortparam  = *(";" xparam)

   capsortvalue  = sorttype *("," sorttype)



























Royer                    Expires April 3, 2004                  [Page 9]

Internet-Draft                  CAP-SORT                    October 2003


7. ORDERBY Extension

   This extends the 'cal-query' ABNF defiend in [CAP] to include the
   specifying the sort order of the results:


   cal-query  = "SELECT"   SP   cap-val  SP
                "FROM"     SP   comp-name SP
                "WHERE"    SP   cap-expr
                *orderby

              / "SELECT" SP cap-cols SP
                "FROM"   SP comp-name
                *orderby

   orderby    = "ORDER-BY" order-val

   order-val  = cap-cols / param / ( order-val "," order-val)


   Each element of the 'order-val' used must have an exact match to an
   entry in the 'cap-val' element. That is you can only order by
   elements that have been selected. Example:


   QUERY;SORT="LOCALE-SORT":SELECT DESCRIPTION,SUMMARY
    FROM VEVENT ORDER-BY SUMMARY

   QUERY;SORT="LOCALE-SORT":SELECT VEVENT
    FROM VAGENDA ORDER-BY SUMMARY




Author's Address

   Doug Royer
   http://INET-Consulting.com
   1795 W. Broadway #266
   Idaho Falls, Idaho  83402
   US

   Phone: 208-520-4044
   Fax:   866-594-8574
   EMail: Doug@Royer.com
   URI:   http://Royer.com/People/Doug





Royer                    Expires April 3, 2004                 [Page 10]

Internet-Draft                  CAP-SORT                    October 2003


Appendix A. Bibliography


   [CAP]     Royer, D., Babics, G., Hill, P. Mansour, S. "Calendar
             Access Protocol (CAP)", work in progress,
             draft-ietf-calsch-cap-12.txt.













































Royer                    Expires April 3, 2004                 [Page 11]

Internet-Draft                  CAP-SORT                    October 2003


Intellectual Property Statement

   The IETF takes no position regarding the validity or scope of any
   intellectual property or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; neither does it represent that it
   has made any effort to identify any such rights. Information on the
   IETF's procedures with respect to rights in standards-track and
   standards-related documentation can be found in BCP-11. Copies of
   claims of rights made available for publication and any assurances of
   licenses to be made available, or the result of an attempt made to
   obtain a general license or permission for the use of such
   proprietary rights by implementors or users of this specification can
   be obtained from the IETF Secretariat.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights which may cover technology that may be required to practice
   this standard. Please address the information to the IETF Executive
   Director.


Full Copyright Statement

   Copyright (C) The Internet Society (2003). All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works. However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assignees.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION



Royer                    Expires April 3, 2004                 [Page 12]

Internet-Draft                  CAP-SORT                    October 2003


   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Acknowledgment

   Funding for the RFC Editor function is currently provided by the
   Internet Society.











































Royer                    Expires April 3, 2004                 [Page 13]