itin2ical.n3 4.61 KB
@prefix dc: <http://purl.org/dc/elements/1.1/> .

<> dc:description """
rules to map from Navigant itinerary vocabulary
to iCalendar vocabulary.
$Id: itin2ical.n3,v 1.6 2002/06/04 01:45:09 connolly Exp $
""";
  dc:source [ = <http://ilrt.org/discovery/2001/06/schemas/ical-full/hybrid.rdf>;
    dc:source <http://www.ietf.org/rfc/rfc2445.txt> ].


@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix ical: <http://ilrt.org/discovery/2001/06/schemas/ical-full/hybrid.rdf#>.

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


     @prefix n: <http://www.w3.org/2001/07dc-bos/grokNavItin#> .
     @prefix pa: <http://www.w3.org/2000/08/palm56/addr#> .
     @prefix pd: <http://www.w3.org/2000/08/palm56/datebook#> .
     @prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

@prefix : <#>.

this log:forAll :flt, :carrierName, :num, :sum,
    :yymmdd, :hh_mm, :hh_mm2, :dtstart, :dtend, :tz, :tz2,
    :where, :fromName, :toName.

# things with the same airportname have the same timezone
{ :where n:airportName [ is n:airportName of [ :timeZone :tz ] ] }
  log:implies { :where :timeZone :tz }.
#hmm... someplace to scrape these from?

@prefix a: <http://www.daml.org/cgi-bin/airport?>. #hmm... ?MCI is a document *and* an airport?
a:MCI 
  n:airportName "KANSAS CITY INTL";
  :timeZone :ChicagoTime.
a:STL n:airportName "ST LOUIS INTL";
  :timeZone :ChicagoTime.
a:ORD n:airportName "CHICAGO OHARE";
 :timeZone :ChicagoTime.
a:DFW n:airportName "DALLAS FT WORTH";
 :timeZone :ChicagoTime.
a:EWR n:airportName "NEWARK";
   :timeZone :NewYorkTime.
a:BOS n:airportName "BOSTON";
  :timeZone :NewYorkTime.
a:DCA n:airportName "WASHINGTON REAGAN";
  :timeZone :NewYorkTime.
a:NCE n:airportName "NICE";
  :timeZone :ParisTime.
a:LHR n:airportName "LONDON HEATHROW";
  :timeZone :LondonTime.
a:SFO n:airportName "SAN FRANCISCO";
  :timeZone :LosAngelesTime.

{ :flt
    n:date :yymmdd;
    n:carrier [ pa:company :carrierName ];
    n:flightNum :num;
    n:LV [ n:time :hh_mm;
           n:place [ n:airportName :fromName;
                     :timeZone [ ical:TZID :tz] ] ];
    n:AR [ n:place [ n:airportName :toName;
                     :timeZone [ ical:TZID :tz2] ];
           n:time :hh_mm2 ].
  (:carrierName " #" :num " from " :fromName " to " :toName) str:concatenation :sum.
  (:yymmdd "T" :hh_mm ":00") str:concatenation :dtstart. #@@ extra punct in dates
  (:yymmdd "T" :hh_mm2 ":00") str:concatenation :dtend.
}
 log:implies {
  :flt a ical:VEVENT;
    ical:SUMMARY :sum;
    ical:DTSTART [ ical:TZID :tz; #@@hybrid handles tzids differently
                                  #hmm... property params should modivy the property, not the object, no?
                   r:value :dtstart ];
    ical:DTEND [
      ical:TZID :tz2;
      r:value :dtend
    ].
  
}.


# Timezone stuff transcribed from an evolution calendar...
# original source seems to be...

<> dc:source [ = <ftp://elsie.nci.nih.gov/pub/>;
  dc:creator "Olson, A.D., et al"; #@@ lazy...
  dc:title "Time zone code and data";
  dc:description "updated periodically" ].


:ChicagoTime a ical:VTIMEZONE;
  ical:TZID "/softwarestudio.org/Olson_20011030_5/America/Chicago";
  ical:_subComponent [
    a ical:STANDARD;
    ical:TZOFFSETFROM "-0500";
    ical:TZOFFSETTO "-0600";
    ical:TZNAME "CST";
    ical:DTSTART "19701025T020000";
    ical:RRULE [ ical:FREQ ical:YEARLY; ical:INTERVAL "1";
                 ical:BYDAY "-1SU"; # maybe (-1 ical:SU)?
                 ical:BYMONTH "10" ]
  ],
  [
    a ical:DAYLIGHT;
    ical:TZOFFSETFROM "-0600";
    ical:TZOFFSETTO "-0500";
    ical:TZNAME "CDT";
    ical:DTSTART "19700405T020000";
    ical:RRULE [ ical:FREQ ical:YEARLY;
                 ical:INTERVAL "1"; ical:BYDAY "1SU"; ical:BYMONTH "4" ];
   ].


:NewYorkTime a ical:VTIMEZONE;
  ical:TZID "/softwarestudio.org/Olson_20011030_5/America/New_York";
  ical:_subComponent [
    a ical:STANDARD;
    ical:TZOFFSETFROM "-0400";
    ical:TZOFFSETTO "-0500";
    ical:TZNAME "EST";
    ical:DTSTART "19701025T020000";
    ical:RRULE [ ical:FREQ ical:YEARLY; ical:INTERVAL "1";
                 ical:BYDAY "-1SU"; ical:BYMONTH "10" ];
  ],
  [
    a ical:DAYLIGHT;
    ical:TZOFFSETFROM "-0500";
    ical:TZOFFSETTO "-0400";
    ical:TZNAME "EDT";
    ical:DTSTART "19700405T020000";
    ical:RRULE [ ical:FREQ ical:YEARLY; ical:INTERVAL "1";
                 ical:BYDAY "1SU"; ical:BYMONTH "4" ]
  ].

:ParisTime
  ical:TZID "/softwarestudio.org/Olson_20011030_5/Europe/Paris"
  # more properties...@@
  .

:LondonTime
  ical:TZID "/softwarestudio.org/Olson_20011030_5/Europe/London"
  # more properties...@@
  .


:LosAngelesTime
  ical:TZID "/softwarestudio.org/Olson_20011030_5/America/Los_Angeles"
  # more properties...@@
  .