-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrules.n3
122 lines (105 loc) · 3.13 KB
/
rules.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
@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 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#> .
edtfo:DecadeDescription rdfs:subClassOf time:DateTimeDescription .
edtfo:CenturyDescription rdfs:subClassOf time:DateTimeDescription .
edtfo:MillenniumDescription rdfs:subClassOf time:DateTimeDescription .
{
re:PARTIALLY_SPECIFIED_DATE = ?date
. ?w edtfo:inEDTFDateTime ?e
. ("^" ?date "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?w time:inDateTime ?dtd
} .
{
re:PARTIAL_YEAR = ?y
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?y "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:unitType time:unitYear
} .
{
re:PARTIAL_YEAR = ?y . re:PARTIAL_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:PARTIAL_YEAR = ?y . re:PARTIAL_MONTH = ?m . re:PARTIAL_DAY = ?d
. ?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ("^" ?y "-" ?m "-" ?d "$") string:concatenation ?re
. ?e string:matches ?re
} => {
?dtd time:unitType time:unitDay
} .
{
re:PARTIAL_YEAR = ?y . re:PARTIAL_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:PARTIAL_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
} .
{
?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. (?e "^(-?[0-9]{3})X") string:scrape ?d
. (?d xsd:integer) log:dtlit ?decade
} => {
?dtd a edtfo:DecadeDescription ;
edtfo:decade ?decade
} .
{
?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. (?e "^(-?[0-9]{2})XX") string:scrape ?c
. (?c xsd:integer) log:dtlit ?century
} => {
?dtd a edtfo:CenturyDescription ;
edtfo:century ?century
} .
{
?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. (?e "^(-?[0-9])XXX") string:scrape ?c
. (?c xsd:integer) log:dtlit ?millennium
} => {
?dtd a edtfo:MillenniumDescription ;
edtfo:millennium ?millennium
} .
{
?w edtfo:inEDTFDateTime ?e
. ?w time:inDateTime ?dtd
. ?e string:matches "^XXXX"
} => {
?dtd a time:DateTimeDescription
} .