upcomingBrief.n3 1.49 KB
@prefix dc: <http://purl.org/dc/elements/1.1/>.

<> dc:description """
textual summary of upcoming iCalendar events.

USAGE:

  $ python cwm.py myCal.rdf anotherCal.rdf upcomingBrief.n3 --think 
	--strings --with 2004-03-29 >stuff.txt


TODO:
  @@ timezones
  @@ recurring events
""",
"$Id: upcomingBrief.n3,v 1.4 2005/09/05 14:38:14 connolly Exp $".

@prefix cal: <http://www.w3.org/2002/12/cal/icaltzd#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix str: <http://www.w3.org/2000/10/swap/string#> .
@prefix os: <http://www.w3.org/2000/10/swap/os#> .

@prefix : <#>.

{ "1" os:argv ?WHEN } => { ?WHEN a :TimeBoundary }.


{ ?E a cal:Vevent;
     cal:dtstart ?WHEN.
  ?WHEN str:notLessThan [ a :TimeBoundary ].
} => { ?E :when ?WHEN }.

{ ?E a cal:Vevent;
     :when ?WHEN;
     cal:summary ?WHAT.

  (?WHEN ".0") str:concatenation ?K0.
  (?WHEN ".1") str:concatenation ?K1.
  (?WHEN ".2") str:concatenation ?K2.
  (?WHEN ".9") str:concatenation ?K9.

} => {
 ?K0 log:outputString ?WHEN .
 ?K1 log:outputString ": " .
 ?K2 log:outputString ?WHAT .
 ?K9 log:outputString "\n" .
 }.

{ ?E a cal:Vevent;
     :when ?WHEN;
     cal:location ?WHERE.

  (?WHEN ".31") str:concatenation ?K31.
  (?WHEN ".32") str:concatenation ?K32.
} => {
 ?K31 log:outputString " @ ".
 ?K32 log:outputString ?WHERE.
 }.

{ ?E a cal:Vevent;
     :when ?WHEN;
     cal:dtend ?WHEN2.

  (?WHEN ".35") str:concatenation ?K35.
  (?WHEN ".36") str:concatenation ?K36.
} => {
 ?K35 log:outputString " thru ".
 ?K36 log:outputString ?WHEN2.
 }.