eyeling 1.26.5 → 1.26.6

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.
@@ -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,
@@ -0,0 +1,80 @@
1
+ @prefix : <http://example.org/socrates#> .
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
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
6
+
7
+ {
8
+ :Socrates a :Human .
9
+ } <= true .
10
+ {
11
+ :Human rdfs:subClassOf :Mortal .
12
+ } <= true .
13
+ :Socrates a :Mortal .
14
+ :test :is true .
15
+
16
+ {
17
+ {
18
+ :Socrates a :Human .
19
+ } <= true .
20
+ } pe:why {
21
+ {
22
+ {
23
+ :Socrates a :Human .
24
+ } <= true .
25
+ }
26
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 9 ].
27
+ }.
28
+
29
+ {
30
+ {
31
+ :Human rdfs:subClassOf :Mortal .
32
+ } <= true .
33
+ } pe:why {
34
+ {
35
+ {
36
+ :Human rdfs:subClassOf :Mortal .
37
+ } <= true .
38
+ }
39
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 9 ].
40
+ }.
41
+
42
+ { :Socrates a :Mortal . } pe:why {
43
+ { :Socrates a :Mortal . }
44
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 14 ];
45
+ pe:binding
46
+ [ pe:var "A"; pe:value :Human ],
47
+ [ pe:var "B"; pe:value :Mortal ],
48
+ [ pe:var "S"; pe:value :Socrates ];
49
+ pe:uses
50
+ { :Socrates a :Human . },
51
+ { :Human rdfs:subClassOf :Mortal . }.
52
+
53
+ { :Socrates a :Human . }
54
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 9 ].
55
+
56
+ { :Human rdfs:subClassOf :Mortal . }
57
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 9 ].
58
+ }.
59
+
60
+ { :test :is true . } pe:why {
61
+ { :test :is true . }
62
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 21 ];
63
+ pe:uses { :Socrates a :Mortal . }.
64
+
65
+ { :Socrates a :Mortal . }
66
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 14 ];
67
+ pe:binding
68
+ [ pe:var "A"; pe:value :Human ],
69
+ [ pe:var "B"; pe:value :Mortal ],
70
+ [ pe:var "S"; pe:value :Socrates ];
71
+ pe:uses
72
+ { :Socrates a :Human . },
73
+ { :Human rdfs:subClassOf :Mortal . }.
74
+
75
+ { :Socrates a :Human . }
76
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 9 ].
77
+
78
+ { :Human rdfs:subClassOf :Mortal . }
79
+ pe:by [ pe:rule "derived-backward-rule-2.n3"; pe:line 9 ].
80
+ }.
@@ -0,0 +1,53 @@
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
+ {
6
+ ?x :childOf ?y .
7
+ } <= {
8
+ ?y :parentOf ?x .
9
+ } .
10
+ :bob :hasParent :alice .
11
+
12
+ {
13
+ {
14
+ ?x :childOf ?y .
15
+ } <= {
16
+ ?y :parentOf ?x .
17
+ } .
18
+ } pe:why {
19
+ {
20
+ {
21
+ ?x :childOf ?y .
22
+ } <= {
23
+ ?y :parentOf ?x .
24
+ } .
25
+ }
26
+ pe:by [ pe:rule "derived-backward-rule.n3"; pe:line 16 ];
27
+ pe:binding
28
+ [ pe:var "p"; pe:value :parentOf ],
29
+ [ pe:var "q"; pe:value :childOf ];
30
+ pe:uses { :parentOf :invOf :childOf . }.
31
+
32
+ { :parentOf :invOf :childOf . }
33
+ pe:by [ pe:fact "derived-backward-rule.n3"; pe:line 8 ].
34
+ }.
35
+
36
+ { :bob :hasParent :alice . } pe:why {
37
+ { :bob :hasParent :alice . }
38
+ pe:by [ pe:rule "derived-backward-rule.n3"; pe:line 27 ];
39
+ pe:binding
40
+ [ pe:var "x"; pe:value :bob ],
41
+ [ pe:var "y"; pe:value :alice ];
42
+ pe:uses { :bob :childOf :alice . }.
43
+
44
+ { :bob :childOf :alice . }
45
+ pe:by [ pe:rule "derived-backward-rule.n3"; pe:line 16 ];
46
+ pe:binding
47
+ [ pe:var "x"; pe:value :bob ],
48
+ [ pe:var "y"; pe:value :alice ];
49
+ pe:uses { :alice :parentOf :bob . }.
50
+
51
+ { :alice :parentOf :bob . }
52
+ pe:by [ pe:fact "derived-backward-rule.n3"; pe:line 10 ].
53
+ }.
@@ -0,0 +1,43 @@
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
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
5
+
6
+ {
7
+ ?y a :Dog .
8
+ } => {
9
+ :test :is true .
10
+ } .
11
+ :test :is true .
12
+
13
+ {
14
+ {
15
+ ?y a :Dog .
16
+ } => {
17
+ :test :is true .
18
+ } .
19
+ } pe:why {
20
+ {
21
+ {
22
+ ?y a :Dog .
23
+ } => {
24
+ :test :is true .
25
+ } .
26
+ }
27
+ pe:by [ pe:rule "derived-rule.n3"; pe:line 11 ];
28
+ pe:binding [ pe:var "x"; pe:value :Minka ];
29
+ pe:uses { :Minka a :Cat . }.
30
+
31
+ { :Minka a :Cat . }
32
+ pe:by [ pe:fact "derived-rule.n3"; pe:line 8 ].
33
+ }.
34
+
35
+ { :test :is true . } pe:why {
36
+ { :test :is true . }
37
+ pe:by [ pe:rule "derived-rule.n3"; pe:line 11 ];
38
+ pe:binding [ pe:var "y"; pe:value :Charly ];
39
+ pe:uses { :Charly a :Dog . }.
40
+
41
+ { :Charly a :Dog . }
42
+ pe:by [ pe:fact "derived-rule.n3"; pe:line 9 ].
43
+ }.
@@ -0,0 +1,41 @@
1
+ @prefix : <https://eyereasoner.github.io/ns#> .
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
+ :alice :mustHave :dogLicense .
7
+
8
+ { :alice :mustHave :dogLicense . } pe:why {
9
+ { :alice :mustHave :dogLicense . }
10
+ pe:by [ pe:rule "dog.n3"; pe:line 13 ];
11
+ pe:binding
12
+ [ pe:var "Any"; pe:value :dog1 ],
13
+ [ pe:var "Count"; pe:value 5 ],
14
+ [ pe:var "List"; pe:value (1 1 1 1 1) ],
15
+ [ pe:var "Subject"; pe:value :alice ];
16
+ pe:uses
17
+ { :alice :hasDog :dog1 . },
18
+ {
19
+ (1 {
20
+ :alice :hasDog ?Dog .
21
+ } (1 1 1 1 1)) log:collectAllIn ?Scope .
22
+ },
23
+ { (1 1 1 1 1) math:sum 5 . },
24
+ { 5 math:greaterThan 4 . }.
25
+
26
+ { :alice :hasDog :dog1 . }
27
+ pe:by [ pe:fact "dog.n3"; pe:line 10 ].
28
+
29
+ {
30
+ (1 {
31
+ :alice :hasDog ?Dog .
32
+ } (1 1 1 1 1)) log:collectAllIn ?Scope .
33
+ }
34
+ pe:by [ pe:builtin log:collectAllIn ].
35
+
36
+ { (1 1 1 1 1) math:sum 5 . }
37
+ pe:by [ pe:builtin math:sum ].
38
+
39
+ { 5 math:greaterThan 4 . }
40
+ pe:by [ pe:builtin math:greaterThan ].
41
+ }.
@@ -0,0 +1,14 @@
1
+ @prefix : <http://example.org/socrates#> .
2
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
3
+ @prefix pe: <https://eyereasoner.github.io/pe#> .
4
+
5
+ :test :is true .
6
+
7
+ { :test :is true . } pe:why {
8
+ { :test :is true . }
9
+ pe:by [ pe:rule "equals.n3"; pe:line 11 ];
10
+ pe:uses { :X = :Y . }.
11
+
12
+ { :X = :Y . }
13
+ pe:by [ pe:fact "equals.n3"; pe:line 9 ].
14
+ }.
@@ -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
+ }.
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,
package/lib/engine.js CHANGED
@@ -717,16 +717,16 @@ function __computeConclusionFromFormula(formula) {
717
717
  for (const tr of formula.triples) {
718
718
  // Treat {A} => {B} as a forward rule.
719
719
  if (isLogImplies(tr.p)) {
720
- fw.push(__makeRuleFromTerms(tr.s, tr.o, true));
720
+ fw.push(__copyProofSource(tr, __makeRuleFromTerms(tr.s, tr.o, true)));
721
721
  continue;
722
722
  }
723
723
 
724
724
  // Treat {A} <= {B} as the same rule in the other direction, i.e., {B} => {A},
725
725
  // so it participates in deductive closure even if only <= is used.
726
726
  if (isLogImpliedBy(tr.p)) {
727
- fw.push(__makeRuleFromTerms(tr.o, tr.s, true));
727
+ fw.push(__copyProofSource(tr, __makeRuleFromTerms(tr.o, tr.s, true)));
728
728
  // Also index it as a backward rule for completeness (helps proveGoals in some cases).
729
- bw.push(__makeRuleFromTerms(tr.s, tr.o, false));
729
+ bw.push(__copyProofSource(tr, __makeRuleFromTerms(tr.s, tr.o, false)));
730
730
  continue;
731
731
  }
732
732
  }
@@ -3240,7 +3240,7 @@ function forwardChain(facts, forwardRules, backRules, onDerived /* optional */,
3240
3240
  // Promote rule-producing triples to live rules, treating literal true as {}
3241
3241
  // and literal false as a fuse head.
3242
3242
  if (isFwRuleTriple) {
3243
- const newRule = __makeRuleFromTerms(subj, obj, true);
3243
+ const newRule = __copyProofSource(r, __makeRuleFromTerms(subj, obj, true));
3244
3244
  __prepareForwardRule(newRule);
3245
3245
 
3246
3246
  const key = __ruleKey(
@@ -3257,7 +3257,7 @@ function forwardChain(facts, forwardRules, backRules, onDerived /* optional */,
3257
3257
  rulesChanged = true;
3258
3258
  }
3259
3259
  } else if (isBwRuleTriple) {
3260
- const newRule = __makeRuleFromTerms(subj, obj, false);
3260
+ const newRule = __copyProofSource(r, __makeRuleFromTerms(subj, obj, false));
3261
3261
 
3262
3262
  const key = __ruleKey(
3263
3263
  newRule.isForward,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.26.5",
3
+ "version": "1.26.6",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [