calAx.n3 4.23 KB
@prefix s: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dt: <http://www.w3.org/2001/XMLSchema#>.

<> s:comment """Calendar Axioms.

These are intended to connect RDF Calendar to
OWL time by Hobbes et. al. Currently, they
connect to Cyc, though OWL time and Cyc are
both based on Allen's work.

So far, these rules support a "one trip per month" policy.
""";
s:seeAlso <../../../2000/10/swap/test/one_trip_per_month.n3>.


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

@prefix cal: <http://www.w3.org/2002/12/cal/icaltzd#>.
@prefix k: <http://www.cyc.com/2004/06/04/cyc#>.

@keywords is, of, a.

@prefix : <calAx#>.

###
# Relate Cyc to iCalendar; e.g. YearFn and MonthFn to cal:dtstart

cal:dtstart a :DateProperty.
cal:dtend a :DateProperty.

# For every event, the year it starts/ends in exists.
{ ?P a :DateProperty.
  ?E ?P [ time:year ?Y ].
} => { ?Y k:YearFn [] }.

# Likewise Months
{ ?P a :DateProperty.
  ?E ?P [ time:year ?Y; time:month ?M].
  ?Y k:YearFn ?YEAR.
  ?M k:MonthOfYearFn ?MONTH_TYPE.
} => {
 (?MONTH_TYPE ?YEAR) k:MonthFn [ is k:temporallySubsumes of ?YEAR ].
}.


# relate days to months
{ ?P a :DateProperty.
  ?E ?P ?WHEN.
  ?WHEN time:year ?Y; time:month ?M; time:day ?D.
  ?Y k:YearFn ?YEAR.
  ?M k:MonthOfYearFn ?MONTH_TYPE.
 (?MONTH_TYPE ?YEAR) k:MonthFn ?MONTH.
} =>
{
  (?D ?MONTH) k:DayFn ?WHEN.
  ?MONTH k:temporallySubsumes ?WHEN.
}.

cal:dtstart s:subPropertyOf k:startsDuring.
cal:dtend s:subPropertyOf :endsBeforeStartOf.
:endsBeforeStartOf owl:inverseOf k:startsAfterEndingOf.

# TODO: break this down to StartFn and such
{ ?E1 cal:start [ str:notLessThan [ is cal:end of ?E2 ] ]
} => { ?E1 k:startsAfterEndingOf  ?E2 }.



####
# a bit of Cyc
<> s:seeAlso <http://www.cyc.com/cycdoc/vocab/time-vocab.html>.

1 k:MonthOfYearFn k:January.
2 k:MonthOfYearFn k:February.
3 k:MonthOfYearFn k:March.
4 k:MonthOfYearFn k:April.
5 k:MonthOfYearFn k:May.
6 k:MonthOfYearFn k:June.
7 k:MonthOfYearFn k:July.
8 k:MonthOfYearFn k:August.
9 k:MonthOfYearFn k:September.
10 k:MonthOfYearFn k:October.
11 k:MonthOfYearFn k:November.
12 k:MonthOfYearFn k:December.

k:YearFn a owl:FunctionalProperty; s:range k:CalendarYear.
k:MonthFn a owl:FunctionalProperty; s:range k:CalendarMonth.
k:CalendarMonth s:subClassOf k:temporallyContinuous.
k:MonthOfYearFn a owl:FunctionalProperty; s:range k:MonthOfYearType.

k:startsAfterEndingOf s:subPropertyOf k:temporallyDisjoint.
k:temporallyDisjoint s:subPropertyOf owl:differentFrom.

k:startsDuring s:subPropertyOf k:temporalBoundsIntersect.
k:temporallySubsumes s:subPropertyOf k:temporalBoundsSubsume,
 k:temporallyIntersects.

k:temporallyIntersects s:subPropertyOf k:temporalBoundsIntersect.
k:temporalBoundsSubsume s:subPropertyOf k:temporalBoundsIntersect.
k:temporalBoundsIntersect a owl:SymmetricProperty.

{ ?BIG k:temporallySubsumes [ is k:startsDuring of ?E ] }
=> { ?E k:startsDuring ?BIG }.
{ ?BIG k:temporallySubsumes [ is k:endsDuring of ?E ] }
=> { ?E k:endsDuring ?BIG }.


{ ?LITTLE k:startsDuring ?BIG.
  ?LITTLE k:endsDuring ?BIG.
} => { ?BIG k:temporalBoundsSubsume ?LITTLE }.

{ ?E k:startsDuring ?BIG.
  ?BIG k:temporallySubsumes [
    k:startsAfterEndingOf ?E].
} => { ?BIG k:temporalBoundsSubsume ?E }.

{ ?BIG a k:temporallyContinuous;
     k:temporalBoundsSubsume ?LITTLE
} => { ?BIG k:temporallySubsumes ?LITTLE }.

{
 ?BIG k:temporalBoundsSubsume ?LITTLE.
 ?E k:temporalBoundsIntersect ?LITTLE }
 => { ?E k:temporalBoundsIntersect ?BIG }.

{ ?T1 k:temporallySubsumes [ k:temporalBoundsIntersect ?T2 ]}
=> { ?T1 k:temporalBoundsIntersect ?T2 }.


###
# A bit of OWL
{ ?S ?P ?O1, ?O2.
  ?S a [ owl:onProperty ?P; owl:maxCardinality 1]
} => { ?O1 = ?O2 }.

{ ?P a owl:SymmetricProperty.
  ?S ?P ?O } => { ?O ?P ?S }.

{ ?S [ owl:inverseOf ?P ] ?O } => { ?O ?P ?S }.

owl:inverseOf a owl:SymmetricProperty.

{ ?P a owl:TransitiveProperty.
  ?S ?P [ ?P ?O]. } => { ?S ?P ?O }.

{ ?S ?P [ owl:sameAs ?O ] } => { ?S ?P ?O }.
owl:sameAs a owl:SymmetricProperty.

###
# A bit of RDFS
{ ?S a [ s:subClassOf ?C ] } => { ?S a ?C }.
{ [] [ s:range ?C] ?O } => { ?O a ?C }.
{ ?S [ s:subPropertyOf ?P ] ?O } => { ?S ?P ?O }.