calAx.n3
4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
@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 }.