-
Notifications
You must be signed in to change notification settings - Fork 0
/
ont.cljc
executable file
·202 lines (195 loc) · 6.27 KB
/
ont.cljc
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
(ns ont-app.graph-log.ont
(:require
[ont-app.igraph.core :as igraph]
[ont-app.igraph.graph :as graph]
[ont-app.igraph-vocabulary.core :as igv]
[ont-app.vocabulary.core :as voc]
)
)
(voc/put-ns-meta!
'ont-app.graph-log.rlog
{
:vann/preferredNamespacePrefix "rlog"
:vann/preferredNamespaceUri
"http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#"
:dc/description "RLOG - an RDF Logging Ontology"
:foaf/homepage
"https://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog/rlog.html"
:dcat/downloadURL
"https://github.com/NLP2RDF/ontologies/blob/master/rlog/rlog.ttl"
:voc/appendix
[["https://github.com/NLP2RDF/ontologies/blob/master/rlog/rlog.ttl"
:dcat/mediaType "text/turtle"]]
}
)
;; TODO import the RLOG source
(voc/put-ns-meta!
'ont-app.graph-log.ont
{
:vann/preferredNamespacePrefix "glog"
:vann/preferredNamespaceUri "http://rdf.naturallexicon.org/graph-log/ont#"
:rdfs/comment "
Contains logging costructs addressed in the graph-log code not found in the
rlog vocabulary."
})
(def alignment-to-rlog
"Many constructs in glog were appropriated from rlog. Using the sameAs
relation to keep the namepaces simple.
Breaking this out into its own graph to keep the log models small."
(igraph/add (graph/make-graph)
[
[:glog/ALL :owl/sameAs :rlog/ALL]
[:glog/DEBUG :owl/sameAs :rlog/DEBUG]
[:glog/ERROR :owl/sameAs :rlog/ERROR]
[:glog/Entry :owl/sameAs :rlog/Entry]
[:glog/FATAL :owl/sameAs :rlog/FATAL]
[:glog/INFO :owl/sameAs :rlog/INFO]
[:glog/Level :owl/sameAs :rlog/Level]
[:glog/OFF :owl/sameAs :rlog/OFF]
[:glog/TRACE :owl/sameAs :rlog/TRACE]
[:glog/WARN :owl/sameAs :rlog/WARN]
[:glog/level :owl/sameAs :rlog/level]
]))
(def ontology
(let [g (graph/make-graph)]
(voc/clear-caches!)
(igraph/add
g
[[:glog/Vocabulary
:igraph/imports :igraph/Vocabulary
]
[:igraph/Vocabulary
:igraph/compiledAs igv/ontology
]
[:glog/SaveToFn
:rdf/type :igraph/Function
:rdfs/comment "
Refers to an optionally provided function [log]-> pathname.
When provided with :igraph/compiledAs, the log-graph will be written
to <pathname> automatically in the log-reset! function before resetting
the contents of the graph.
"
]
[:glog/LogGraph
:rdf/type :igraph/Graph
:rdfs/comment "The URI of igraph.graph-log.core/log-graph"
]
[:glog/entryCount
:rdfs/domain :graph/Graph
:rdfs/range :xsd/NonNegativeInteger
:rdfs/comment "Asserts the number of log entries in this graph."
]
[:glog/Entry
:rdfs/comment "The grandparent class of all log entries"
]
[:glog/level
:rdfs/domain :glog/Entry
:rdfs/range :glog/Level
:rdfs/comment "Asserts the Level of an Entry type"
]
[:glog/Level
:rdf/type :rdfs/Class
:rdfs/comment "Refers to a logging level like :glog/WARN"
]
[:glog/ALL
:rdf/type :glog/Level
:glog/priority 0
:rdfs/comment "Signals that the log should record all log statements"
]
[:glog/TRACE
:rdf/type :glog/Level
:glog/priority 1
:rdfs/comment "Finer grained informational events than DEBUG"
]
[:glog/DEBUG
:rdf/type :glog/Level
:glog/priority 2
:rdfs/comment "A standard logging level"
]
[:glog/INFO
:rdf/type :glog/Level
:glog/priority 3
:rdfs/comment "A standard logging level"
]
[:glog/WARN
:rdf/type :glog/Level
:glog/priority 4
:rdfs/comment "A standard logging level"
]
[:glog/ERROR
:rdf/type :glog/Level
:glog/priority 5
:rdfs/comment "A standard logging level"
]
[:glog/FATAL
:rdf/type :glog/Level
:glog/priority 6
:rdfs/comment "A standard logging level"
]
[:glog/OFF
:rdf/type :glog/Level
:glog/priority 7
:rdfs/comment "Signals that the log should not record events."
]
[:glog/executionOrder
:rdf/type :rdf/Property
:rdfs/domain :glog/Entry
:rdfs/range :xsd/nonNegativeInteger
:rdfs/comment "
Asserts the order of execution for some Entry within a log."
]
[:glog/timestamp
:rdf/type :rdf/Property
:rdfs/domain :glog/Entry
:rdfs/range :xsd/nonNegativeInteger
:rdfs/comment "
Current time in milliseconds at time the Entry was created."
:owl/seeAlso :rlog/date ;; which uses Date string.
]
[:glog/InformsUri
:rdfs/subClassOf :rdf/Property
:rdfs/comment "
Refers to a property KWI whose name should inform the minting of each new
Entry's URI, in addition to its class and execution order, the better to
understand at a glance what the log entry is about."
]
[:glog/message
:rdfs/subClassOf :rdf/Property
:rdfs/domain :glog/Entry
:rdfs/range :rdf/Literal
:rdfs/comment "
A string or mustache template to print to the standard logging stream
via taesano.timbre. The flattened description of the entry will be
applied to its value to resolve template {{parameters}}.
"
]
;; ARCHIVING THE LOG GRAPH ON RESET
[:glog/FreshArchive
:rdf/type :rdfs/Class
:rdfs/comment "
An archived log which is the first of its lineage. Implied glog/iteration is 0. Not continuingFrom anything.
"
]
[:glog/iteration
:rdf/type :rdf/Property
:rdfs/domain :glog/Entry
:rdfs/range :xsd/nonNegativeInteger
:rdfs/comment "
Optional. Asserts the number of times this log has been reset. When non-nil this will inform the KWI of each entry."
]
[:glog/archivePathFn
:rdfs/domain :igraph/Graph
:rdfs/comment "Asserts a function [g] -> archive-path to which
the current state of the log may be written before resetting."
]
[:glog/archiveDirectory
:rdfs/domain :igraph/Graph
:rdfs/comment "Asserts the directory portion of the archive-path used
by archivePathFn. (only applicable if the local file system is used)"
]
[:glog/continuingFrom
:rdfs/domain :igraph/Graph
:rdfs/comment "Asserts the archive-path of the log previously archived
on the last reset."
]
])))