RE: opening hours RDF cal use case (easter rules seem to work too)

On Fri, 2003-03-14 at 04:00, Danny Ayers wrote:
> Great use case.
> 
> Any thoughts/progress on the Easter Sunday issue?
> 
> There do seem to be fairly simple procedural algorithms for doing this, but
> a callout to a procedure seems a very ugly approach (begs the question why
> not do it all with a procedure). Presumably the algorithm needs to be
> refactored into a declarative form (which shouldn't be too difficult, it's
> mostly if-thens).

Yeah... the good news is that there aren't too many else's.
else is akin to not, which is tricky in the semantic web.

>  But how's cwm at swms?

What's a swm?

Anyway... I converted the code below to N3 and put it in...
  http://www.w3.org/2002/12/cal/tzrules.n3

So you can do

$ python cwm.py tzrules.n3 --think

and from some test data facts in tzrules.n3...

  :DansBirthDay dt:date "1967-12-09".
  :USIndependenceDay dt:date "1776-07-04".

and the easter rules, cwm concludes...

    k:TheYear1776     a k:CalendarYear;
         tzr:easterDay "7";
         tzr:easterMonth "04";
         tzr:easterStep1 "38";
         k:temporallySubsumes tzr:USIndependenceDay,
                 [
             a tzr:EasterHoliday;
             dt:date "1776-04-07" ];
         dt:gYear "1776" .
     
    k:TheYear1967     a k:CalendarYear;
         tzr:easterDay "26";
         tzr:easterMonth "03";
         tzr:easterStep1 "26";
         k:temporallySubsumes tzr:DansBirthDay,
                 [
             a tzr:EasterHoliday;
             dt:date "1967-03-26" ];
         dt:gYear "1967" .


> 
> void
> CEasterDlg::GetEasterSunday( WORD wYear, WORD& wMonth, WORD& wDay )
> {
[...]

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

Received on Friday, 14 March 2003 12:21:06 UTC