eyeling 1.5.19 → 1.5.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ # ---------------------------------
2
+ # A tiny expression evaluator in N3
3
+ # ---------------------------------
4
+ #
5
+ # - numbers are nodes with :n
6
+ # - expressions are nodes with :op, :left, :right
7
+ # - :value is defined as a backward “builtin-like” predicate (<=) with recursion
8
+ # - one forward rule emits the final result
9
+
10
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
11
+ @prefix : <http://example.org/expression-eval#>.
12
+
13
+ # -----------------------------
14
+ # Data: (2 * 3) + (10 - 4) = 12
15
+ # -----------------------------
16
+
17
+ :n2 :n 2.
18
+ :n3 :n 3.
19
+ :n10 :n 10.
20
+ :n4 :n 4.
21
+
22
+ :eMul a :Expr; :op :mul; :left :n2; :right :n3.
23
+ :eSub a :Expr; :op :sub; :left :n10; :right :n4.
24
+ :eAdd a :Expr; :op :add; :left :eMul; :right :eSub.
25
+
26
+ :Root :expr :eAdd.
27
+
28
+ # ----------------------
29
+ # Backward rules: :value
30
+ # ----------------------
31
+
32
+ # Base case: numeric node
33
+ { ?N :value ?V. } <= { ?N :n ?V. }.
34
+
35
+ # Addition
36
+ { ?E :value ?V. } <= {
37
+ ?E :op :add.
38
+ ?E :left ?L.
39
+ ?E :right ?R.
40
+ ?L :value ?LV.
41
+ ?R :value ?RV.
42
+ (?LV ?RV) math:sum ?V.
43
+ }.
44
+
45
+ # Subtraction
46
+ { ?E :value ?V. } <= {
47
+ ?E :op :sub.
48
+ ?E :left ?L.
49
+ ?E :right ?R.
50
+ ?L :value ?LV.
51
+ ?R :value ?RV.
52
+ (?LV ?RV) math:difference ?V.
53
+ }.
54
+
55
+ # Multiplication
56
+ { ?E :value ?V. } <= {
57
+ ?E :op :mul.
58
+ ?E :left ?L.
59
+ ?E :right ?R.
60
+ ?L :value ?LV.
61
+ ?R :value ?RV.
62
+ (?LV ?RV) math:product ?V.
63
+ }.
64
+
65
+ # ------------------------------
66
+ # Forward rule: emit final value
67
+ # ------------------------------
68
+
69
+ { :Root :expr ?E. ?E :value ?V. } => { :Root :result ?V. }.
70
+
@@ -0,0 +1,63 @@
1
+ # --------------
2
+ # Family cousins
3
+ # --------------
4
+
5
+ @prefix : <http://example.org/family#>.
6
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
7
+
8
+ # --------------------------
9
+ # Data (a small family tree)
10
+ # --------------------------
11
+
12
+ :Adam :parentOf :Bob, :Carol .
13
+ :Bob :parentOf :Dave, :Eve .
14
+ :Carol :parentOf :Frank, :Grace .
15
+ :Dave :parentOf :Heidi .
16
+ :Eve :parentOf :Ivan .
17
+ :Frank :parentOf :Judy .
18
+
19
+ # Seed "branch" labels at generation 2 (so gen-1 siblings won't become cousins)
20
+ :Dave :branch :b .
21
+ :Eve :branch :b .
22
+ :Frank :branch :c .
23
+ :Grace :branch :c .
24
+
25
+ # Declare branch difference (so we can avoid any inequality built-in)
26
+ :b :differentFrom :c .
27
+ :c :differentFrom :b .
28
+
29
+ # -----------------------------------
30
+ # Rules (generation, branch, cousins)
31
+ # -----------------------------------
32
+
33
+ # Root generation
34
+ { } => { :Adam :generation 0 } .
35
+
36
+ # Generation propagation: child.gen = parent.gen + 1
37
+ {
38
+ ?P :parentOf ?C .
39
+ ?P :generation ?G .
40
+ (?G 1) math:sum ?G1 .
41
+ } => {
42
+ ?C :generation ?G1 .
43
+ } .
44
+
45
+ # Branch propagation: child.branch = parent.branch
46
+ {
47
+ ?P :parentOf ?C .
48
+ ?P :branch ?B .
49
+ } => {
50
+ ?C :branch ?B .
51
+ } .
52
+
53
+ # Cousins: same generation, different branch
54
+ {
55
+ ?X :generation ?G .
56
+ ?Y :generation ?G .
57
+ ?X :branch ?BX .
58
+ ?Y :branch ?BY .
59
+ ?BX :differentFrom ?BY .
60
+ } => {
61
+ ?X :cousin ?Y .
62
+ } .
63
+
@@ -0,0 +1,68 @@
1
+ # ------------------------------
2
+ # Goal driven Parallel Sequences
3
+ # ------------------------------
4
+ #
5
+ # See https://www.sciencedirect.com/science/article/pii/S1532046421000794
6
+ # and https://github.com/hongsun502/wstLogic/tree/master
7
+
8
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
9
+ @prefix list: <http://www.w3.org/2000/10/swap/list#>.
10
+ @prefix gps: <https://eyereasoner.github.io/eye/reasoning/gps/gps-schema#>.
11
+ @prefix : <https://eyereasoner.github.io/eye/reasoning#>.
12
+
13
+ # ---------------------
14
+ # Data (a small sample)
15
+ # ---------------------
16
+
17
+ # current state
18
+ :i1 :location :Gent.
19
+
20
+ # map of Belgium
21
+ (:Gent :Brugge :drive_gent_brugge 1500.0 0.006 0.96 0.99) :edge true .
22
+ (:Gent :Kortrijk :drive_gent_kortrijk 1600.0 0.007 0.96 0.99) :edge true .
23
+ (:Kortrijk :Brugge :drive_kortrijk_brugge 1600.0 0.007 0.96 0.99) :edge true .
24
+ (:Brugge :Oostende :drive_brugge_oostende 900.0 0.004 0.98 1.0) :edge true .
25
+
26
+ # ----------------
27
+ # Path computation
28
+ # ----------------
29
+
30
+ # Base: one edge is a path
31
+ {
32
+ (?From ?To (?Act) ?Dur ?Cost ?Belief ?Comfort) :path true.
33
+ }
34
+ <=
35
+ {
36
+ (?From ?To ?Act ?Dur ?Cost ?Belief ?Comfort) :edge true.
37
+ }.
38
+
39
+ # Recursive: edge + path => path, aggregate weights, concatenate action list
40
+ {
41
+ (?From ?To ?Acts ?Dur ?Cost ?Belief ?Comfort) :path true.
42
+ }
43
+ <=
44
+ {
45
+ (?From ?Mid ?Act ?Dur1 ?Cost1 ?Bel1 ?Comf1) :edge true.
46
+ (?Mid ?To ?RestActs ?Dur2 ?Cost2 ?Bel2 ?Comf2) :path true.
47
+
48
+ ((?Act) ?RestActs) list:append ?Acts.
49
+
50
+ (?Dur1 ?Dur2) math:sum ?Dur.
51
+ (?Cost1 ?Cost2) math:sum ?Cost.
52
+ (?Bel1 ?Bel2) math:product ?Belief.
53
+ (?Comf1 ?Comf2) math:product ?Comfort.
54
+ }.
55
+
56
+ # -------------------------
57
+ # Query: only paths to goal
58
+ # -------------------------
59
+
60
+ {
61
+ :i1 :location ?Start.
62
+ (?Start :Oostende ?Acts ?Dur ?Cost ?Bel ?Comf) :path true.
63
+ }
64
+ =>
65
+ {
66
+ :i1 gps:path (?Acts ?Dur ?Cost ?Bel ?Comf).
67
+ }.
68
+
@@ -0,0 +1,145 @@
1
+ # ----------
2
+ # ODRL trust
3
+ # ----------
4
+
5
+
6
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
7
+ @prefix odrl: <http://www.w3.org/ns/odrl/2/>.
8
+ @prefix dct: <http://purl.org/dc/terms/>.
9
+ @prefix : <http://example.org/odrl-trust#>.
10
+
11
+ # ------------------
12
+ # Trust model (0..1)
13
+ # ------------------
14
+ :Gov :trust 0.95.
15
+ :Partner :trust 0.70.
16
+ :RandomBlog :trust 0.30.
17
+
18
+ # --------------------------
19
+ # A request we want to decide
20
+ # --------------------------
21
+ :req1 a :Request;
22
+ odrl:assignee :Alice;
23
+ odrl:target :Doc1;
24
+ odrl:action odrl:read.
25
+
26
+ # --------------------------
27
+ # ODRL Policies
28
+ # --------------------------
29
+
30
+ # High-trust permission from Gov (trusted enough)
31
+ :PolGov a odrl:Policy;
32
+ dct:creator :Gov;
33
+ odrl:permission :PermGov.
34
+
35
+ :PermGov a odrl:Permission;
36
+ odrl:assignee :Alice;
37
+ odrl:target :Doc1;
38
+ odrl:action odrl:read;
39
+ odrl:constraint :CMinGov.
40
+
41
+ :CMinGov
42
+ odrl:leftOperand :issuerTrust;
43
+ odrl:operator odrl:gteq;
44
+ odrl:rightOperand 0.80.
45
+
46
+ # Medium-trust prohibition from Partner (also applies, but lower trust)
47
+ :PolPartner a odrl:Policy;
48
+ dct:creator :Partner;
49
+ odrl:prohibition :ProhPartner.
50
+
51
+ :ProhPartner a odrl:Prohibition;
52
+ odrl:assignee :Alice;
53
+ odrl:target :Doc1;
54
+ odrl:action odrl:read;
55
+ odrl:constraint :CMinPartner.
56
+
57
+ :CMinPartner
58
+ odrl:leftOperand :issuerTrust;
59
+ odrl:operator odrl:gteq;
60
+ odrl:rightOperand 0.60.
61
+
62
+ # Low-trust prohibition from RandomBlog (does NOT apply due to min trust)
63
+ :PolBlog a odrl:Policy;
64
+ dct:creator :RandomBlog;
65
+ odrl:prohibition :ProhBlog.
66
+
67
+ :ProhBlog a odrl:Prohibition;
68
+ odrl:assignee :Alice;
69
+ odrl:target :Doc1;
70
+ odrl:action odrl:read;
71
+ odrl:constraint :CMinBlog.
72
+
73
+ :CMinBlog
74
+ odrl:leftOperand :issuerTrust;
75
+ odrl:operator odrl:gteq;
76
+ odrl:rightOperand 0.50.
77
+
78
+ # ------------------------------------------------------------
79
+ # Minimal "ODRL + trust" evaluator
80
+ # ------------------------------------------------------------
81
+
82
+ # Candidate PERMIT for a request, scored by issuer trust, only if trust >= minTrust
83
+ {
84
+ (?Req odrl:permit ?Score) :cand true.
85
+ }
86
+ <=
87
+ {
88
+ ?Req odrl:assignee ?A; odrl:target ?T; odrl:action ?Act.
89
+
90
+ ?Pol a odrl:Policy; dct:creator ?Iss; odrl:permission ?Perm.
91
+ ?Perm odrl:assignee ?A; odrl:target ?T; odrl:action ?Act.
92
+
93
+ ?Perm odrl:constraint ?C.
94
+ ?C odrl:leftOperand :issuerTrust;
95
+ odrl:operator odrl:gteq;
96
+ odrl:rightOperand ?Min.
97
+
98
+ ?Iss :trust ?Score.
99
+ (?Score ?Min) math:notLessThan true.
100
+ }.
101
+
102
+ # Candidate PROHIBIT for a request, scored by issuer trust, only if trust >= minTrust
103
+ {
104
+ (?Req odrl:prohibit ?Score) :cand true.
105
+ }
106
+ <=
107
+ {
108
+ ?Req odrl:assignee ?A; odrl:target ?T; odrl:action ?Act.
109
+
110
+ ?Pol a odrl:Policy; dct:creator ?Iss; odrl:prohibition ?Proh.
111
+ ?Proh odrl:assignee ?A; odrl:target ?T; odrl:action ?Act.
112
+
113
+ ?Proh odrl:constraint ?C.
114
+ ?C odrl:leftOperand :issuerTrust;
115
+ odrl:operator odrl:gteq;
116
+ odrl:rightOperand ?Min.
117
+
118
+ ?Iss :trust ?Score.
119
+ (?Score ?Min) math:notLessThan true.
120
+ }.
121
+
122
+ # Decide: permit wins if its score is greater than prohibit score
123
+ {
124
+ (:req1 odrl:permit ?Sp) :cand true.
125
+ (:req1 odrl:prohibit ?Sd) :cand true.
126
+ (?Sp ?Sd) math:greaterThan true.
127
+ }
128
+ =>
129
+ {
130
+ :req1 :decision odrl:permit.
131
+ :req1 :confidence ?Sp.
132
+ }.
133
+
134
+ # Decide: otherwise (tie or prohibit higher), prohibit wins
135
+ {
136
+ (:req1 odrl:permit ?Sp) :cand true.
137
+ (:req1 odrl:prohibit ?Sd) :cand true.
138
+ (?Sd ?Sp) math:notLessThan true.
139
+ }
140
+ =>
141
+ {
142
+ :req1 :decision odrl:prohibit.
143
+ :req1 :confidence ?Sd.
144
+ }.
145
+
@@ -0,0 +1,23 @@
1
+ @prefix : <http://example.org/expression-eval#> .
2
+
3
+ # ----------------------------------------------------------------------
4
+ # Proof for derived triple:
5
+ # :Root :result 12 .
6
+ # It holds because the following instance of the rule body is provable:
7
+ # :Root :expr :eAdd .
8
+ # :eAdd :value 12 .
9
+ # via the schematic forward rule:
10
+ # {
11
+ # :Root :expr ?E .
12
+ # ?E :value ?V .
13
+ # } => {
14
+ # :Root :result ?V .
15
+ # } .
16
+ # with substitution (on rule variables):
17
+ # ?E = :eAdd
18
+ # ?V = 12
19
+ # Therefore the derived triple above is entailed by the rules and facts.
20
+ # ----------------------------------------------------------------------
21
+
22
+ :Root :result 12 .
23
+
@@ -0,0 +1,663 @@
1
+ @prefix : <http://example.org/family#> .
2
+
3
+ # ----------------------------------------------------------------------
4
+ # Proof for derived triple:
5
+ # :Adam :generation 0 .
6
+ # This triple is the head of a forward rule with an empty premise,
7
+ # so it holds unconditionally whenever the program is loaded.
8
+ # Therefore the derived triple above is entailed by the rules and facts.
9
+ # ----------------------------------------------------------------------
10
+
11
+ :Adam :generation 0 .
12
+
13
+ # ----------------------------------------------------------------------
14
+ # Proof for derived triple:
15
+ # :Carol :generation 1 .
16
+ # It holds because the following instance of the rule body is provable:
17
+ # :Adam :parentOf :Carol .
18
+ # :Adam :generation 0 .
19
+ # (0 1) math:sum 1 .
20
+ # via the schematic forward rule:
21
+ # {
22
+ # ?P :parentOf ?C .
23
+ # ?P :generation ?G .
24
+ # (?G 1) math:sum ?G1 .
25
+ # } => {
26
+ # ?C :generation ?G1 .
27
+ # } .
28
+ # with substitution (on rule variables):
29
+ # ?C = :Carol
30
+ # ?G = 0
31
+ # ?G1 = 1
32
+ # ?P = :Adam
33
+ # Therefore the derived triple above is entailed by the rules and facts.
34
+ # ----------------------------------------------------------------------
35
+
36
+ :Carol :generation 1 .
37
+
38
+ # ----------------------------------------------------------------------
39
+ # Proof for derived triple:
40
+ # :Bob :generation 1 .
41
+ # It holds because the following instance of the rule body is provable:
42
+ # :Adam :parentOf :Bob .
43
+ # :Adam :generation 0 .
44
+ # (0 1) math:sum 1 .
45
+ # via the schematic forward rule:
46
+ # {
47
+ # ?P :parentOf ?C .
48
+ # ?P :generation ?G .
49
+ # (?G 1) math:sum ?G1 .
50
+ # } => {
51
+ # ?C :generation ?G1 .
52
+ # } .
53
+ # with substitution (on rule variables):
54
+ # ?C = :Bob
55
+ # ?G = 0
56
+ # ?G1 = 1
57
+ # ?P = :Adam
58
+ # Therefore the derived triple above is entailed by the rules and facts.
59
+ # ----------------------------------------------------------------------
60
+
61
+ :Bob :generation 1 .
62
+
63
+ # ----------------------------------------------------------------------
64
+ # Proof for derived triple:
65
+ # :Judy :branch :c .
66
+ # It holds because the following instance of the rule body is provable:
67
+ # :Frank :parentOf :Judy .
68
+ # :Frank :branch :c .
69
+ # via the schematic forward rule:
70
+ # {
71
+ # ?P :parentOf ?C .
72
+ # ?P :branch ?B .
73
+ # } => {
74
+ # ?C :branch ?B .
75
+ # } .
76
+ # with substitution (on rule variables):
77
+ # ?B = :c
78
+ # ?C = :Judy
79
+ # ?P = :Frank
80
+ # Therefore the derived triple above is entailed by the rules and facts.
81
+ # ----------------------------------------------------------------------
82
+
83
+ :Judy :branch :c .
84
+
85
+ # ----------------------------------------------------------------------
86
+ # Proof for derived triple:
87
+ # :Ivan :branch :b .
88
+ # It holds because the following instance of the rule body is provable:
89
+ # :Eve :parentOf :Ivan .
90
+ # :Eve :branch :b .
91
+ # via the schematic forward rule:
92
+ # {
93
+ # ?P :parentOf ?C .
94
+ # ?P :branch ?B .
95
+ # } => {
96
+ # ?C :branch ?B .
97
+ # } .
98
+ # with substitution (on rule variables):
99
+ # ?B = :b
100
+ # ?C = :Ivan
101
+ # ?P = :Eve
102
+ # Therefore the derived triple above is entailed by the rules and facts.
103
+ # ----------------------------------------------------------------------
104
+
105
+ :Ivan :branch :b .
106
+
107
+ # ----------------------------------------------------------------------
108
+ # Proof for derived triple:
109
+ # :Heidi :branch :b .
110
+ # It holds because the following instance of the rule body is provable:
111
+ # :Dave :parentOf :Heidi .
112
+ # :Dave :branch :b .
113
+ # via the schematic forward rule:
114
+ # {
115
+ # ?P :parentOf ?C .
116
+ # ?P :branch ?B .
117
+ # } => {
118
+ # ?C :branch ?B .
119
+ # } .
120
+ # with substitution (on rule variables):
121
+ # ?B = :b
122
+ # ?C = :Heidi
123
+ # ?P = :Dave
124
+ # Therefore the derived triple above is entailed by the rules and facts.
125
+ # ----------------------------------------------------------------------
126
+
127
+ :Heidi :branch :b .
128
+
129
+ # ----------------------------------------------------------------------
130
+ # Proof for derived triple:
131
+ # :Grace :generation 2 .
132
+ # It holds because the following instance of the rule body is provable:
133
+ # :Carol :parentOf :Grace .
134
+ # :Carol :generation 1 .
135
+ # (1 1) math:sum 2 .
136
+ # via the schematic forward rule:
137
+ # {
138
+ # ?P :parentOf ?C .
139
+ # ?P :generation ?G .
140
+ # (?G 1) math:sum ?G1 .
141
+ # } => {
142
+ # ?C :generation ?G1 .
143
+ # } .
144
+ # with substitution (on rule variables):
145
+ # ?C = :Grace
146
+ # ?G = 1
147
+ # ?G1 = 2
148
+ # ?P = :Carol
149
+ # Therefore the derived triple above is entailed by the rules and facts.
150
+ # ----------------------------------------------------------------------
151
+
152
+ :Grace :generation 2 .
153
+
154
+ # ----------------------------------------------------------------------
155
+ # Proof for derived triple:
156
+ # :Frank :generation 2 .
157
+ # It holds because the following instance of the rule body is provable:
158
+ # :Carol :parentOf :Frank .
159
+ # :Carol :generation 1 .
160
+ # (1 1) math:sum 2 .
161
+ # via the schematic forward rule:
162
+ # {
163
+ # ?P :parentOf ?C .
164
+ # ?P :generation ?G .
165
+ # (?G 1) math:sum ?G1 .
166
+ # } => {
167
+ # ?C :generation ?G1 .
168
+ # } .
169
+ # with substitution (on rule variables):
170
+ # ?C = :Frank
171
+ # ?G = 1
172
+ # ?G1 = 2
173
+ # ?P = :Carol
174
+ # Therefore the derived triple above is entailed by the rules and facts.
175
+ # ----------------------------------------------------------------------
176
+
177
+ :Frank :generation 2 .
178
+
179
+ # ----------------------------------------------------------------------
180
+ # Proof for derived triple:
181
+ # :Eve :generation 2 .
182
+ # It holds because the following instance of the rule body is provable:
183
+ # :Bob :parentOf :Eve .
184
+ # :Bob :generation 1 .
185
+ # (1 1) math:sum 2 .
186
+ # via the schematic forward rule:
187
+ # {
188
+ # ?P :parentOf ?C .
189
+ # ?P :generation ?G .
190
+ # (?G 1) math:sum ?G1 .
191
+ # } => {
192
+ # ?C :generation ?G1 .
193
+ # } .
194
+ # with substitution (on rule variables):
195
+ # ?C = :Eve
196
+ # ?G = 1
197
+ # ?G1 = 2
198
+ # ?P = :Bob
199
+ # Therefore the derived triple above is entailed by the rules and facts.
200
+ # ----------------------------------------------------------------------
201
+
202
+ :Eve :generation 2 .
203
+
204
+ # ----------------------------------------------------------------------
205
+ # Proof for derived triple:
206
+ # :Dave :generation 2 .
207
+ # It holds because the following instance of the rule body is provable:
208
+ # :Bob :parentOf :Dave .
209
+ # :Bob :generation 1 .
210
+ # (1 1) math:sum 2 .
211
+ # via the schematic forward rule:
212
+ # {
213
+ # ?P :parentOf ?C .
214
+ # ?P :generation ?G .
215
+ # (?G 1) math:sum ?G1 .
216
+ # } => {
217
+ # ?C :generation ?G1 .
218
+ # } .
219
+ # with substitution (on rule variables):
220
+ # ?C = :Dave
221
+ # ?G = 1
222
+ # ?G1 = 2
223
+ # ?P = :Bob
224
+ # Therefore the derived triple above is entailed by the rules and facts.
225
+ # ----------------------------------------------------------------------
226
+
227
+ :Dave :generation 2 .
228
+
229
+ # ----------------------------------------------------------------------
230
+ # Proof for derived triple:
231
+ # :Dave :cousin :Frank .
232
+ # It holds because the following instance of the rule body is provable:
233
+ # :Dave :generation 2 .
234
+ # :Frank :generation 2 .
235
+ # :Dave :branch :b .
236
+ # :Frank :branch :c .
237
+ # :b :differentFrom :c .
238
+ # via the schematic forward rule:
239
+ # {
240
+ # ?X :generation ?G .
241
+ # ?Y :generation ?G .
242
+ # ?X :branch ?BX .
243
+ # ?Y :branch ?BY .
244
+ # ?BX :differentFrom ?BY .
245
+ # } => {
246
+ # ?X :cousin ?Y .
247
+ # } .
248
+ # with substitution (on rule variables):
249
+ # ?BX = :b
250
+ # ?BY = :c
251
+ # ?G = 2
252
+ # ?X = :Dave
253
+ # ?Y = :Frank
254
+ # Therefore the derived triple above is entailed by the rules and facts.
255
+ # ----------------------------------------------------------------------
256
+
257
+ :Dave :cousin :Frank .
258
+
259
+ # ----------------------------------------------------------------------
260
+ # Proof for derived triple:
261
+ # :Dave :cousin :Grace .
262
+ # It holds because the following instance of the rule body is provable:
263
+ # :Dave :generation 2 .
264
+ # :Grace :generation 2 .
265
+ # :Dave :branch :b .
266
+ # :Grace :branch :c .
267
+ # :b :differentFrom :c .
268
+ # via the schematic forward rule:
269
+ # {
270
+ # ?X :generation ?G .
271
+ # ?Y :generation ?G .
272
+ # ?X :branch ?BX .
273
+ # ?Y :branch ?BY .
274
+ # ?BX :differentFrom ?BY .
275
+ # } => {
276
+ # ?X :cousin ?Y .
277
+ # } .
278
+ # with substitution (on rule variables):
279
+ # ?BX = :b
280
+ # ?BY = :c
281
+ # ?G = 2
282
+ # ?X = :Dave
283
+ # ?Y = :Grace
284
+ # Therefore the derived triple above is entailed by the rules and facts.
285
+ # ----------------------------------------------------------------------
286
+
287
+ :Dave :cousin :Grace .
288
+
289
+ # ----------------------------------------------------------------------
290
+ # Proof for derived triple:
291
+ # :Eve :cousin :Frank .
292
+ # It holds because the following instance of the rule body is provable:
293
+ # :Eve :generation 2 .
294
+ # :Frank :generation 2 .
295
+ # :Eve :branch :b .
296
+ # :Frank :branch :c .
297
+ # :b :differentFrom :c .
298
+ # via the schematic forward rule:
299
+ # {
300
+ # ?X :generation ?G .
301
+ # ?Y :generation ?G .
302
+ # ?X :branch ?BX .
303
+ # ?Y :branch ?BY .
304
+ # ?BX :differentFrom ?BY .
305
+ # } => {
306
+ # ?X :cousin ?Y .
307
+ # } .
308
+ # with substitution (on rule variables):
309
+ # ?BX = :b
310
+ # ?BY = :c
311
+ # ?G = 2
312
+ # ?X = :Eve
313
+ # ?Y = :Frank
314
+ # Therefore the derived triple above is entailed by the rules and facts.
315
+ # ----------------------------------------------------------------------
316
+
317
+ :Eve :cousin :Frank .
318
+
319
+ # ----------------------------------------------------------------------
320
+ # Proof for derived triple:
321
+ # :Eve :cousin :Grace .
322
+ # It holds because the following instance of the rule body is provable:
323
+ # :Eve :generation 2 .
324
+ # :Grace :generation 2 .
325
+ # :Eve :branch :b .
326
+ # :Grace :branch :c .
327
+ # :b :differentFrom :c .
328
+ # via the schematic forward rule:
329
+ # {
330
+ # ?X :generation ?G .
331
+ # ?Y :generation ?G .
332
+ # ?X :branch ?BX .
333
+ # ?Y :branch ?BY .
334
+ # ?BX :differentFrom ?BY .
335
+ # } => {
336
+ # ?X :cousin ?Y .
337
+ # } .
338
+ # with substitution (on rule variables):
339
+ # ?BX = :b
340
+ # ?BY = :c
341
+ # ?G = 2
342
+ # ?X = :Eve
343
+ # ?Y = :Grace
344
+ # Therefore the derived triple above is entailed by the rules and facts.
345
+ # ----------------------------------------------------------------------
346
+
347
+ :Eve :cousin :Grace .
348
+
349
+ # ----------------------------------------------------------------------
350
+ # Proof for derived triple:
351
+ # :Frank :cousin :Dave .
352
+ # It holds because the following instance of the rule body is provable:
353
+ # :Frank :generation 2 .
354
+ # :Dave :generation 2 .
355
+ # :Frank :branch :c .
356
+ # :Dave :branch :b .
357
+ # :c :differentFrom :b .
358
+ # via the schematic forward rule:
359
+ # {
360
+ # ?X :generation ?G .
361
+ # ?Y :generation ?G .
362
+ # ?X :branch ?BX .
363
+ # ?Y :branch ?BY .
364
+ # ?BX :differentFrom ?BY .
365
+ # } => {
366
+ # ?X :cousin ?Y .
367
+ # } .
368
+ # with substitution (on rule variables):
369
+ # ?BX = :c
370
+ # ?BY = :b
371
+ # ?G = 2
372
+ # ?X = :Frank
373
+ # ?Y = :Dave
374
+ # Therefore the derived triple above is entailed by the rules and facts.
375
+ # ----------------------------------------------------------------------
376
+
377
+ :Frank :cousin :Dave .
378
+
379
+ # ----------------------------------------------------------------------
380
+ # Proof for derived triple:
381
+ # :Frank :cousin :Eve .
382
+ # It holds because the following instance of the rule body is provable:
383
+ # :Frank :generation 2 .
384
+ # :Eve :generation 2 .
385
+ # :Frank :branch :c .
386
+ # :Eve :branch :b .
387
+ # :c :differentFrom :b .
388
+ # via the schematic forward rule:
389
+ # {
390
+ # ?X :generation ?G .
391
+ # ?Y :generation ?G .
392
+ # ?X :branch ?BX .
393
+ # ?Y :branch ?BY .
394
+ # ?BX :differentFrom ?BY .
395
+ # } => {
396
+ # ?X :cousin ?Y .
397
+ # } .
398
+ # with substitution (on rule variables):
399
+ # ?BX = :c
400
+ # ?BY = :b
401
+ # ?G = 2
402
+ # ?X = :Frank
403
+ # ?Y = :Eve
404
+ # Therefore the derived triple above is entailed by the rules and facts.
405
+ # ----------------------------------------------------------------------
406
+
407
+ :Frank :cousin :Eve .
408
+
409
+ # ----------------------------------------------------------------------
410
+ # Proof for derived triple:
411
+ # :Grace :cousin :Dave .
412
+ # It holds because the following instance of the rule body is provable:
413
+ # :Grace :generation 2 .
414
+ # :Dave :generation 2 .
415
+ # :Grace :branch :c .
416
+ # :Dave :branch :b .
417
+ # :c :differentFrom :b .
418
+ # via the schematic forward rule:
419
+ # {
420
+ # ?X :generation ?G .
421
+ # ?Y :generation ?G .
422
+ # ?X :branch ?BX .
423
+ # ?Y :branch ?BY .
424
+ # ?BX :differentFrom ?BY .
425
+ # } => {
426
+ # ?X :cousin ?Y .
427
+ # } .
428
+ # with substitution (on rule variables):
429
+ # ?BX = :c
430
+ # ?BY = :b
431
+ # ?G = 2
432
+ # ?X = :Grace
433
+ # ?Y = :Dave
434
+ # Therefore the derived triple above is entailed by the rules and facts.
435
+ # ----------------------------------------------------------------------
436
+
437
+ :Grace :cousin :Dave .
438
+
439
+ # ----------------------------------------------------------------------
440
+ # Proof for derived triple:
441
+ # :Grace :cousin :Eve .
442
+ # It holds because the following instance of the rule body is provable:
443
+ # :Grace :generation 2 .
444
+ # :Eve :generation 2 .
445
+ # :Grace :branch :c .
446
+ # :Eve :branch :b .
447
+ # :c :differentFrom :b .
448
+ # via the schematic forward rule:
449
+ # {
450
+ # ?X :generation ?G .
451
+ # ?Y :generation ?G .
452
+ # ?X :branch ?BX .
453
+ # ?Y :branch ?BY .
454
+ # ?BX :differentFrom ?BY .
455
+ # } => {
456
+ # ?X :cousin ?Y .
457
+ # } .
458
+ # with substitution (on rule variables):
459
+ # ?BX = :c
460
+ # ?BY = :b
461
+ # ?G = 2
462
+ # ?X = :Grace
463
+ # ?Y = :Eve
464
+ # Therefore the derived triple above is entailed by the rules and facts.
465
+ # ----------------------------------------------------------------------
466
+
467
+ :Grace :cousin :Eve .
468
+
469
+ # ----------------------------------------------------------------------
470
+ # Proof for derived triple:
471
+ # :Judy :generation 3 .
472
+ # It holds because the following instance of the rule body is provable:
473
+ # :Frank :parentOf :Judy .
474
+ # :Frank :generation 2 .
475
+ # (2 1) math:sum 3 .
476
+ # via the schematic forward rule:
477
+ # {
478
+ # ?P :parentOf ?C .
479
+ # ?P :generation ?G .
480
+ # (?G 1) math:sum ?G1 .
481
+ # } => {
482
+ # ?C :generation ?G1 .
483
+ # } .
484
+ # with substitution (on rule variables):
485
+ # ?C = :Judy
486
+ # ?G = 2
487
+ # ?G1 = 3
488
+ # ?P = :Frank
489
+ # Therefore the derived triple above is entailed by the rules and facts.
490
+ # ----------------------------------------------------------------------
491
+
492
+ :Judy :generation 3 .
493
+
494
+ # ----------------------------------------------------------------------
495
+ # Proof for derived triple:
496
+ # :Ivan :generation 3 .
497
+ # It holds because the following instance of the rule body is provable:
498
+ # :Eve :parentOf :Ivan .
499
+ # :Eve :generation 2 .
500
+ # (2 1) math:sum 3 .
501
+ # via the schematic forward rule:
502
+ # {
503
+ # ?P :parentOf ?C .
504
+ # ?P :generation ?G .
505
+ # (?G 1) math:sum ?G1 .
506
+ # } => {
507
+ # ?C :generation ?G1 .
508
+ # } .
509
+ # with substitution (on rule variables):
510
+ # ?C = :Ivan
511
+ # ?G = 2
512
+ # ?G1 = 3
513
+ # ?P = :Eve
514
+ # Therefore the derived triple above is entailed by the rules and facts.
515
+ # ----------------------------------------------------------------------
516
+
517
+ :Ivan :generation 3 .
518
+
519
+ # ----------------------------------------------------------------------
520
+ # Proof for derived triple:
521
+ # :Heidi :generation 3 .
522
+ # It holds because the following instance of the rule body is provable:
523
+ # :Dave :parentOf :Heidi .
524
+ # :Dave :generation 2 .
525
+ # (2 1) math:sum 3 .
526
+ # via the schematic forward rule:
527
+ # {
528
+ # ?P :parentOf ?C .
529
+ # ?P :generation ?G .
530
+ # (?G 1) math:sum ?G1 .
531
+ # } => {
532
+ # ?C :generation ?G1 .
533
+ # } .
534
+ # with substitution (on rule variables):
535
+ # ?C = :Heidi
536
+ # ?G = 2
537
+ # ?G1 = 3
538
+ # ?P = :Dave
539
+ # Therefore the derived triple above is entailed by the rules and facts.
540
+ # ----------------------------------------------------------------------
541
+
542
+ :Heidi :generation 3 .
543
+
544
+ # ----------------------------------------------------------------------
545
+ # Proof for derived triple:
546
+ # :Heidi :cousin :Judy .
547
+ # It holds because the following instance of the rule body is provable:
548
+ # :Heidi :generation 3 .
549
+ # :Judy :generation 3 .
550
+ # :Heidi :branch :b .
551
+ # :Judy :branch :c .
552
+ # :b :differentFrom :c .
553
+ # via the schematic forward rule:
554
+ # {
555
+ # ?X :generation ?G .
556
+ # ?Y :generation ?G .
557
+ # ?X :branch ?BX .
558
+ # ?Y :branch ?BY .
559
+ # ?BX :differentFrom ?BY .
560
+ # } => {
561
+ # ?X :cousin ?Y .
562
+ # } .
563
+ # with substitution (on rule variables):
564
+ # ?BX = :b
565
+ # ?BY = :c
566
+ # ?G = 3
567
+ # ?X = :Heidi
568
+ # ?Y = :Judy
569
+ # Therefore the derived triple above is entailed by the rules and facts.
570
+ # ----------------------------------------------------------------------
571
+
572
+ :Heidi :cousin :Judy .
573
+
574
+ # ----------------------------------------------------------------------
575
+ # Proof for derived triple:
576
+ # :Ivan :cousin :Judy .
577
+ # It holds because the following instance of the rule body is provable:
578
+ # :Ivan :generation 3 .
579
+ # :Judy :generation 3 .
580
+ # :Ivan :branch :b .
581
+ # :Judy :branch :c .
582
+ # :b :differentFrom :c .
583
+ # via the schematic forward rule:
584
+ # {
585
+ # ?X :generation ?G .
586
+ # ?Y :generation ?G .
587
+ # ?X :branch ?BX .
588
+ # ?Y :branch ?BY .
589
+ # ?BX :differentFrom ?BY .
590
+ # } => {
591
+ # ?X :cousin ?Y .
592
+ # } .
593
+ # with substitution (on rule variables):
594
+ # ?BX = :b
595
+ # ?BY = :c
596
+ # ?G = 3
597
+ # ?X = :Ivan
598
+ # ?Y = :Judy
599
+ # Therefore the derived triple above is entailed by the rules and facts.
600
+ # ----------------------------------------------------------------------
601
+
602
+ :Ivan :cousin :Judy .
603
+
604
+ # ----------------------------------------------------------------------
605
+ # Proof for derived triple:
606
+ # :Judy :cousin :Heidi .
607
+ # It holds because the following instance of the rule body is provable:
608
+ # :Judy :generation 3 .
609
+ # :Heidi :generation 3 .
610
+ # :Judy :branch :c .
611
+ # :Heidi :branch :b .
612
+ # :c :differentFrom :b .
613
+ # via the schematic forward rule:
614
+ # {
615
+ # ?X :generation ?G .
616
+ # ?Y :generation ?G .
617
+ # ?X :branch ?BX .
618
+ # ?Y :branch ?BY .
619
+ # ?BX :differentFrom ?BY .
620
+ # } => {
621
+ # ?X :cousin ?Y .
622
+ # } .
623
+ # with substitution (on rule variables):
624
+ # ?BX = :c
625
+ # ?BY = :b
626
+ # ?G = 3
627
+ # ?X = :Judy
628
+ # ?Y = :Heidi
629
+ # Therefore the derived triple above is entailed by the rules and facts.
630
+ # ----------------------------------------------------------------------
631
+
632
+ :Judy :cousin :Heidi .
633
+
634
+ # ----------------------------------------------------------------------
635
+ # Proof for derived triple:
636
+ # :Judy :cousin :Ivan .
637
+ # It holds because the following instance of the rule body is provable:
638
+ # :Judy :generation 3 .
639
+ # :Ivan :generation 3 .
640
+ # :Judy :branch :c .
641
+ # :Ivan :branch :b .
642
+ # :c :differentFrom :b .
643
+ # via the schematic forward rule:
644
+ # {
645
+ # ?X :generation ?G .
646
+ # ?Y :generation ?G .
647
+ # ?X :branch ?BX .
648
+ # ?Y :branch ?BY .
649
+ # ?BX :differentFrom ?BY .
650
+ # } => {
651
+ # ?X :cousin ?Y .
652
+ # } .
653
+ # with substitution (on rule variables):
654
+ # ?BX = :c
655
+ # ?BY = :b
656
+ # ?G = 3
657
+ # ?X = :Judy
658
+ # ?Y = :Ivan
659
+ # Therefore the derived triple above is entailed by the rules and facts.
660
+ # ----------------------------------------------------------------------
661
+
662
+ :Judy :cousin :Ivan .
663
+
@@ -0,0 +1,53 @@
1
+ @prefix : <https://eyereasoner.github.io/eye/reasoning#> .
2
+ @prefix gps: <https://eyereasoner.github.io/eye/reasoning/gps/gps-schema#> .
3
+
4
+ # ----------------------------------------------------------------------
5
+ # Proof for derived triple:
6
+ # :i1 gps:path ((:drive_gent_kortrijk :drive_kortrijk_brugge :drive_brugge_oostende) 4100 0.018 0.903168 0.9801) .
7
+ # It holds because the following instance of the rule body is provable:
8
+ # :i1 :location :Gent .
9
+ # (:Gent :Oostende (:drive_gent_kortrijk :drive_kortrijk_brugge :drive_brugge_oostende) 4100 0.018 0.903168 0.9801) :path true .
10
+ # via the schematic forward rule:
11
+ # {
12
+ # :i1 :location ?Start .
13
+ # (?Start :Oostende ?Acts ?Dur ?Cost ?Bel ?Comf) :path true .
14
+ # } => {
15
+ # :i1 gps:path (?Acts ?Dur ?Cost ?Bel ?Comf) .
16
+ # } .
17
+ # with substitution (on rule variables):
18
+ # ?Acts = (:drive_gent_kortrijk :drive_kortrijk_brugge :drive_brugge_oostende)
19
+ # ?Bel = 0.903168
20
+ # ?Comf = 0.9801
21
+ # ?Cost = 0.018
22
+ # ?Dur = 4100
23
+ # ?Start = :Gent
24
+ # Therefore the derived triple above is entailed by the rules and facts.
25
+ # ----------------------------------------------------------------------
26
+
27
+ :i1 gps:path ((:drive_gent_kortrijk :drive_kortrijk_brugge :drive_brugge_oostende) 4100 0.018 0.903168 0.9801) .
28
+
29
+ # ----------------------------------------------------------------------
30
+ # Proof for derived triple:
31
+ # :i1 gps:path ((:drive_gent_brugge :drive_brugge_oostende) 2400 0.01 0.9408 0.99) .
32
+ # It holds because the following instance of the rule body is provable:
33
+ # :i1 :location :Gent .
34
+ # (:Gent :Oostende (:drive_gent_brugge :drive_brugge_oostende) 2400 0.01 0.9408 0.99) :path true .
35
+ # via the schematic forward rule:
36
+ # {
37
+ # :i1 :location ?Start .
38
+ # (?Start :Oostende ?Acts ?Dur ?Cost ?Bel ?Comf) :path true .
39
+ # } => {
40
+ # :i1 gps:path (?Acts ?Dur ?Cost ?Bel ?Comf) .
41
+ # } .
42
+ # with substitution (on rule variables):
43
+ # ?Acts = (:drive_gent_brugge :drive_brugge_oostende)
44
+ # ?Bel = 0.9408
45
+ # ?Comf = 0.99
46
+ # ?Cost = 0.01
47
+ # ?Dur = 2400
48
+ # ?Start = :Gent
49
+ # Therefore the derived triple above is entailed by the rules and facts.
50
+ # ----------------------------------------------------------------------
51
+
52
+ :i1 gps:path ((:drive_gent_brugge :drive_brugge_oostende) 2400 0.01 0.9408 0.99) .
53
+
@@ -0,0 +1,51 @@
1
+ @prefix : <http://example.org/odrl-trust#> .
2
+ @prefix odrl: <http://www.w3.org/ns/odrl/2/> .
3
+
4
+ # ----------------------------------------------------------------------
5
+ # Proof for derived triple:
6
+ # :req1 :decision odrl:permit .
7
+ # It holds because the following instance of the rule body is provable:
8
+ # (:req1 odrl:permit 0.95) :cand true .
9
+ # (:req1 odrl:prohibit 0.70) :cand true .
10
+ # (0.95 0.70) math:greaterThan true .
11
+ # via the schematic forward rule:
12
+ # {
13
+ # (:req1 odrl:permit ?Sp) :cand true .
14
+ # (:req1 odrl:prohibit ?Sd) :cand true .
15
+ # (?Sp ?Sd) math:greaterThan true .
16
+ # } => {
17
+ # :req1 :decision odrl:permit .
18
+ # :req1 :confidence ?Sp .
19
+ # } .
20
+ # with substitution (on rule variables):
21
+ # ?Sd = 0.70
22
+ # ?Sp = 0.95
23
+ # Therefore the derived triple above is entailed by the rules and facts.
24
+ # ----------------------------------------------------------------------
25
+
26
+ :req1 :decision odrl:permit .
27
+
28
+ # ----------------------------------------------------------------------
29
+ # Proof for derived triple:
30
+ # :req1 :confidence 0.95 .
31
+ # It holds because the following instance of the rule body is provable:
32
+ # (:req1 odrl:permit 0.95) :cand true .
33
+ # (:req1 odrl:prohibit 0.70) :cand true .
34
+ # (0.95 0.70) math:greaterThan true .
35
+ # via the schematic forward rule:
36
+ # {
37
+ # (:req1 odrl:permit ?Sp) :cand true .
38
+ # (:req1 odrl:prohibit ?Sd) :cand true .
39
+ # (?Sp ?Sd) math:greaterThan true .
40
+ # } => {
41
+ # :req1 :decision odrl:permit .
42
+ # :req1 :confidence ?Sp .
43
+ # } .
44
+ # with substitution (on rule variables):
45
+ # ?Sd = 0.70
46
+ # ?Sp = 0.95
47
+ # Therefore the derived triple above is entailed by the rules and facts.
48
+ # ----------------------------------------------------------------------
49
+
50
+ :req1 :confidence 0.95 .
51
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.5.19",
3
+ "version": "1.5.20",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [