eyeling 1.26.5 → 1.26.7
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.
- package/HANDBOOK.md +69 -3
- package/dist/browser/eyeling.browser.js +5 -5
- package/examples/deck/rdf-message-window-repair.md +175 -0
- package/examples/input/rdf-message-window-repair.trig +79 -0
- package/examples/output/rdf-message-window-repair.md +13 -0
- package/examples/proof/derived-backward-rule-2.n3 +80 -0
- package/examples/proof/derived-backward-rule.n3 +53 -0
- package/examples/proof/derived-rule.n3 +43 -0
- package/examples/proof/dog.n3 +41 -0
- package/examples/proof/equals.n3 +14 -0
- package/examples/proof/list-iterate.n3 +142 -0
- package/examples/proof/list-map.n3 +44 -0
- package/examples/proof/log-conclusion.n3 +118 -0
- package/examples/proof/log-for-all-in.n3 +33 -0
- package/examples/proof/log-not-includes.n3 +55 -0
- package/examples/proof/log-uri.n3 +34 -0
- package/examples/proof/rule-matching.n3 +34 -0
- package/examples/rdf-message-window-repair.n3 +163 -0
- package/eyeling.js +5 -5
- package/lib/engine.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
@prefix : <urn:example:> .
|
|
2
|
+
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
|
|
3
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
4
|
+
|
|
5
|
+
("Huey" "Dewey" "Louie") :iterate (0 "Huey") .
|
|
6
|
+
"Dewey" :hasIndex 1 .
|
|
7
|
+
("Huey" "Dewey" "Louie") :iterate (1 "Dewey") .
|
|
8
|
+
("Huey" "Dewey" "Louie") :iterate (2 "Louie") .
|
|
9
|
+
:test :is true .
|
|
10
|
+
|
|
11
|
+
{ ("Huey" "Dewey" "Louie") :iterate (0 "Huey") . } pe:why {
|
|
12
|
+
{ ("Huey" "Dewey" "Louie") :iterate (0 "Huey") . }
|
|
13
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 11 ];
|
|
14
|
+
pe:binding
|
|
15
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
16
|
+
[ pe:var "Y"; pe:value (0 "Huey") ],
|
|
17
|
+
[ pe:var "Z"; pe:value 1 ];
|
|
18
|
+
pe:uses
|
|
19
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . },
|
|
20
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . },
|
|
21
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
22
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }.
|
|
23
|
+
|
|
24
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . }
|
|
25
|
+
pe:by [ pe:fact "list-iterate.n3"; pe:line 9 ].
|
|
26
|
+
|
|
27
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . }
|
|
28
|
+
pe:by [ pe:builtin list:iterate ].
|
|
29
|
+
|
|
30
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }
|
|
31
|
+
pe:by [ pe:builtin list:iterate ].
|
|
32
|
+
}.
|
|
33
|
+
|
|
34
|
+
{ "Dewey" :hasIndex 1 . } pe:why {
|
|
35
|
+
{ "Dewey" :hasIndex 1 . }
|
|
36
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 11 ];
|
|
37
|
+
pe:binding
|
|
38
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
39
|
+
[ pe:var "Y"; pe:value (0 "Huey") ],
|
|
40
|
+
[ pe:var "Z"; pe:value 1 ];
|
|
41
|
+
pe:uses
|
|
42
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . },
|
|
43
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . },
|
|
44
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
45
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }.
|
|
46
|
+
|
|
47
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . }
|
|
48
|
+
pe:by [ pe:fact "list-iterate.n3"; pe:line 9 ].
|
|
49
|
+
|
|
50
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . }
|
|
51
|
+
pe:by [ pe:builtin list:iterate ].
|
|
52
|
+
|
|
53
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }
|
|
54
|
+
pe:by [ pe:builtin list:iterate ].
|
|
55
|
+
}.
|
|
56
|
+
|
|
57
|
+
{ ("Huey" "Dewey" "Louie") :iterate (1 "Dewey") . } pe:why {
|
|
58
|
+
{ ("Huey" "Dewey" "Louie") :iterate (1 "Dewey") . }
|
|
59
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 11 ];
|
|
60
|
+
pe:binding
|
|
61
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
62
|
+
[ pe:var "Y"; pe:value (1 "Dewey") ],
|
|
63
|
+
[ pe:var "Z"; pe:value 1 ];
|
|
64
|
+
pe:uses
|
|
65
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . },
|
|
66
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
67
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
68
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }.
|
|
69
|
+
|
|
70
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . }
|
|
71
|
+
pe:by [ pe:fact "list-iterate.n3"; pe:line 9 ].
|
|
72
|
+
|
|
73
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }
|
|
74
|
+
pe:by [ pe:builtin list:iterate ].
|
|
75
|
+
}.
|
|
76
|
+
|
|
77
|
+
{ ("Huey" "Dewey" "Louie") :iterate (2 "Louie") . } pe:why {
|
|
78
|
+
{ ("Huey" "Dewey" "Louie") :iterate (2 "Louie") . }
|
|
79
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 11 ];
|
|
80
|
+
pe:binding
|
|
81
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
82
|
+
[ pe:var "Y"; pe:value (2 "Louie") ],
|
|
83
|
+
[ pe:var "Z"; pe:value 1 ];
|
|
84
|
+
pe:uses
|
|
85
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . },
|
|
86
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (2 "Louie") . },
|
|
87
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
88
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }.
|
|
89
|
+
|
|
90
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . }
|
|
91
|
+
pe:by [ pe:fact "list-iterate.n3"; pe:line 9 ].
|
|
92
|
+
|
|
93
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (2 "Louie") . }
|
|
94
|
+
pe:by [ pe:builtin list:iterate ].
|
|
95
|
+
|
|
96
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }
|
|
97
|
+
pe:by [ pe:builtin list:iterate ].
|
|
98
|
+
}.
|
|
99
|
+
|
|
100
|
+
{ :test :is true . } pe:why {
|
|
101
|
+
{ :test :is true . }
|
|
102
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 31 ];
|
|
103
|
+
pe:binding
|
|
104
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
105
|
+
[ pe:var "Y"; pe:value (0 "Huey") ];
|
|
106
|
+
pe:uses
|
|
107
|
+
{ ("Huey" "Dewey" "Louie") :iterate (0 "Huey") . },
|
|
108
|
+
{ "Dewey" :hasIndex 1 . }.
|
|
109
|
+
|
|
110
|
+
{ ("Huey" "Dewey" "Louie") :iterate (0 "Huey") . }
|
|
111
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 11 ];
|
|
112
|
+
pe:binding
|
|
113
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
114
|
+
[ pe:var "Y"; pe:value (0 "Huey") ],
|
|
115
|
+
[ pe:var "Z"; pe:value 1 ];
|
|
116
|
+
pe:uses
|
|
117
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . },
|
|
118
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . },
|
|
119
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
120
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }.
|
|
121
|
+
|
|
122
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . }
|
|
123
|
+
pe:by [ pe:fact "list-iterate.n3"; pe:line 9 ].
|
|
124
|
+
|
|
125
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . }
|
|
126
|
+
pe:by [ pe:builtin list:iterate ].
|
|
127
|
+
|
|
128
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }
|
|
129
|
+
pe:by [ pe:builtin list:iterate ].
|
|
130
|
+
|
|
131
|
+
{ "Dewey" :hasIndex 1 . }
|
|
132
|
+
pe:by [ pe:rule "list-iterate.n3"; pe:line 11 ];
|
|
133
|
+
pe:binding
|
|
134
|
+
[ pe:var "X"; pe:value ("Huey" "Dewey" "Louie") ],
|
|
135
|
+
[ pe:var "Y"; pe:value (0 "Huey") ],
|
|
136
|
+
[ pe:var "Z"; pe:value 1 ];
|
|
137
|
+
pe:uses
|
|
138
|
+
{ :Let :param ("Huey" "Dewey" "Louie") . },
|
|
139
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (0 "Huey") . },
|
|
140
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . },
|
|
141
|
+
{ ("Huey" "Dewey" "Louie") list:iterate (1 "Dewey") . }.
|
|
142
|
+
}.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@prefix : <http://example.org/#> .
|
|
2
|
+
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
|
|
3
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
4
|
+
|
|
5
|
+
:test1 :is true .
|
|
6
|
+
:test2 :is true .
|
|
7
|
+
:test3 :is true .
|
|
8
|
+
:test4 :is true .
|
|
9
|
+
|
|
10
|
+
{ :test1 :is true . } pe:why {
|
|
11
|
+
{ :test1 :is true . }
|
|
12
|
+
pe:by [ pe:rule "list-map.n3"; pe:line 14 ];
|
|
13
|
+
pe:uses { ((:s1 :s2) :p1) list:map (:o1 :o2) . }.
|
|
14
|
+
|
|
15
|
+
{ ((:s1 :s2) :p1) list:map (:o1 :o2) . }
|
|
16
|
+
pe:by [ pe:builtin list:map ].
|
|
17
|
+
}.
|
|
18
|
+
|
|
19
|
+
{ :test2 :is true . } pe:why {
|
|
20
|
+
{ :test2 :is true . }
|
|
21
|
+
pe:by [ pe:rule "list-map.n3"; pe:line 15 ];
|
|
22
|
+
pe:uses { ((:s1 :s2 :s3) :p1) list:map (:o1 :o2 :o3 :o4) . }.
|
|
23
|
+
|
|
24
|
+
{ ((:s1 :s2 :s3) :p1) list:map (:o1 :o2 :o3 :o4) . }
|
|
25
|
+
pe:by [ pe:builtin list:map ].
|
|
26
|
+
}.
|
|
27
|
+
|
|
28
|
+
{ :test3 :is true . } pe:why {
|
|
29
|
+
{ :test3 :is true . }
|
|
30
|
+
pe:by [ pe:rule "list-map.n3"; pe:line 16 ];
|
|
31
|
+
pe:uses { ((:s4) :p1) list:map () . }.
|
|
32
|
+
|
|
33
|
+
{ ((:s4) :p1) list:map () . }
|
|
34
|
+
pe:by [ pe:builtin list:map ].
|
|
35
|
+
}.
|
|
36
|
+
|
|
37
|
+
{ :test4 :is true . } pe:why {
|
|
38
|
+
{ :test4 :is true . }
|
|
39
|
+
pe:by [ pe:rule "list-map.n3"; pe:line 17 ];
|
|
40
|
+
pe:uses { ((:s1) :p2) list:map () . }.
|
|
41
|
+
|
|
42
|
+
{ ((:s1) :p2) list:map () . }
|
|
43
|
+
pe:by [ pe:builtin list:map ].
|
|
44
|
+
}.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
@prefix : <http://example.org/> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
4
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
5
|
+
|
|
6
|
+
:result :is {
|
|
7
|
+
:Felix a :Cat .
|
|
8
|
+
{
|
|
9
|
+
?X a :Cat .
|
|
10
|
+
} => {
|
|
11
|
+
?X :says "Meow" .
|
|
12
|
+
} .
|
|
13
|
+
:Felix :says "Meow" .
|
|
14
|
+
} .
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
:result :is {
|
|
18
|
+
:Felix a :Cat .
|
|
19
|
+
{
|
|
20
|
+
?X a :Cat .
|
|
21
|
+
} => {
|
|
22
|
+
?X :says "Meow" .
|
|
23
|
+
} .
|
|
24
|
+
:Felix :says "Meow" .
|
|
25
|
+
} .
|
|
26
|
+
} pe:why {
|
|
27
|
+
{
|
|
28
|
+
:result :is {
|
|
29
|
+
:Felix a :Cat .
|
|
30
|
+
{
|
|
31
|
+
?X a :Cat .
|
|
32
|
+
} => {
|
|
33
|
+
?X :says "Meow" .
|
|
34
|
+
} .
|
|
35
|
+
:Felix :says "Meow" .
|
|
36
|
+
} .
|
|
37
|
+
}
|
|
38
|
+
pe:by [ pe:rule "log-conclusion.n3"; pe:line 13 ];
|
|
39
|
+
pe:binding
|
|
40
|
+
[ pe:var "conclusion"; pe:value {
|
|
41
|
+
:Felix a :Cat .
|
|
42
|
+
{
|
|
43
|
+
?X a :Cat .
|
|
44
|
+
} => {
|
|
45
|
+
?X :says "Meow" .
|
|
46
|
+
} .
|
|
47
|
+
:Felix :says "Meow" .
|
|
48
|
+
} ],
|
|
49
|
+
[ pe:var "param"; pe:value {
|
|
50
|
+
:Felix a :Cat .
|
|
51
|
+
{
|
|
52
|
+
?X a :Cat .
|
|
53
|
+
} => {
|
|
54
|
+
?X :says "Meow" .
|
|
55
|
+
} .
|
|
56
|
+
} ];
|
|
57
|
+
pe:uses
|
|
58
|
+
{
|
|
59
|
+
:let :param {
|
|
60
|
+
:Felix a :Cat .
|
|
61
|
+
{
|
|
62
|
+
?X a :Cat .
|
|
63
|
+
} => {
|
|
64
|
+
?X :says "Meow" .
|
|
65
|
+
} .
|
|
66
|
+
} .
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
{
|
|
70
|
+
:Felix a :Cat .
|
|
71
|
+
{
|
|
72
|
+
?X a :Cat .
|
|
73
|
+
} => {
|
|
74
|
+
?X :says "Meow" .
|
|
75
|
+
} .
|
|
76
|
+
} log:conclusion {
|
|
77
|
+
:Felix a :Cat .
|
|
78
|
+
{
|
|
79
|
+
?X a :Cat .
|
|
80
|
+
} => {
|
|
81
|
+
?X :says "Meow" .
|
|
82
|
+
} .
|
|
83
|
+
:Felix :says "Meow" .
|
|
84
|
+
} .
|
|
85
|
+
}.
|
|
86
|
+
|
|
87
|
+
{
|
|
88
|
+
:let :param {
|
|
89
|
+
:Felix a :Cat .
|
|
90
|
+
{
|
|
91
|
+
?X a :Cat .
|
|
92
|
+
} => {
|
|
93
|
+
?X :says "Meow" .
|
|
94
|
+
} .
|
|
95
|
+
} .
|
|
96
|
+
}
|
|
97
|
+
pe:by [ pe:fact "log-conclusion.n3"; pe:line 8 ].
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
{
|
|
101
|
+
:Felix a :Cat .
|
|
102
|
+
{
|
|
103
|
+
?X a :Cat .
|
|
104
|
+
} => {
|
|
105
|
+
?X :says "Meow" .
|
|
106
|
+
} .
|
|
107
|
+
} log:conclusion {
|
|
108
|
+
:Felix a :Cat .
|
|
109
|
+
{
|
|
110
|
+
?X a :Cat .
|
|
111
|
+
} => {
|
|
112
|
+
?X :says "Meow" .
|
|
113
|
+
} .
|
|
114
|
+
:Felix :says "Meow" .
|
|
115
|
+
} .
|
|
116
|
+
}
|
|
117
|
+
pe:by [ pe:builtin log:conclusion ].
|
|
118
|
+
}.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@prefix : <http://example.org/#> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
4
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
5
|
+
|
|
6
|
+
:result :is true .
|
|
7
|
+
|
|
8
|
+
{ :result :is true . } pe:why {
|
|
9
|
+
{ :result :is true . }
|
|
10
|
+
pe:by [ pe:rule "log-for-all-in.n3"; pe:line 14 ];
|
|
11
|
+
pe:binding [ pe:var "c"; pe:value :c ];
|
|
12
|
+
pe:uses
|
|
13
|
+
{ :c a :CompositeTask . },
|
|
14
|
+
{
|
|
15
|
+
({
|
|
16
|
+
:c :subTask ?s .
|
|
17
|
+
} {
|
|
18
|
+
?s :state :Completed .
|
|
19
|
+
}) log:forAllIn ?_b1 .
|
|
20
|
+
}.
|
|
21
|
+
|
|
22
|
+
{ :c a :CompositeTask . }
|
|
23
|
+
pe:by [ pe:fact "log-for-all-in.n3"; pe:line 8 ].
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
({
|
|
27
|
+
:c :subTask ?s .
|
|
28
|
+
} {
|
|
29
|
+
?s :state :Completed .
|
|
30
|
+
}) log:forAllIn ?_b1 .
|
|
31
|
+
}
|
|
32
|
+
pe:by [ pe:builtin log:forAllIn ].
|
|
33
|
+
}.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@prefix : <http://example.org/#> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
|
|
4
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
5
|
+
|
|
6
|
+
:x :y 1 .
|
|
7
|
+
{
|
|
8
|
+
:x :y 1 .
|
|
9
|
+
} => {
|
|
10
|
+
:a :b :c .
|
|
11
|
+
} .
|
|
12
|
+
:a :b :c .
|
|
13
|
+
|
|
14
|
+
{ :x :y 1 . } pe:why {
|
|
15
|
+
{ :x :y 1 . }
|
|
16
|
+
pe:by [ pe:rule "log-not-includes.n3"; pe:line 10 ];
|
|
17
|
+
pe:uses { 1 math:equalTo 1 . }.
|
|
18
|
+
|
|
19
|
+
{ 1 math:equalTo 1 . }
|
|
20
|
+
pe:by [ pe:builtin math:equalTo ].
|
|
21
|
+
}.
|
|
22
|
+
|
|
23
|
+
{
|
|
24
|
+
{
|
|
25
|
+
:x :y 1 .
|
|
26
|
+
} => {
|
|
27
|
+
:a :b :c .
|
|
28
|
+
} .
|
|
29
|
+
} pe:why {
|
|
30
|
+
{
|
|
31
|
+
{
|
|
32
|
+
:x :y 1 .
|
|
33
|
+
} => {
|
|
34
|
+
:a :b :c .
|
|
35
|
+
} .
|
|
36
|
+
}
|
|
37
|
+
pe:by [ pe:rule "log-not-includes.n3"; pe:line 10 ];
|
|
38
|
+
pe:uses { 1 math:equalTo 1 . }.
|
|
39
|
+
|
|
40
|
+
{ 1 math:equalTo 1 . }
|
|
41
|
+
pe:by [ pe:builtin math:equalTo ].
|
|
42
|
+
}.
|
|
43
|
+
|
|
44
|
+
{ :a :b :c . } pe:why {
|
|
45
|
+
{ :a :b :c . }
|
|
46
|
+
pe:by [ pe:rule "log-not-includes.n3"; pe:line 10 ];
|
|
47
|
+
pe:uses { :x :y 1 . }.
|
|
48
|
+
|
|
49
|
+
{ :x :y 1 . }
|
|
50
|
+
pe:by [ pe:rule "log-not-includes.n3"; pe:line 10 ];
|
|
51
|
+
pe:uses { 1 math:equalTo 1 . }.
|
|
52
|
+
|
|
53
|
+
{ 1 math:equalTo 1 . }
|
|
54
|
+
pe:by [ pe:builtin math:equalTo ].
|
|
55
|
+
}.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@prefix : <http://example.org/#> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
4
|
+
|
|
5
|
+
:uriString :is "https://www.w3.org" .
|
|
6
|
+
:uriResource :is <https://www.w3.org> .
|
|
7
|
+
|
|
8
|
+
{ :uriString :is "https://www.w3.org" . } pe:why {
|
|
9
|
+
{ :uriString :is "https://www.w3.org" . }
|
|
10
|
+
pe:by [ pe:rule "log-uri.n3"; pe:line 8 ];
|
|
11
|
+
pe:binding
|
|
12
|
+
[ pe:var "r"; pe:value <https://www.w3.org> ],
|
|
13
|
+
[ pe:var "s"; pe:value "https://www.w3.org" ];
|
|
14
|
+
pe:uses
|
|
15
|
+
{ <https://www.w3.org> log:uri "https://www.w3.org" . },
|
|
16
|
+
{ <https://www.w3.org> log:uri "https://www.w3.org" . }.
|
|
17
|
+
|
|
18
|
+
{ <https://www.w3.org> log:uri "https://www.w3.org" . }
|
|
19
|
+
pe:by [ pe:builtin log:uri ].
|
|
20
|
+
}.
|
|
21
|
+
|
|
22
|
+
{ :uriResource :is <https://www.w3.org> . } pe:why {
|
|
23
|
+
{ :uriResource :is <https://www.w3.org> . }
|
|
24
|
+
pe:by [ pe:rule "log-uri.n3"; pe:line 8 ];
|
|
25
|
+
pe:binding
|
|
26
|
+
[ pe:var "r"; pe:value <https://www.w3.org> ],
|
|
27
|
+
[ pe:var "s"; pe:value "https://www.w3.org" ];
|
|
28
|
+
pe:uses
|
|
29
|
+
{ <https://www.w3.org> log:uri "https://www.w3.org" . },
|
|
30
|
+
{ <https://www.w3.org> log:uri "https://www.w3.org" . }.
|
|
31
|
+
|
|
32
|
+
{ <https://www.w3.org> log:uri "https://www.w3.org" . }
|
|
33
|
+
pe:by [ pe:builtin log:uri ].
|
|
34
|
+
}.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@prefix : <https://eyereasoner.github.io/ns#> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
@prefix pe: <https://eyereasoner.github.io/pe#> .
|
|
4
|
+
|
|
5
|
+
:result :is true .
|
|
6
|
+
|
|
7
|
+
{ :result :is true . } pe:why {
|
|
8
|
+
{ :result :is true . }
|
|
9
|
+
pe:by [ pe:rule "rule-matching.n3"; pe:line 8 ];
|
|
10
|
+
pe:binding
|
|
11
|
+
[ pe:var "A"; pe:value {
|
|
12
|
+
?A__0 => ?B__1 .
|
|
13
|
+
} ],
|
|
14
|
+
[ pe:var "B"; pe:value {
|
|
15
|
+
:result :is true .
|
|
16
|
+
} ];
|
|
17
|
+
pe:uses
|
|
18
|
+
{
|
|
19
|
+
{
|
|
20
|
+
?A__0 => ?B__1 .
|
|
21
|
+
} => {
|
|
22
|
+
:result :is true .
|
|
23
|
+
} .
|
|
24
|
+
}.
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
{
|
|
28
|
+
?A__0 => ?B__1 .
|
|
29
|
+
} => {
|
|
30
|
+
:result :is true .
|
|
31
|
+
} .
|
|
32
|
+
}
|
|
33
|
+
pe:by [ pe:builtin log:implies ].
|
|
34
|
+
}.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# =========================
|
|
2
|
+
# RDF Message Window Repair
|
|
3
|
+
# =========================
|
|
4
|
+
#
|
|
5
|
+
# Run as:
|
|
6
|
+
#
|
|
7
|
+
# eyeling -r examples/rdf-message-window-repair.n3 examples/input/rdf-message-window-repair.trig
|
|
8
|
+
#
|
|
9
|
+
# This example is inspired by incremental, inconsistency-resilient reasoning over
|
|
10
|
+
# sliding ABox streams. The input is a true RDF Message Log: each MESSAGE
|
|
11
|
+
# boundary is parsed by Eyeling into an eymsg: envelope with one payload graph per
|
|
12
|
+
# non-empty message.
|
|
13
|
+
#
|
|
14
|
+
# The rules below keep the message boundaries visible, select two overlapping
|
|
15
|
+
# three-message windows, detect that the current window says the same fire door
|
|
16
|
+
# is both open and closed, and repair the inconsistency by keeping the
|
|
17
|
+
# higher-priority safety-controller assertion for the final materialization.
|
|
18
|
+
|
|
19
|
+
@prefix : <https://eyereasoner.github.io/eyeling/examples/rdf-message-window-repair#>.
|
|
20
|
+
@prefix eymsg: <https://eyereasoner.github.io/eyeling/vocab/message#>.
|
|
21
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
22
|
+
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
|
|
23
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
24
|
+
@prefix string: <http://www.w3.org/2000/10/swap/string#>.
|
|
25
|
+
|
|
26
|
+
# Eyeling's parser-level replay gives a static view of the message log: an
|
|
27
|
+
# ordered list, explicit offsets, and next-envelope links.
|
|
28
|
+
{
|
|
29
|
+
?Stream a eymsg:RDFMessageStream;
|
|
30
|
+
eymsg:envelope ?Message.
|
|
31
|
+
?Message a eymsg:MessageEnvelope;
|
|
32
|
+
eymsg:offset ?Offset.
|
|
33
|
+
} => {
|
|
34
|
+
?Message :boundaryExplicit true.
|
|
35
|
+
?Message :offset ?Offset.
|
|
36
|
+
}.
|
|
37
|
+
|
|
38
|
+
# The first payload carries stream policy, like a fixed TBox/configuration that
|
|
39
|
+
# is not itself part of the changing ABox window.
|
|
40
|
+
{
|
|
41
|
+
?Message eymsg:payloadGraph ?Payload.
|
|
42
|
+
?Payload log:nameOf ?PayloadContext.
|
|
43
|
+
?PayloadContext log:includes {
|
|
44
|
+
:doorA :windowSize ?WindowSize;
|
|
45
|
+
:repairPolicy :preferHigherPriority.
|
|
46
|
+
:open :actionText ?OpenAction;
|
|
47
|
+
:stateText ?OpenStateText.
|
|
48
|
+
:closed :actionText ?ClosedAction;
|
|
49
|
+
:stateText ?ClosedStateText.
|
|
50
|
+
}.
|
|
51
|
+
} => {
|
|
52
|
+
:doorA :windowSize ?WindowSize;
|
|
53
|
+
:repairPolicy :preferHigherPriority.
|
|
54
|
+
:open :actionText ?OpenAction;
|
|
55
|
+
:stateText ?OpenStateText.
|
|
56
|
+
:closed :actionText ?ClosedAction;
|
|
57
|
+
:stateText ?ClosedStateText.
|
|
58
|
+
}.
|
|
59
|
+
|
|
60
|
+
# With five messages, message 1 is configuration and messages 2-5 are ABox
|
|
61
|
+
# assertions. The previous and current sliding windows overlap on messages 3
|
|
62
|
+
# and 4; message 2 expires and message 5 enters.
|
|
63
|
+
{
|
|
64
|
+
?Stream a eymsg:RDFMessageStream;
|
|
65
|
+
eymsg:firstEnvelope ?M1.
|
|
66
|
+
?M1 eymsg:nextEnvelope ?M2.
|
|
67
|
+
?M2 eymsg:nextEnvelope ?M3.
|
|
68
|
+
?M3 eymsg:nextEnvelope ?M4.
|
|
69
|
+
?M4 eymsg:nextEnvelope ?M5.
|
|
70
|
+
} => {
|
|
71
|
+
:previousWindow :contains ?M2, ?M3, ?M4.
|
|
72
|
+
:currentWindow :contains ?M3, ?M4, ?M5.
|
|
73
|
+
:windowSlide :expired ?M2;
|
|
74
|
+
:retained ?M3, ?M4;
|
|
75
|
+
:entered ?M5.
|
|
76
|
+
}.
|
|
77
|
+
|
|
78
|
+
# Inspect each message payload inside its own replayed RDF Message graph, then
|
|
79
|
+
# lift only the ABox assertion metadata needed for window reasoning.
|
|
80
|
+
{
|
|
81
|
+
?Window :contains ?Message.
|
|
82
|
+
?Message eymsg:payloadGraph ?Payload.
|
|
83
|
+
?Payload log:nameOf ?PayloadContext.
|
|
84
|
+
?PayloadContext log:includes {
|
|
85
|
+
?Reading :about :doorA;
|
|
86
|
+
:doorState ?State;
|
|
87
|
+
:priority ?Priority;
|
|
88
|
+
:source ?Source.
|
|
89
|
+
}.
|
|
90
|
+
} => {
|
|
91
|
+
?Message :windowAssertion ?Reading;
|
|
92
|
+
:doorState ?State;
|
|
93
|
+
:priority ?Priority;
|
|
94
|
+
:source ?Source.
|
|
95
|
+
?Window :hasDoorState ?State.
|
|
96
|
+
}.
|
|
97
|
+
|
|
98
|
+
# The current graph-level window is inconsistent: after raw materialization it
|
|
99
|
+
# says the same door is both open and closed.
|
|
100
|
+
{
|
|
101
|
+
:currentWindow :contains ?OpenMessage, ?ClosedMessage.
|
|
102
|
+
?OpenMessage :doorState :open.
|
|
103
|
+
?ClosedMessage :doorState :closed.
|
|
104
|
+
} => {
|
|
105
|
+
:currentWindow :rawConflict :doorOpenAndClosed;
|
|
106
|
+
:inconsistentDoor :doorA.
|
|
107
|
+
}.
|
|
108
|
+
|
|
109
|
+
# Preferred repair: if a current-window assertion has higher priority than a
|
|
110
|
+
# conflicting current-window assertion, keep the higher-priority assertion as the
|
|
111
|
+
# one used by materialization.
|
|
112
|
+
{
|
|
113
|
+
:currentWindow :contains ?PreferredMessage, ?RejectedMessage;
|
|
114
|
+
:rawConflict :doorOpenAndClosed.
|
|
115
|
+
?PreferredMessage :doorState ?PreferredState;
|
|
116
|
+
:priority ?PreferredPriority;
|
|
117
|
+
:source ?PreferredSource.
|
|
118
|
+
?RejectedMessage :doorState ?RejectedState;
|
|
119
|
+
:priority ?RejectedPriority.
|
|
120
|
+
?PreferredState log:notEqualTo ?RejectedState.
|
|
121
|
+
?PreferredPriority math:greaterThan ?RejectedPriority.
|
|
122
|
+
} => {
|
|
123
|
+
:currentWindow :preferredRepairState ?PreferredState;
|
|
124
|
+
:preferredEvidence ?PreferredMessage;
|
|
125
|
+
:preferredSource ?PreferredSource;
|
|
126
|
+
:rejectsLowerPriority ?RejectedMessage;
|
|
127
|
+
:repairsInconsistency :doorOpenAndClosed;
|
|
128
|
+
:resolvedDoorState ?PreferredState.
|
|
129
|
+
}.
|
|
130
|
+
|
|
131
|
+
# Materialize the final operational conclusion from the repaired state rather
|
|
132
|
+
# than from the inconsistent raw window.
|
|
133
|
+
{
|
|
134
|
+
:currentWindow :preferredRepairState ?State.
|
|
135
|
+
?State :actionText ?ActionText.
|
|
136
|
+
} => {
|
|
137
|
+
:currentWindow :materializedActionText ?ActionText.
|
|
138
|
+
}.
|
|
139
|
+
|
|
140
|
+
# Emit a report only when the parser replay, sliding-window bookkeeping, raw
|
|
141
|
+
# conflict, preferred repair, and final materialization were all derived.
|
|
142
|
+
{
|
|
143
|
+
?Stream a eymsg:RDFMessageStream;
|
|
144
|
+
eymsg:orderedEnvelopes ?Messages.
|
|
145
|
+
?Messages list:length ?Count.
|
|
146
|
+
:doorA :windowSize ?WindowSize.
|
|
147
|
+
:previousWindow :contains ?PreviousOnly.
|
|
148
|
+
:windowSlide :expired ?PreviousOnly;
|
|
149
|
+
:retained ?Overlap1, ?Overlap2;
|
|
150
|
+
:entered ?Entered.
|
|
151
|
+
:currentWindow :rawConflict :doorOpenAndClosed;
|
|
152
|
+
:inconsistentDoor :doorA;
|
|
153
|
+
:preferredEvidence ?PreferredMessage;
|
|
154
|
+
:preferredSource ?PreferredSource;
|
|
155
|
+
:resolvedDoorState ?State;
|
|
156
|
+
:materializedActionText ?ActionText.
|
|
157
|
+
?State :stateText ?StateText.
|
|
158
|
+
?PreferredMessage :priority ?PreferredPriority.
|
|
159
|
+
("# rdf-message-window-repair\n\n## Source files\n\n- [N3 rules](../rdf-message-window-repair.n3)\n- [Input RDF Message Log](../input/rdf-message-window-repair.trig)\n- [Story deck](../deck/rdf-message-window-repair.md)\n\n## Answer\nSliding-window RDF Message repair accepted: %d parser-replayed messages produced two overlapping %d-message ABox windows. The current window retained two envelopes from the previous window, expired one old door reading, and added one new safety-controller reading. Its raw graph-level materialization was inconsistent because doorA was both open and closed. The preferred repair kept the priority-%d assertion from %s, resolved the door state to %s, and materialized the action: %s.\n\n## Explanation\nThe RDF Message Log uses VERSION \\\"1.2-messages\\\" and MESSAGE delimiters. Eyeling parses those boundaries into eymsg: envelopes and payload graphs; the rules inspect each payload with log:includes rather than merging message bodies by hand. The example mirrors a sliding-window stream-reasoning pattern: when the window advances, overlapping message evidence is retained, an expired assertion leaves the window, an entering assertion can change the materialization, and a preferred repair fixes a noisy open/closed contradiction before the final action is produced." ?Count ?WindowSize ?PreferredPriority ?PreferredSource ?StateText ?ActionText) string:format ?Block.
|
|
160
|
+
} => {
|
|
161
|
+
:rdfMessageWindowRepairExample log:outputString ?Block.
|
|
162
|
+
:rdfMessageWindowRepairExample :demonstrates :RDFMessageLogReplay, :SlidingWindow, :OverlappingWindows, :ABoxStream, :RawDoorInconsistency, :PreferredRepair, :IncrementalMaterialization.
|
|
163
|
+
}.
|
package/eyeling.js
CHANGED
|
@@ -6212,16 +6212,16 @@ function __computeConclusionFromFormula(formula) {
|
|
|
6212
6212
|
for (const tr of formula.triples) {
|
|
6213
6213
|
// Treat {A} => {B} as a forward rule.
|
|
6214
6214
|
if (isLogImplies(tr.p)) {
|
|
6215
|
-
fw.push(__makeRuleFromTerms(tr.s, tr.o, true));
|
|
6215
|
+
fw.push(__copyProofSource(tr, __makeRuleFromTerms(tr.s, tr.o, true)));
|
|
6216
6216
|
continue;
|
|
6217
6217
|
}
|
|
6218
6218
|
|
|
6219
6219
|
// Treat {A} <= {B} as the same rule in the other direction, i.e., {B} => {A},
|
|
6220
6220
|
// so it participates in deductive closure even if only <= is used.
|
|
6221
6221
|
if (isLogImpliedBy(tr.p)) {
|
|
6222
|
-
fw.push(__makeRuleFromTerms(tr.o, tr.s, true));
|
|
6222
|
+
fw.push(__copyProofSource(tr, __makeRuleFromTerms(tr.o, tr.s, true)));
|
|
6223
6223
|
// Also index it as a backward rule for completeness (helps proveGoals in some cases).
|
|
6224
|
-
bw.push(__makeRuleFromTerms(tr.s, tr.o, false));
|
|
6224
|
+
bw.push(__copyProofSource(tr, __makeRuleFromTerms(tr.s, tr.o, false)));
|
|
6225
6225
|
continue;
|
|
6226
6226
|
}
|
|
6227
6227
|
}
|
|
@@ -8735,7 +8735,7 @@ function forwardChain(facts, forwardRules, backRules, onDerived /* optional */,
|
|
|
8735
8735
|
// Promote rule-producing triples to live rules, treating literal true as {}
|
|
8736
8736
|
// and literal false as a fuse head.
|
|
8737
8737
|
if (isFwRuleTriple) {
|
|
8738
|
-
const newRule = __makeRuleFromTerms(subj, obj, true);
|
|
8738
|
+
const newRule = __copyProofSource(r, __makeRuleFromTerms(subj, obj, true));
|
|
8739
8739
|
__prepareForwardRule(newRule);
|
|
8740
8740
|
|
|
8741
8741
|
const key = __ruleKey(
|
|
@@ -8752,7 +8752,7 @@ function forwardChain(facts, forwardRules, backRules, onDerived /* optional */,
|
|
|
8752
8752
|
rulesChanged = true;
|
|
8753
8753
|
}
|
|
8754
8754
|
} else if (isBwRuleTriple) {
|
|
8755
|
-
const newRule = __makeRuleFromTerms(subj, obj, false);
|
|
8755
|
+
const newRule = __copyProofSource(r, __makeRuleFromTerms(subj, obj, false));
|
|
8756
8756
|
|
|
8757
8757
|
const key = __ruleKey(
|
|
8758
8758
|
newRule.isForward,
|