W3C home > Mailing lists > Public > www-rdf-calendar@w3.org > December 2002

futureEvents.n3: an excercise in processing recurring events

From: Dan Connolly <connolly@w3.org>
Date: 19 Dec 2002 14:13:18 -0600
To: www-rdf-calendar@w3.org
Message-Id: <1040328798.19708.100.camel@dirk.dm93.org>
I got a new WearableGizmo. I was using evolution.
I need to know: what events from my evolution calendar need
to be in the WearableGizmo in order
for it to do its jobs of (a) beep when
I need to do something, and (b) don't let me
schedule two things at the same time?

clearly past events don't matter.

So I wrote this thingy to find events in the future.

The <,evocal.rdf> reference refers to the output of
  http://www.w3.org/2000/10/swap/pim/ical2rdf.pl
here's the makefile stanza:

,evocal.rdf: $(HOME)/evolution/local/Calendar/calendar.ics ical2rdf.pl
	$(PERL) ical2rdf.pl --xnames $(EVONS)
$(HOME)/evolution/local/Calendar/calendar.ics >$@

note: this uses YYYYMMDD for dates, but I intend
to enhance ical2rdf.pl to convert to YYYY-MM-DD form
presently.


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/


# $Id$
# @@ dc:description

@prefix s: <http://www.w3.org/2000/01/rdf-schema#> .

@prefix c: <http://www.w3.org/2000/10/swap/pim/ical#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix str: <http://www.w3.org/2000/10/swap/string#> .

@prefix : <futureEvents#>.
@prefix fe: <futureEvents#>.

# crude by-date selection of events; any repeating event
# that overlaps the interval at all is selected;
# e.g. stuff that happens every wednesday in March 2001
# is selected even when you ask about just one tuesday in March.
# originally implemented in perl in pdkb.pl in
# http://@@/palmagent/

#:window :start "20021214". #@@ enhance ical2rdf.pl to put hyphens in dates

this log:forAll :CAL, :EV, :ID, :RULE, :SUMMARY, :FREQ,
	:START, :STARTDATETIME, :STARTTZ, :STARTDATE, :KEY, :WHEN, :VAL.


:FutureOneTime s:subClassOf :FutureEvent.
:RepeatsIndefinitely s:subClassOf :FutureEvent.
:RepeatsUntilLater s:subClassOf :FutureEvent.
:BirthDay s:subClassOf :RepeatsIndefinitely.

{ ?X a [ s:subClassOf ?C ] } log:implies { ?X a ?C }.

# :FutureOneTime
c:date a :DateKeyProp.
c:value a :DateKeyProp.

{ <,evocal.rdf> log:semantics :CAL.

  :KEY a :DateKeyProp.

  :CAL log:includes {
    :EV  c:uid :ID;
        c:summary :SUMMARY;
        c:dtstart [ :KEY :START ]
  }.

  :CAL log:notIncludes {
    :EV c:rrule []
  }.

  :START str:notLessThan "20021210".

}
  log:implies
{
  :EV a :FutureOneTime;
      c:summary :SUMMARY;
      c:uid :ID;
      c:dtstart [ :KEY :START ]
}.



# :RepeatsIndefinitely
#   #@@other case: untimed, just a date
{
  <,evocal.rdf> log:semantics :CAL.

  :KEY a :DateKeyProp.

  :CAL log:includes {
    :EV  c:uid :ID;
        c:summary :SUMMARY;
        c:dtstart [ :KEY :START ];
        c:rrule :RULE.
    :RULE c:freq :FREQ.

  }.

  :CAL log:notIncludes {
    :RULE c:until []
  }.
}
  log:implies
{
  :EV a :RepeatsIndefinitely;
      c:summary :SUMMARY;
      c:uid :ID;
      c:dtstart [
         :KEY :START
      ];
      c:rrule [ c:freq :FREQ ].

 }.

# :RepeatsUntilLater
#   #@@other case: untimed, just a date
{
  <,evocal.rdf> log:semantics :CAL.

  :KEY a :DateKeyProp.

  :CAL log:includes {
    :EV  c:uid :ID;
        c:summary :SUMMARY;
        c:dtstart [ :KEY :START ];
        c:rrule [ c:until :WHEN ]
        .
  }.

  :WHEN str:notLessThan "200206".

}
  log:implies
{
  :EV a :RepeatsUntilLater;
      c:summary :SUMMARY;
      c:uid :ID;
      c:dtstart [
         :KEY :START
      ].
   #@@ copy the :rrule
 }.


###
# grab timezone
{ :EV a :FutureEvent; c:uid :ID; c:dtstart :START.

  <,evocal.rdf> log:semantics :CAL.

  :CAL log:includes {
    [ c:uid :ID; c:dtstart [ c:tzid :STARTTZ ]].
  }
}
  log:implies { :START c:tzid :STARTTZ }.

###
# birthdays
{
  :EV a :FutureEvent; c:summary [ str:containsIgnoringCase "birthday" ]
} log:implies { :EV a :Birthday }.

###
# grab rrule properties
{
  :EV a :FutureEvent; c:uid :ID; c:rrule :RULE.

  <,evocal.rdf> log:semantics :CAL.

  :CAL log:includes {
    [ c:uid :ID; c:rrule [ :KEY :VAL ] ]
  }
}
  log:implies { :RULE :KEY :VAL }.

#@@ other properties to grab:
# description
# dtend
# valarm?
# contacts
# location
Received on Thursday, 19 December 2002 15:13:21 GMT

This archive was generated by hypermail 2.2.0 + w3c-0.30 : Friday, 25 March 2005 11:20:43 GMT