Subject: Re: list of items (recur-id is not CAP)

From: Doug Royer <[email-masked]>
Date: Mon, 24 Nov 2003 17:03:10 -0700

Arnaud Quillaud wrote:

>Actually, if I understand it correctly, the following section of CAP
>seems to make use of the "wrong" model for recurrence-id:
><<
>6.1.1.15 Query by Date-Time range
>
>   This query selects the entire content of every booked "VEVENT"
>   component that has an instance greater than or equal to July 1st,
>   2000 00:00:00 UTC and less than or equal to July 30st, 2000 23:59:59
>   UTC. This includes single instance "VEVENT" components that do no
>   explicitly contain any recurrence properties or "RECURRENCE-ID"
>   properties. This works only for CSs that have the "RECUR-EXPAND"
>   property value set to "TRUE" in the "GET-CAPABILITY" exchange.
>
>   BEGIN:VQUERY
>   EXPAND:TRUE
>   QUERY:SELECT * FROM VEVENT
>   WHERE RECURRENCE-ID >= '20000701T000000Z'
>   AND RECURRENCE-ID <= '20000730T235959Z'
>   AND STATE() = 'BOOKED'
>   END:VQUERY
>  
>
>Since the recurrence-id of an instance might not correspond to its
>current dtstart, the example above won't do what its description says it
>should do.
>Why can't we use the DTSTART for this type of query ?
>
If you sent:

    QUERY:SELECT * FROM VEVENT
      WHERE DTSTART >='20000701T000000Z'
       AND DTSTART <='20000730T235959Z'

You would get back VEVENTs with a DTSTART property value between
those two dates. If a recurring VEVENT existed and was daily starting
from DTSTART:19990101T000000Z, it  would not match the query, even
when one of its instances (RECURRENCE-ID) did match. The same is
true if the VEVENT had a RDATE:20000702T000000Z, as you did not
query for RDATE, it would not match as RDATE is not DTSTART.

The DTSTART value only matches the RECURRENCE-ID on the first instance
of a repeating object. If you query for DTSTART values, that is what you 
will get.
If you query for RECURRENCE-ID values, then you get any VEVENT that
has an effective instance start time that matches that value (somehow stored
or computed).

All objects with an RRULE or RDATE property values have virtual
RECURRENCE-ID's even when an RECURRENCE-ID was
not explicitly sent or stored in the object.

What do you think you would get back if EXPAND:FALSE were in
the CAP example?

-- 

Doug Royer                     |   http://INET-Consulting.com
-------------------------------|-----------------------------
[email-masked]                 | Office: (208)520-4044
http://Royer.com/People/Doug   |    Fax: (866)594-8574
                               |   Cell: (208)520-4044

               We Do Standards - You Need Standards

---

From: Arnaud Quillaud <[email-masked]>
Date: Tue, 25 Nov 2003 10:09:51 -0800

> -----Original Message-----
> From: Doug Royer [mailto:[email-masked]]
> Sent: Monday, November 24, 2003 4:03 PM
> To: [email-masked]
> Subject: Re: list of items (recur-id is not CAP)
> 
> 
> 
> 
> Arnaud Quillaud wrote:
> 

Why ? Each of the instances of a recurring event has a DTSTART as far as I know.
Why would we take into account only the first instance ?

> has an effective instance start time that matches that value 

That is true only if the RECURRENCE-ID of the instance matches the DTSTART of this instance.
If this instance was originally:
 
RECURRENCE-ID:20000729T000000Z
DTSTART:20000729T000000Z

 but the DTSTART is moved to 20000802T000000Z

we end up with

RECURRENCE-ID:20000729T000000Z
DTSTART:20000802T000000Z

If the "Query by Date-Time range" in the CAP example is done using the RECURRENCE-ID, this particular instance will be returned when it actually doesn't belong to that range.

> What do you think you would get back if EXPAND:FALSE were in

My understanding is that we would return any event object that has at least one instance that matches the filter (whether it is RECURRENCE-ID or DTSTART).
So for recurring event, we would return the MASTER event (the one containing RRULE/RDATE) and all its exceptions if there are any.

If we take a daily VEVENT starting  from DTSTART:19990101T000000Z and recurring forever, it would be a match even though the DTSTART of this master event is not in the range.
So we would get back:

BEGIN:VEVENT
DTSTART:19990101T000000Z
RRULE:FREQ=DAILY
...

But that is far from being obvious. After reading the CAP spec, I should say that I don't know.

Arnaud

---

From: Doug Royer <[email-masked]>
Date: Tue, 25 Nov 2003 13:27:30 -0700

>Why would we take into account only the first instance ?
The object that would be returned with a RECURRENCE-ID as shown in the
CAP QUERY example would return:

    VEVENT:

	DTSTART:19990101T000000Z
	RECURRENCE-ID: ...something that matched....

So the DTSTART still does not match, however the RECURRENCE-ID
that is calculated from EXPAND:TRUE does match.

When expanding an existing recurring object, you do not
modify the DTSTART value, you add a RECURRENCE-ID property
to be the effective start time of the Nth instance(s) that
match.

>That is true only if the RECURRENCE-ID of the instance matches the DTSTART of this instance.
The first instance always matches the DTSTART value, else you could 
never compute
the second.

And 2445:

   The "DTSTART" property for a "VEVENT" specifies the inclusive start
   of the event. For recurring events, it also specifies the very first
   instance in the recurrence set.

>RECURRENCE-ID:20000729T000000Z
The 1st instance can not be less than the DTSTART value as 2445 mandates
that DTSTART is the first instance.

>If the "Query by Date-Time range" in the CAP example is done using the RECURRENCE-ID, this particular instance will be returned when it actually doesn't belong to that range.

You example was not valid.

>So for recurring event, we would return the MASTER event (the one containing RRULE/RDATE) and all its exceptions if there are any.
If you have EXPAND:TRUE, and query for RECURRENCE-ID, then ALL matching
VEVENTs that contain any RRULE  or RDATE would also contain a calculated
RECURRENCE-ID. Without the RECURRENCE-ID in a returned object that
also contains an RRULE or RDATE, then that object  returned is 
specifying a set of
UNexpaned instances. So no, you would not get back the master object 
that contained
unexpanded instances.

If you have EXPAND:FALSE and query for RECURRENCE-ID, you will get
back one object without any RECURRENCE-ID, which if expanded would match.

If you have EXPAND:TRUE and query for DTSTART, you will only get
objects that have a DTSTART value in that range.

If you have EXPAND:FALSE and query for DTSTART, you will only get
objects that have a DTSTART value in that range.

>If we take a daily VEVENT starting  from DTSTART:19990101T000000Z and recurring forever, it would be a match even though the DTSTART of this master event is not in the range.
Again, DTSTART is not modified, only RECURRENCE-ID is added to the
returned object(s) in EXPAND:TRUE.

--