eyemind 0.8.4 → 0.8.5
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/LS-SPEC.md +1 -1
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/engine.js +29 -1
- package/src/version.js +1 -1
package/LS-SPEC.md
CHANGED
package/README.md
CHANGED
|
@@ -648,6 +648,7 @@ EYEMIND_PROPERTY_SCALE=20 npm test -- -k properties # deeper generated tests
|
|
|
648
648
|
node tools/update-examples.js # regenerate example artifacts after an intended change
|
|
649
649
|
npm run sync # refresh the cached upstream test suites
|
|
650
650
|
node conformance/run.js --command "my-eyemind" # run the conformance suite against another implementation
|
|
651
|
+
node bench/run.js # the RDF reasoning benchmark; see bench/README.md
|
|
651
652
|
./release patch "Describe the changes" # test, tag and publish a release
|
|
652
653
|
```
|
|
653
654
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyemind",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "A dependency-free Logic Script (LS) reasoner with forward and backward reasoning, checkable proofs, and RDF 1.2, Notation3 (N3), SPARQL 1.2 RL (SRL) and Logical English (LE) interoperability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/engine.js
CHANGED
|
@@ -761,6 +761,8 @@ export class Solver {
|
|
|
761
761
|
const body = fullBody.slice(clause.prefixLength);
|
|
762
762
|
const env = new Env();
|
|
763
763
|
const prefix = this.context(clause, names, env);
|
|
764
|
+
// The firings of one call share their duplicate check (see scan).
|
|
765
|
+
this.pendingFirings = new Map();
|
|
764
766
|
if (previous === null) return this.scan(clause, head, body, names, env, prefix).map(([found]) => found);
|
|
765
767
|
const found = [];
|
|
766
768
|
for (const delta of positions) {
|
|
@@ -897,7 +899,33 @@ export class Solver {
|
|
|
897
899
|
const claim = conclusions.some((item) => item === 'true') ? copyResolved(conjunction(body), answerEnv) : null;
|
|
898
900
|
// A restricted firing keeps its guard, checked again once reasoning ends.
|
|
899
901
|
const guard = clause.guard === null || !unresolved.size ? null : copyResolved(body[body.length - 1], answerEnv);
|
|
900
|
-
|
|
902
|
+
const chosen = this.chosen !== null ? [...this.chosen] : null;
|
|
903
|
+
// Without a proof, a firing that only concludes ground facts is the same
|
|
904
|
+
// whichever of its duplicates publishes it. Keeping only the first in
|
|
905
|
+
// publication order, and none whose facts are already known, bounds
|
|
906
|
+
// memory by the new facts rather than the firings, as in a closure
|
|
907
|
+
// where many firings derive each fact.
|
|
908
|
+
const plain = !this.recording && !clause.templates.length && guard === null && claim === null && !this.program.inspectionEnabled &&
|
|
909
|
+
conclusions.every((item) => item !== 'false' && isGround(item));
|
|
910
|
+
if (plain) {
|
|
911
|
+
const keys = conclusions.map((item) => this.factKey(item));
|
|
912
|
+
if (keys.every((k) => this.factKeys.has(k))) { answerEnv.undo(mark); continue; }
|
|
913
|
+
const id = keys.join('\u0000'), earlier = this.pendingFirings.get(id);
|
|
914
|
+
if (earlier) {
|
|
915
|
+
if (chosen !== null && earlier[1] !== null && compareChosen(chosen, earlier[1]) < 0) {
|
|
916
|
+
earlier[0] = [conclusions, children, bindings, claim, guard];
|
|
917
|
+
earlier[1] = chosen;
|
|
918
|
+
}
|
|
919
|
+
answerEnv.undo(mark);
|
|
920
|
+
continue;
|
|
921
|
+
}
|
|
922
|
+
const entry = [[conclusions, children, bindings, claim, guard], chosen];
|
|
923
|
+
this.pendingFirings.set(id, entry);
|
|
924
|
+
found.push(entry);
|
|
925
|
+
answerEnv.undo(mark);
|
|
926
|
+
continue;
|
|
927
|
+
}
|
|
928
|
+
found.push([[conclusions, children, bindings, claim, guard], chosen]);
|
|
901
929
|
answerEnv.undo(mark);
|
|
902
930
|
}
|
|
903
931
|
return found;
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// The release this checkout is; ./release keeps it in step with package.json.
|
|
2
|
-
export const VERSION = '0.8.
|
|
2
|
+
export const VERSION = '0.8.5';
|