eyeling 1.7.10 → 1.7.11

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/examples/bind.n3 CHANGED
@@ -4,4 +4,4 @@
4
4
 
5
5
  :phayes a :Person ; :givenName "Pat"; :familyName "Hayes" .
6
6
 
7
- { ?x a :Person . ?SCOPE log:notIncludes { ?x :name ?someName . } . ?x :givenName ?name1 . ?x :familyName ?name2 . (?name1 " " ?name2) string:concatenation ?FN . } => { ?x :name ?FN } .
7
+ { ?x a :Person . (1 { ?x :name ?someName . } ()) log:collectAllIn ?SCOPE . ?x :givenName ?name1 . ?x :familyName ?name2 . (?name1 " " ?name2) string:concatenation ?FN . } => { ?x :name ?FN } .
package/examples/snaf.n3 CHANGED
@@ -9,7 +9,7 @@
9
9
  :Bob a :Person.
10
10
 
11
11
  {
12
- ?SCOPE log:notIncludes { :Alice :hates ?X }.
12
+ (1 { :Alice :hates ?X } ()) log:collectAllIn ?SCOPE .
13
13
  ?X a :Person.
14
14
  }
15
15
  =>
package/eyeling.js CHANGED
@@ -5533,62 +5533,40 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen) {
5533
5533
  return results;
5534
5534
  }
5535
5535
 
5536
- // log:includes (provable in scope)
5536
+ // log:includes
5537
5537
  // Schema: $s+ log:includes $o+
5538
- // When the subject is a formula, the scope is that concrete formula (syntactic containment).
5539
- // Otherwise, the scope is the current document scope (facts + backward rules).
5538
+ // Object may be a concrete formula or the literal `true` (empty formula).
5540
5539
  if (pv === LOG_NS + 'includes') {
5540
+ if (!(g.s instanceof GraphTerm)) return [];
5541
+
5541
5542
  // Empty formula is always included.
5542
5543
  if (g.o instanceof Literal && g.o.value === 'true') return [{ ...subst }];
5543
5544
  if (!(g.o instanceof GraphTerm)) return [];
5544
5545
 
5545
- /** @type {Triple[] | null} */
5546
- let scopeFacts = null;
5547
- /** @type {Rule[]} */
5548
- let scopeBackRules = backRules;
5549
-
5550
- // If the subject is a formula, treat it as a concrete scope graph.
5551
- // Also support `true` as the empty formula.
5552
- if (g.s instanceof GraphTerm) {
5553
- scopeFacts = g.s.triples.slice();
5554
- ensureFactIndexes(scopeFacts);
5555
- Object.defineProperty(scopeFacts, '__scopedSnapshot', { value: scopeFacts, enumerable: false, writable: true });
5556
- scopeBackRules = []; // concrete scope = syntactic containment (no extra rules)
5557
- } else if (g.s instanceof Literal && g.s.value === 'true') {
5558
- scopeFacts = [];
5559
- ensureFactIndexes(scopeFacts);
5560
- Object.defineProperty(scopeFacts, '__scopedSnapshot', { value: scopeFacts, enumerable: false, writable: true });
5561
- scopeBackRules = [];
5562
- } else {
5563
- scopeFacts = facts; // dynamic scope
5564
- }
5546
+ const scopeFacts = g.s.triples.slice();
5547
+ ensureFactIndexes(scopeFacts);
5548
+ Object.defineProperty(scopeFacts, '__scopedSnapshot', { value: scopeFacts, enumerable: false, writable: true });
5565
5549
 
5566
5550
  const visited2 = [];
5567
5551
  // Start from the incoming substitution so bindings flow outward.
5568
- return proveGoals(Array.from(g.o.triples), { ...subst }, scopeFacts, scopeBackRules, depth + 1, visited2, varGen);
5552
+ return proveGoals(Array.from(g.o.triples), { ...subst }, scopeFacts, [], depth + 1, visited2, varGen);
5569
5553
  }
5570
5554
 
5571
- // log:notIncludes (not provable in scope)
5572
- // Delay until we have a frozen scope snapshot to avoid early success.
5555
+ // log:notIncludes
5556
+ // Schema: $s+ log:notIncludes $o+
5573
5557
  if (pv === LOG_NS + 'notIncludes') {
5574
- if (!(g.o instanceof GraphTerm)) return [];
5558
+ if (!(g.s instanceof GraphTerm)) return [];
5575
5559
 
5576
- let scopeFacts = null;
5577
- let scopeBackRules = backRules;
5560
+ // Empty formula is always included, so it is never "not included".
5561
+ if (g.o instanceof Literal && g.o.value === 'true') return [];
5562
+ if (!(g.o instanceof GraphTerm)) return [];
5578
5563
 
5579
- // If the subject is a formula, treat it as the concrete scope graph
5580
- if (g.s instanceof GraphTerm) {
5581
- scopeFacts = g.s.triples.slice();
5582
- ensureFactIndexes(scopeFacts);
5583
- Object.defineProperty(scopeFacts, '__scopedSnapshot', { value: scopeFacts, enumerable: false, writable: true });
5584
- scopeBackRules = []; // concrete scope = syntactic containment (no extra rules)
5585
- } else {
5586
- scopeFacts = facts.__scopedSnapshot || null;
5587
- if (!scopeFacts) return []; // DELAY until saturation snapshot exists
5588
- }
5564
+ const scopeFacts = g.s.triples.slice();
5565
+ ensureFactIndexes(scopeFacts);
5566
+ Object.defineProperty(scopeFacts, '__scopedSnapshot', { value: scopeFacts, enumerable: false, writable: true });
5589
5567
 
5590
5568
  const visited2 = [];
5591
- const sols = proveGoals(Array.from(g.o.triples), {}, scopeFacts, scopeBackRules, depth + 1, visited2, varGen);
5569
+ const sols = proveGoals(Array.from(g.o.triples), { ...subst }, scopeFacts, [], depth + 1, visited2, varGen);
5592
5570
  return sols.length ? [] : [{ ...subst }];
5593
5571
  }
5594
5572
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.7.10",
3
+ "version": "1.7.11",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [