-
Notifications
You must be signed in to change notification settings - Fork 17
/
log-rules.n3
469 lines (374 loc) · 18.5 KB
/
log-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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
### Logic Framework Extension -- Jos De Roo
### importing http://www.w3.org/2000/10/swap/log
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
<> owl:imports <http://www.w3.org/2000/10/swap/log>.
### classes
e:Builtin a rdfs:Class;
rdfs:comment "class of EYE built-ins".
e:ComplexNumber a rdfs:Class;
rdfs:comment "class of complex numbers";
rdfs:subClassOf e:Tuple;
e:tupleTypes (e:Number e:Number).
e:Component a rdfs:Class;
rdfs:comment "class of EYE components".
e:Context a rdfs:Class;
rdfs:comment "class of contexts";
rdfs:subClassOf rdf:List;
e:listType rdfs:Resource.
e:Fact a rdfs:Class;
rdfs:comment "class of facts".
e:Lemma a rdfs:Class;
rdfs:comment "class of lemmas".
e:Number a rdfs:Class;
rdfs:comment "class of numbers";
rdfs:subClassOf rdfs:Literal.
e:Numbers a rdfs:Class;
rdfs:comment "class of lists of numbers";
rdfs:subClassOf rdf:List;
e:listType e:Number.
e:PairOfNumbers a rdfs:Class;
rdfs:comment "class of pairs of numbers";
rdfs:subClassOf e:Tuple;
e:tupleTypes (e:Numbers e:Numbers).
e:Polynomial a rdfs:Class;
rdfs:comment "class of polynomials";
rdfs:subClassOf rdf:List;
e:listType e:ComplexNumber.
e:Recursion a rdfs:Class;
rdfs:comment "class of recursion numbers";
rdfs:subClassOf e:Number.
e:Roots a rdfs:Class;
rdfs:comment "class of roots of polynomials";
rdfs:subClassOf rdf:List;
e:listType e:ComplexNumber.
e:Scope a rdfs:Class;
rdfs:comment "class of (context recursion) pairs where a context is a list of consulted URI's and a recursion is the deductive closure recursion number";
rdfs:subClassOf e:Tuple;
e:tupleTypes (e:Context e:Recursion).
e:ScopeOrFormula a rdfs:Class;
rdfs:comment "e:Scope or log:Formula";
rdfs:subClassOf e:Tuple;
e:tupleTypes (e:Context e:Recursion).
e:Tuple a rdfs:Class;
rdfs:comment "class of n-tuples";
rdfs:subClassOf rdf:List.
e:TupleTypes a rdfs:Class;
rdfs:comment "class of lists of types";
rdfs:subClassOf rdf:List;
e:listType rdfs:Class.
### constants
e:epsilon a e:Number;
rdfs:comment "the difference between the float 1.0 and the first larger floating point number".
e:F a rdfs:Resource;
rdfs:comment "identifier for boolean false".
e:T a rdfs:Resource;
rdfs:comment "identifier for boolean true".
### properties
e:avg a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate the average e.g. (55 66 72 87 56 77 73 69 74 56) e:avg 68.5";
rdfs:domain e:Numbers;
rdfs:range e:Number.
e:becomes a rdf:Property, e:Builtin;
rdfs:comment "built-in to perform RDF linear implication i.e. retracting the subject graph and asserting the object graph";
rdfs:domain log:Formula;
rdfs:range log:Formula.
e:before a rdf:Property, e:Builtin;
rdfs:comment "built-in to call the subject formula before the object formula";
rdfs:domain log:Formula;
rdfs:range log:Formula.
e:biconditional a rdf:Property, e:Builtin;
rdfs:comment "built-in and object is conditional belief of first element of subject list given rest of subject list";
rdfs:domain rdf:List;
rdfs:range e:Number.
e:binaryEntropy a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate binary entropy e.g. 0.25 e:binaryEntropy 0.8112781244591328";
rdfs:domain e:Number;
rdfs:range e:Number.
e:boolean a rdf:Property;
rdfs:comment "to model a logical proposition";
rdfs:domain rdfs:Resource;
rdfs:range [ owl:oneOf (e:F e:T)].
e:calculate a rdf:Property, e:Builtin;
rdfs:comment """built-in to evaluate arithmetic expressions e.g.
("1+1") e:calculate 2 .
?X log:equalTo 3. ("sqrt(_width^2+_length^2)" ?X 4) e:calculate 5.0 .
("_period-250" "PT5M2S"^^xsd:dayTimeDuration) e:calculate 52.0 .
the first element of the subject list is the arithmetic expression in which variable names start with an underscore and the rest of the subject list are the variable values
the supported arithmetic functions are described in http://www.swi-prolog.org/pldoc/man?section=functions""";
rdfs:domain rdf:List;
rdfs:range e:Number.
e:call a rdf:Property, e:Builtin;
rdfs:comment "built-in to call the object formula within the subject scope or formula and to succeed when the call succeeds";
rdfs:domain e:ScopeOrFormula;
rdfs:range log:Formula.
e:cartesianProduct a rdf:Property, e:Builtin;
rdfs:comment "built-in (L1 L2 ... Ln) e:cartesianProduct L, where L is the n-ary cartesian product of the sets L1, L2, ...., Ln";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:clashesWith a rdf:Property;
rdfs:comment "to say that the graph is XSD-inconsistent or has a datatype clash";
rdfs:domain rdfs:Literal;
rdfs:range rdfs:Datatype.
e:closure a rdf:Property, e:Builtin;
rdfs:comment "builtin to test the deductive closure; is within the subject scope of all asserted N3 formulae and their log:conclusion";
rdfs:domain rdf:List;
rdfs:range log:Formula.
e:columns a rdf:Property;
rdfs:comment "to list the webized relational database collumns";
rdfs:domain rdfs:Class;
rdfs:range rdf:List.
e:compoundTerm a rdf:Property, e:Builtin;
rdfs:comment """built-in to create a compound term e.g. ("date(_Y, _M, _D, 0, 0, 0.0, 0, 'UTC', -)" ?Y ?M ?D) e:compoundTerm ?T.
the first element of the subject list is the template expression in which variable names start with an underscore and the rest of the subject list are the variable values""";
rdfs:domain rdf:List;
rdfs:range rdfs:Resource.
e:conditional a rdf:Property;
rdfs:comment "object is conditional belief of first element of subject list given rest of subject list";
rdfs:domain rdf:List;
rdfs:range e:Number.
e:cov a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate the sample covariance e.g. ((55 66 72 87 56 77 73 69 74 56) (1.66 1.78 1.87 1.92 1.66 1.89 1.86 1.79 1.80 1.66)) e:cov 0.992777777777778";
rdfs:domain e:PairOfNumbers;
rdfs:range e:Number.
e:csvTuple a rdf:Property, e:Builtin;
rdfs:comment "to generate CSV output with --strings; columns ending with ID are outputted as Modified Base64 for XML identifiers encoded SHA-1 hash";
rdfs:domain rdfs:Resource;
rdfs:range rdf:List.
e:derive a rdf:Property, e:Builtin;
rdfs:comment """built-in to interpret prolog predicates e.g.
("atom_codes" "HOME" (72 79 77 69)) e:derive true.
("=.." ?U ("date" 1970 1 1 0 0 0.0 0 "UTC" "-")) e:derive true.
("date_time_stamp" ?U 0^math:equalTo) e:derive true.
the supported prolog predicates are described in http://www.swi-prolog.org/pldoc/man?section=builtin""";
rdfs:domain rdf:List;
rdfs:range xsd:boolean.
e:exec a rdf:Property, e:Builtin;
rdfs:comment "built-in to execute te subject command line string and return the object integer";
rdfs:domain xsd:string;
rdfs:range xsd:integer.
e:fail a rdf:Property, e:Builtin;
rdfs:comment "built-in to call the object formula within the subject scope and to succeed when the call fails";
rdfs:domain e:ScopeOrFormula;
rdfs:range log:Formula.
e:finalize a rdf:Property, e:Builtin;
rdfs:comment "built-in to call object formula exactly once after subject formula is finished: either on failure, deterministic success, commit, or an exception";
rdfs:domain log:Formula;
rdfs:range log:Formula.
e:findall a rdf:Property, e:Builtin;
rdfs:comment """built-in used as ?SCOPE e:findall (?SELECT ?WHERE ?ANSWER).
within the subject ?SCOPE it unifies ?ANSWER with a list that contains all the instantiations of ?SELECT satisfying the ?WHERE clause
it is not binding the free variables in ?WHERE""";
rdfs:domain e:ScopeOrFormula;
rdfs:range rdf:List.
e:fileString a rdf:Property, e:Builtin;
rdfs:comment "built-in to read the file contents into a string";
rdfs:domain xsd:string;
rdfs:range xsd:string.
e:firstRest a rdf:Property, e:Builtin;
rdfs:comment "built-in to convert a list into its first rest tuple";
rdfs:domain rdf:List;
rdfs:range e:Tuple.
e:format a rdf:Property, e:Builtin;
rdfs:comment """built-in with the subject a list, whose first member is a format string, and whose remaining members are
arguments to the format string. The format string is the one used in prolog's format predicate.
The object is calculated from the subject""";
rdfs:domain rdf:List;
rdfs:range rdfs:Literal.
e:graphCopy a rdf:Property, e:Builtin;
rdfs:comment "built-in to make a bounded copy of the subject graph e.g. {:a :b :c. :d :e :f} e:graphCopy ?GRAPH";
rdfs:domain log:Formula;
rdfs:range log:Formula.
e:graphDifference a rdf:Property, e:Builtin;
rdfs:comment "built-in used for graph difference e.g. ({:a :b :c. :d :e :f} {:d :e :f}) e:graphDifference {:a :b :c}";
rdfs:domain rdf:List;
rdfs:range log:Formula.
e:graphIntersection a rdf:Property, e:Builtin;
rdfs:comment "built-in used for graph intersection e.g. ({:a :b :c. :d :e :f} {:d :e :f}) e:graphIntersection {:d :e :f}";
rdfs:domain rdf:List;
rdfs:range log:Formula.
e:graphList a rdf:Property, e:Builtin;
rdfs:comment "built-in used for graph/list transformation e.g. {:a :b :c. :d :e :f. :g :h :i} e:graphList ({:a :b :c} {:d :e :f} {:g :h :i})";
rdfs:domain log:Formula;
rdfs:range rdf:List.
e:graphMember a rdf:Property, e:Builtin;
rdfs:comment "built-in to get the triples from the subject graph e.g. {:a :b :c. :d :e :f} e:graphMember {:a :b :c}, {:d :e :f}";
rdfs:domain log:Formula;
rdfs:range log:Formula.
e:graphPair a rdf:Property, e:Builtin;
rdfs:comment "built-in used for graph/pair transformation e.g. {:a :b :c. :d :e :f. :g :h :i} e:graphPair ({:a :b :c} {:d :e :f. :g :h :i})";
rdfs:domain log:Formula;
rdfs:range rdf:List.
e:hmac-sha a rdf:Property, e:Builtin;
rdfs:comment "built-in function where the object is a Modified Base64 for XML identifiers encoded HMAC SHA-1 hash of the subject";
rdfs:domain rdfs:Literal;
rdfs:range rdfs:Literal.
e:ignore a rdf:Property, e:Builtin;
rdfs:comment "built-in to call the object formula within the subject scope and to succeed anyway but only once";
rdfs:domain e:Scope;
rdfs:range log:Formula.
e:label a rdf:Property, e:Builtin;
rdfs:comment "built-in to test wether the subject is a blank node or a Skolem IRI and return the relabeled blank node label or the Skolem IRI fragment as object (this is a level breaker)";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Literal.
e:labelvars a rdf:Property, e:Builtin;
rdfs:comment "built-in to make a bounded copy of the subject";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Resource.
e:length a rdf:Property, e:Builtin;
rdfs:comment "built-in that calculates the length of the subject list";
rdfs:domain rdf:List;
rdfs:range xsd:integer.
e:listType a rdf:Property;
rdfs:comment "to declare that all the elements of a list have a common type";
rdfs:domain rdfs:Class;
rdfs:range rdfs:Class.
e:match a rdf:Property, e:Builtin;
rdfs:comment "built-in to succeed when the object formula succeeds and to forget the bindings";
rdfs:domain rdf:Resource;
rdfs:range log:Formula.
e:max a rdf:Property, e:Builtin;
rdfs:comment "built-in to get the maximum value e.g. (8 5 6 7 9 4) e:max 9";
rdfs:domain e:Numbers;
rdfs:range e:Number.
e:min a rdf:Property, e:Builtin;
rdfs:comment "built-in to get the minimum value e.g. (8 5 6 7 9 4) e:min 4";
rdfs:domain e:Numbers;
rdfs:range e:Number.
e:multisetEqualTo a rdf:Property, e:Builtin;
rdfs:comment "built-in to succeed when the subject multiset is equal to the object multiset e.g. (1 3 6 6 7 2 3) e:multisetEqualTo (3 3 7 6 6 2 1)";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:multisetNotEqualTo a rdf:Property, e:Builtin;
rdfs:comment "built-in to succeed when the subject multiset is not equal to the object multiset e.g. (1 3 6 6 7 2 3) e:multisetEqualTo (3 3 7 6 2 1)";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:notLabel a rdf:Property, e:Builtin;
rdfs:comment "built-in to test wether the subject is not a blank node with label in object (this is a level breaker)";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Literal.
e:numeral a rdf:Property, e:Builtin;
rdfs:comment """built-in to convert literals to numbers e.g. "2012"^^xsd:long e:numeral 2012""";
rdfs:domain rdfs:Literal;
rdfs:range e:Number.
e:optional a rdf:Property, e:Builtin;
rdfs:comment "built-in to call the object formula within the subject scope and to succeed anyway";
rdfs:domain e:Scope;
rdfs:range log:Formula.
e:pcc a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate the Pearson correlation coefficient e.g. ((55 66 72 87 56 77 73 69 74 56) (1.66 1.78 1.87 1.92 1.66 1.89 1.86 1.79 1.80 1.66)) e:pcc 0.9569729506311461";
rdfs:domain e:PairOfNumbers;
rdfs:range e:Number.
e:prefix a rdf:Property, e:Builtin;
rdfs:comment "built-in to produce an object literal containing all prefixes";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Literal.
e:propertyChainExtension a rdf:Property, e:Builtin;
rdfs:comment "built-in to support owl:propertyChainAxiom inferencing i.e. {?p owl:propertyChainAxiom ?x. ?x e:propertyChainExtension (?s ?o)} => {?s ?p ?o}";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:random a rdf:Property, e:Builtin;
rdfs:comment "object is a random integer i such that 0 =< i < first element of subject list; when the rest of subject list rest is not empty i is reproducible in function of the subject list";
rdfs:domain rdf:List;
rdfs:range xsd:integer.
e:relabel a rdf:Property, e:Builtin;
rdfs:comment "relabel subject with object in the output of the reasoning run";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Resource.
e:reverse a rdf:Property, e:Builtin;
rdfs:comment "built-in to reverse the subject list into the object list";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:rms a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate the root mean square e.g. (55 66 72 87 56 77 73 69 74 56) e:rms 69.2105483289939";
rdfs:domain e:Numbers;
rdfs:range e:Number.
e:roc a rdf:Property, e:Builtin;
rdfs:comment "built-in to simulate ROC curve e.g. strength e:roc (sensitivity aspecificity)";
rdfs:domain e:Number;
rdfs:range rdf:List.
e:sha a rdf:Property, e:Builtin;
rdfs:comment "built-in function where the object is a Modified Base64 for XML identifiers encoded SHA-1 hash of the subject";
rdfs:domain rdfs:Literal;
rdfs:range rdfs:Literal.
e:sigmoid a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate a sigmoid e.g. -6 e:sigmoid 0.0024726231566347743";
rdfs:domain rdf:List;
rdfs:range e:Number.
e:skolem a rdf:Property, e:Builtin;
rdfs:comment "built-in to generate a Skolem IRI object which is a function of the arguments in the subject list";
rdfs:domain rdf:List;
rdfs:range rdfs:Resource.
e:sort a rdf:Property, e:Builtin;
rdfs:comment "built-in to sort the subject list and remove duplicates";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:std a rdf:Property, e:Builtin;
rdfs:comment "built-in to calculate the sample standard deviation e.g. (55 66 72 87 56 77 73 69 74 56) e:std 10.426994879744703";
rdfs:domain e:Numbers;
rdfs:range e:Number.
e:stringEscape a rdf:Property, e:Builtin;
rdfs:comment "built-in to escape the subject string";
rdfs:domain rdfs:Literal;
rdfs:range rdfs:Literal.
e:stringReverse a rdf:Property, e:Builtin;
rdfs:comment "built-in to reverse the subject string";
rdfs:domain rdfs:Literal;
rdfs:range rdfs:Literal.
e:stringSplit a rdf:Property, e:Builtin;
rdfs:comment """built-in to split a string into a list of strings according to a string containing separator characters e.g. ("a-b/c-d/e" "-/") e:stringSplit ("a" "b" "c" "d" "e")""";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:subsequence a rdf:Property, e:Builtin;
rdfs:comment "built-in to succeed if all elements of object list appear in subject list in the same order";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:trace a rdf:Property, e:Builtin;
rdfs:comment "built-in that outputs the object";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Resource.
e:transaction a rdf:Property, e:Builtin;
rdfs:comment "used to rewrite P => C. as P => {P e:transaction C}. {P e:transaction C} => C";
rdfs:domain log:Formula;
rdfs:range log:Formula.
e:transpose a rdf:Property, e:Builtin;
rdfs:comment "built-in to transpose the subject matrix e.g. ((0 1) (2 3) (4 5)) e:transpose ((0 2 4) (1 3 5))";
rdfs:domain rdf:List;
rdfs:range rdf:List.
e:tripleList a rdf:Property, e:Builtin;
rdfs:comment "built-in used for triple/list transformation e.g. {:a :b :c} e:tripleList (:a :b :c)";
rdfs:domain log:Formula;
rdfs:range rdf:List.
e:tuple a rdf:Property, e:Builtin;
rdfs:comment "built-in to bind the subject to a unique blank node which is a function of the object tuple";
rdfs:domain rdfs:Resource;
rdfs:range rdf:List.
e:tupleTypes a rdf:Property;
rdfs:comment "to declare the types of all the elements of a tuple";
rdfs:domain rdfs:Class;
rdfs:range e:TupleTypes.
e:unique a rdf:Property, e:Builtin;
rdfs:comment "built-in to succeed when the subject object pair is unique";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Resource.
e:valuation a rdf:Property;
rdfs:comment "to express (lower upper) valuation of a formula e.g. {:PatientWithNoFlu rdfs:subClassOf :PatientWithFever} e:valuation (0.032 0.048)";
rdfs:domain log:Formula;
rdfs:range rdf:List.
e:weight a rdf:Property;
rdfs:comment "used to express the weight in MLN (Markov Logic Network) inspired descriptions";
rdfs:domain rdf:List;
rdfs:range e:Number.
e:whenGround a rdf:Property, e:Builtin;
rdfs:comment "when the subject is RDF ground the object is called, otherwise this built-in succeeds e.g.?value e:whenGround {?value math:greaterThan 40}";
rdfs:domain rdfs:Resource;
rdfs:range rdfs:Resource.
e:wwwFormEncode a rdf:Property, e:Builtin;
rdfs:comment "built-in bidirectional www form encoder";
rdfs:domain rdfs:Literal;
rdfs:range rdfs:Literal.