-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.n3
164 lines (138 loc) · 3.96 KB
/
common.n3
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
159
160
161
162
163
164
@base <https://periodo.github.io/edtf-ontology/> .
@prefix bipm: <http://www.opengis.net/def/trs/BIPM/0/> .
@prefix edtfo: <edtfo.ttl#> .
@prefix iso8601: <http://www.opengis.net/def/uom/ISO-8601/0/> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix re: <rules/regexes/> .
@prefix rules: <rules/> .
@prefix string: <http://www.w3.org/2000/10/swap/string#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
time:inDateTime rdfs:domain time:Instant .
# time:DateTimeDescription
# rdfs:subClassOf [
# a owl:Restriction ;
# owl:onProperty time:hasTRS ;
# owl:hasValue iso8601:Gregorian ;
# rules:includeInInferenceResults false
# ] ;
# rules:includeInInferenceResults false .
{
re:YEAR = ?y . re:MONTH = ?m . re:DAY = ?d . re:TIME = ?t
. ?w edtfo:inEDTFDateTime ?e
. ("^" ?y "(-" ?m "(-" ?d "(T" ?t "Z?" ")?" ")?" ")?" "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?w time:inDateTime [
a time:DateTimeDescription
]
} .
{
re:YEAR = ?y
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?y "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:unitType time:unitYear
} .
{
re:YEAR = ?y . re:MONTH = ?m
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?y "-" ?m "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:unitType time:unitMonth
} .
{
re:DATE = ?d
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?d "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:unitType time:unitDay
} .
{
re:DATETIME = ?dt
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?dt "Z?$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:unitType time:unitSecond
} .
{
re:YEAR = ?y
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^(" ?y ")") string:concatenation ?re
. (?e ?re) string:scrape ?y_string
. (?y_string xsd:gYear) log:dtlit ?gyear
} => {
?dtd time:year ?gyear
} .
{
re:YEAR = ?y . re:MONTH = ?m
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?y "-(" ?m ")") string:concatenation ?re
. (?e ?re) string:scrape ?m_string
. ("--" ?m_string) string:concatenation ?m_value
. (?m_value xsd:gMonth) log:dtlit ?gmonth
} => {
?dtd time:month ?gmonth
} .
{
re:YEAR = ?y . re:MONTH = ?m . re:DAY = ?d
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?y "-" ?m "-(" ?d ")") string:concatenation ?re
. (?e ?re) string:scrape ?d_string
. ("---" ?d_string) string:concatenation ?d_value
. (?d_value xsd:gDay) log:dtlit ?gday
} => {
?dtd time:day ?gday
} .
{
re:DATE = ?d . re:HOUR = ?h
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?d "T(" ?h ")") string:concatenation ?re
. (?e ?re) string:scrape ?h_string
. (?h_string xsd:nonNegativeInteger) log:dtlit ?hour
} => {
?dtd time:hour ?hour
} .
{
re:DATE = ?d . re:HOUR = ?h . re:MINUTE = ?m
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?d "T" ?h ":(" ?m ")") string:concatenation ?re
. (?e ?re) string:scrape ?m_string
. (?m_string xsd:nonNegativeInteger) log:dtlit ?minute
} => {
?dtd time:minute ?minute
} .
{
re:DATE = ?d . re:HOUR = ?h . re:MINUTE = ?m . re:SECOND = ?s
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?d "T" ?h ":" ?m ":(" ?s ")") string:concatenation ?re
. (?e ?re) string:scrape ?s_string
. (?s_string xsd:decimal) log:dtlit ?second
} => {
?dtd time:second ?second
} .
{
re:DATETIME = ?d
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?d "Z$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:timeZone bipm:UTC
} .