eyeling 1.26.3 → 1.26.4

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/lib/engine.js CHANGED
@@ -40,6 +40,27 @@ const INFERENCE_FUSE_EXIT_CODE = 65;
40
40
  const RDF_NIL_IRI = RDF_NS + 'nil';
41
41
  const EMPTY_LIST_TERM = new ListTerm([]);
42
42
 
43
+ const LOG_COLLECT_ALL_IN_IRI = LOG_NS + 'collectAllIn';
44
+ const LOG_FOR_ALL_IN_IRI = LOG_NS + 'forAllIn';
45
+ const LOG_INCLUDES_IRI = LOG_NS + 'includes';
46
+ const LOG_NOT_INCLUDES_IRI = LOG_NS + 'notIncludes';
47
+ const LOG_IMPLIES_IRI = LOG_NS + 'implies';
48
+ const LOG_IMPLIED_BY_IRI = LOG_NS + 'impliedBy';
49
+
50
+ const MATH_BUILTINS_SATISFIABLE_WHEN_FULLY_UNBOUND = new Set([
51
+ MATH_NS + 'sin',
52
+ MATH_NS + 'cos',
53
+ MATH_NS + 'tan',
54
+ MATH_NS + 'asin',
55
+ MATH_NS + 'acos',
56
+ MATH_NS + 'atan',
57
+ MATH_NS + 'sinh',
58
+ MATH_NS + 'cosh',
59
+ MATH_NS + 'tanh',
60
+ MATH_NS + 'degrees',
61
+ MATH_NS + 'negation',
62
+ ]);
63
+
43
64
  const { lex, N3SyntaxError } = require('./lexer');
44
65
  const { Parser } = require('./parser');
45
66
  const { liftBlankRuleVars } = require('./rules');
@@ -100,10 +121,29 @@ function __cloneSubst(subst) {
100
121
  return out;
101
122
  }
102
123
 
124
+ function __defineHidden(obj, name, value, writable) {
125
+ Object.defineProperty(obj, name, { value, enumerable: false, writable, configurable: true });
126
+ }
127
+
128
+ function __defineHiddenValue(obj, name, value) {
129
+ __defineHidden(obj, name, value, false);
130
+ }
131
+
103
132
  function __defineHiddenWritable(obj, name, value) {
104
- Object.defineProperty(obj, name, { value, enumerable: false, writable: true });
133
+ __defineHidden(obj, name, value, true);
105
134
  }
106
135
 
136
+ function __setHiddenWritable(obj, name, value) {
137
+ if (hasOwn.call(obj, name)) obj[name] = value;
138
+ else __defineHiddenWritable(obj, name, value);
139
+ }
140
+
141
+ const FACT_INDEX_ARRAY_FIELDS = ['__varPred', '__varPredNonFastS', '__varPredNonFastO'];
142
+ const FACT_INDEX_ARRAY_MAP_FIELDS = ['__byPred', '__byPNonFastS', '__byPNonFastO', '__varPredPS', '__varPredPO'];
143
+ const FACT_INDEX_NESTED_ARRAY_MAP_FIELDS = ['__byPS', '__byPO'];
144
+ const FACT_INDEX_MAP_FIELDS = FACT_INDEX_ARRAY_MAP_FIELDS.concat(FACT_INDEX_NESTED_ARRAY_MAP_FIELDS);
145
+ const FACT_INDEX_REQUIRED_FIELDS = FACT_INDEX_ARRAY_FIELDS.concat(FACT_INDEX_MAP_FIELDS, ['__keySet']);
146
+
107
147
  let version = 'dev';
108
148
  try {
109
149
  // Node: keep package.json version if available
@@ -327,14 +367,13 @@ function __firingKey(ruleIndex, instantiatedPremises) {
327
367
  // -----------------------------------------------------------------------------
328
368
  function __ensureRuleKeySet(rules) {
329
369
  if (!hasOwn.call(rules, '__ruleKeySet')) {
330
- Object.defineProperty(rules, '__ruleKeySet', {
331
- value: new Set(
370
+ __defineHiddenValue(
371
+ rules,
372
+ '__ruleKeySet',
373
+ new Set(
332
374
  rules.map((r) => __ruleKey(r.isForward, r.isFuse, r.premise, r.conclusion, r.__dynamicConclusionTerm || null)),
333
375
  ),
334
- enumerable: false,
335
- writable: false,
336
- configurable: true,
337
- });
376
+ );
338
377
  }
339
378
  return rules.__ruleKeySet;
340
379
  }
@@ -352,28 +391,13 @@ function __computeHeadIsStrictGround(r) {
352
391
  function __prepareForwardRule(r) {
353
392
  if (!hasOwn.call(r, '__scopedSkipInfo')) {
354
393
  const info = __computeForwardRuleScopedSkipInfo(r);
355
- Object.defineProperty(r, '__scopedSkipInfo', {
356
- value: info,
357
- enumerable: false,
358
- writable: false,
359
- configurable: true,
360
- });
394
+ __defineHiddenValue(r, '__scopedSkipInfo', info);
361
395
  }
362
396
  if (!hasOwn.call(r, '__headIsStrictGround')) {
363
- Object.defineProperty(r, '__headIsStrictGround', {
364
- value: __computeHeadIsStrictGround(r),
365
- enumerable: false,
366
- writable: false,
367
- configurable: true,
368
- });
397
+ __defineHiddenValue(r, '__headIsStrictGround', __computeHeadIsStrictGround(r));
369
398
  }
370
399
  if (!hasOwn.call(r, '__needsForwardSkipCheck')) {
371
- Object.defineProperty(r, '__needsForwardSkipCheck', {
372
- value: !!(r.__headIsStrictGround || (r.__scopedSkipInfo && r.__scopedSkipInfo.needsSnap)),
373
- enumerable: false,
374
- writable: false,
375
- configurable: true,
376
- });
400
+ __defineHiddenValue(r, '__needsForwardSkipCheck', !!(r.__headIsStrictGround || (r.__scopedSkipInfo && r.__scopedSkipInfo.needsSnap)));
377
401
  }
378
402
  }
379
403
 
@@ -431,13 +455,13 @@ function __computeMaxScopedClosurePriorityNeeded(forwardRules, backRules) {
431
455
  const pv = tr.p.value;
432
456
 
433
457
  // log:collectAllIn / log:forAllIn use the object position for the priority.
434
- if (pv === LOG_NS + 'collectAllIn' || pv === LOG_NS + 'forAllIn') {
458
+ if (pv === LOG_COLLECT_ALL_IN_IRI || pv === LOG_FOR_ALL_IN_IRI) {
435
459
  bumpMaxPriority(tr.o);
436
460
  return;
437
461
  }
438
462
 
439
463
  // log:includes / log:notIncludes use the subject position for the priority.
440
- if (pv === LOG_NS + 'includes' || pv === LOG_NS + 'notIncludes') bumpMaxPriority(tr.s);
464
+ if (pv === LOG_INCLUDES_IRI || pv === LOG_NOT_INCLUDES_IRI) bumpMaxPriority(tr.s);
441
465
  }
442
466
 
443
467
  for (const r of forwardRules) {
@@ -449,17 +473,6 @@ function __computeMaxScopedClosurePriorityNeeded(forwardRules, backRules) {
449
473
  return maxP;
450
474
  }
451
475
 
452
- function __termContainsVarName(t, name) {
453
- if (t instanceof Var) return t.name === name;
454
- if (t instanceof ListTerm) return t.elems.some((e) => __termContainsVarName(e, name));
455
- if (t instanceof OpenListTerm) return t.tailVar === name || t.prefix.some((e) => __termContainsVarName(e, name));
456
- if (t instanceof GraphTerm)
457
- return t.triples.some(
458
- (tr) =>
459
- __termContainsVarName(tr.s, name) || __termContainsVarName(tr.p, name) || __termContainsVarName(tr.o, name),
460
- );
461
- return false;
462
- }
463
476
 
464
477
  function __varOccursElsewhereInPremise(premise, name, idx, field) {
465
478
  for (let i = 0; i < premise.length; i++) {
@@ -467,9 +480,9 @@ function __varOccursElsewhereInPremise(premise, name, idx, field) {
467
480
  if (!(tr && tr.s && tr.p && tr.o)) continue;
468
481
 
469
482
  // Skip the specific scope/priority occurrence we are analyzing.
470
- if (!(i === idx && field === 's') && __termContainsVarName(tr.s, name)) return true;
471
- if (!(i === idx && field === 'p') && __termContainsVarName(tr.p, name)) return true;
472
- if (!(i === idx && field === 'o') && __termContainsVarName(tr.o, name)) return true;
483
+ if (!(i === idx && field === 's') && containsVarTerm(tr.s, name)) return true;
484
+ if (!(i === idx && field === 'p') && containsVarTerm(tr.p, name)) return true;
485
+ if (!(i === idx && field === 'o') && containsVarTerm(tr.o, name)) return true;
473
486
  }
474
487
  return false;
475
488
  }
@@ -500,7 +513,7 @@ function __analyzeForwardRuleScopedUse(rule) {
500
513
  if (!(tr && tr.p instanceof Iri)) continue;
501
514
  const pv = tr.p.value;
502
515
 
503
- if (pv === LOG_NS + 'includes' || pv === LOG_NS + 'notIncludes') {
516
+ if (pv === LOG_INCLUDES_IRI || pv === LOG_NOT_INCLUDES_IRI) {
504
517
  // Explicit quoted scopes are local formulas, not snapshots of the global closure.
505
518
  if (tr.s instanceof GraphTerm) continue;
506
519
 
@@ -514,7 +527,7 @@ function __analyzeForwardRuleScopedUse(rule) {
514
527
  continue;
515
528
  }
516
529
 
517
- if (pv === LOG_NS + 'collectAllIn') {
530
+ if (pv === LOG_COLLECT_ALL_IN_IRI) {
518
531
  if (tr.o instanceof GraphTerm) continue;
519
532
 
520
533
  out.needsSnap = true;
@@ -526,7 +539,7 @@ function __analyzeForwardRuleScopedUse(rule) {
526
539
  continue;
527
540
  }
528
541
 
529
- if (pv === LOG_NS + 'forAllIn') {
542
+ if (pv === LOG_FOR_ALL_IN_IRI) {
530
543
  if (tr.o instanceof GraphTerm) continue;
531
544
 
532
545
  out.needsSnap = true;
@@ -568,16 +581,7 @@ function __setForwardRuleScopedStratumInfo(rule, level) {
568
581
  ? { needsSnap: true, requiredLevel: level, exactLevel: true }
569
582
  : { needsSnap: false, requiredLevel: 0, exactLevel: false };
570
583
 
571
- if (!hasOwn.call(rule, '__scopedStratumInfo')) {
572
- Object.defineProperty(rule, '__scopedStratumInfo', {
573
- value,
574
- enumerable: false,
575
- writable: true,
576
- configurable: true,
577
- });
578
- } else {
579
- rule.__scopedStratumInfo = value;
580
- }
584
+ __setHiddenWritable(rule, '__scopedStratumInfo', value);
581
585
  }
582
586
 
583
587
  function __computeForwardRuleScopedStrata(forwardRules) {
@@ -651,9 +655,9 @@ function __computeForwardRuleScopedSkipInfo(rule) {
651
655
  if (!(tr && tr.p instanceof Iri)) continue;
652
656
  const pv = tr.p.value;
653
657
 
654
- if (pv === LOG_NS + 'collectAllIn' || pv === LOG_NS + 'forAllIn') {
658
+ if (pv === LOG_COLLECT_ALL_IN_IRI || pv === LOG_FOR_ALL_IN_IRI) {
655
659
  if (!addScopedUse(tr.o, i, 'o')) return null;
656
- } else if (pv === LOG_NS + 'includes' || pv === LOG_NS + 'notIncludes') {
660
+ } else if (pv === LOG_INCLUDES_IRI || pv === LOG_NOT_INCLUDES_IRI) {
657
661
  if (!addScopedUse(tr.s, i, 's')) return null;
658
662
  }
659
663
  }
@@ -1245,31 +1249,10 @@ function tripleFastKey(tr) {
1245
1249
  }
1246
1250
 
1247
1251
  function ensureFactIndexes(facts) {
1248
- if (
1249
- facts.__byPred &&
1250
- facts.__byPS &&
1251
- facts.__byPO &&
1252
- facts.__byPNonFastS &&
1253
- facts.__byPNonFastO &&
1254
- facts.__varPred &&
1255
- facts.__varPredPS &&
1256
- facts.__varPredPO &&
1257
- facts.__varPredNonFastS &&
1258
- facts.__varPredNonFastO &&
1259
- facts.__keySet
1260
- )
1261
- return;
1252
+ if (FACT_INDEX_REQUIRED_FIELDS.every((name) => facts[name])) return;
1262
1253
 
1263
- __defineHiddenWritable(facts, '__byPred', new Map());
1264
- __defineHiddenWritable(facts, '__byPS', new Map());
1265
- __defineHiddenWritable(facts, '__byPO', new Map());
1266
- __defineHiddenWritable(facts, '__byPNonFastS', new Map());
1267
- __defineHiddenWritable(facts, '__byPNonFastO', new Map());
1268
- __defineHiddenWritable(facts, '__varPred', []);
1269
- __defineHiddenWritable(facts, '__varPredPS', new Map());
1270
- __defineHiddenWritable(facts, '__varPredPO', new Map());
1271
- __defineHiddenWritable(facts, '__varPredNonFastS', []);
1272
- __defineHiddenWritable(facts, '__varPredNonFastO', []);
1254
+ for (const name of FACT_INDEX_MAP_FIELDS) __defineHiddenWritable(facts, name, new Map());
1255
+ for (const name of FACT_INDEX_ARRAY_FIELDS) __defineHiddenWritable(facts, name, []);
1273
1256
  __defineHiddenWritable(facts, '__keySet', new Set());
1274
1257
  __defineHiddenWritable(facts, '__keySetComplete', false);
1275
1258
 
@@ -1299,16 +1282,9 @@ function cloneFactIndexesForSnapshot(src, dest) {
1299
1282
  return out;
1300
1283
  }
1301
1284
 
1302
- __defineHiddenWritable(dest, '__byPred', cloneArrayMap(src.__byPred));
1303
- __defineHiddenWritable(dest, '__byPS', cloneNestedArrayMap(src.__byPS));
1304
- __defineHiddenWritable(dest, '__byPO', cloneNestedArrayMap(src.__byPO));
1305
- __defineHiddenWritable(dest, '__byPNonFastS', cloneArrayMap(src.__byPNonFastS));
1306
- __defineHiddenWritable(dest, '__byPNonFastO', cloneArrayMap(src.__byPNonFastO));
1307
- __defineHiddenWritable(dest, '__varPred', src.__varPred.slice());
1308
- __defineHiddenWritable(dest, '__varPredPS', cloneArrayMap(src.__varPredPS));
1309
- __defineHiddenWritable(dest, '__varPredPO', cloneArrayMap(src.__varPredPO));
1310
- __defineHiddenWritable(dest, '__varPredNonFastS', src.__varPredNonFastS.slice());
1311
- __defineHiddenWritable(dest, '__varPredNonFastO', src.__varPredNonFastO.slice());
1285
+ for (const name of FACT_INDEX_ARRAY_MAP_FIELDS) __defineHiddenWritable(dest, name, cloneArrayMap(src[name]));
1286
+ for (const name of FACT_INDEX_NESTED_ARRAY_MAP_FIELDS) __defineHiddenWritable(dest, name, cloneNestedArrayMap(src[name]));
1287
+ for (const name of FACT_INDEX_ARRAY_FIELDS) __defineHiddenWritable(dest, name, src[name].slice());
1312
1288
  __defineHiddenWritable(dest, '__keySet', new Set(src.__keySet));
1313
1289
  __defineHiddenWritable(dest, '__keySetComplete', !!src.__keySetComplete);
1314
1290
  }
@@ -1587,18 +1563,6 @@ function mergeSinglePremiseAgendaBuckets(...buckets) {
1587
1563
  return out;
1588
1564
  }
1589
1565
 
1590
- function termContainsVar(t) {
1591
- if (t instanceof Var) return true;
1592
- if (t instanceof ListTerm) return t.elems.some(termContainsVar);
1593
- if (t instanceof OpenListTerm) return true;
1594
- if (t instanceof GraphTerm)
1595
- return t.triples.some(
1596
- (tr) =>
1597
- termContainsVar(tr.s) || termContainsVar(tr.p) || termContainsVar(tr.o),
1598
- );
1599
- return false;
1600
- }
1601
-
1602
1566
  function makeSinglePremiseAgendaIndex(forwardRules, backRules) {
1603
1567
  const index = {
1604
1568
  byPred: new Map(),
@@ -1662,7 +1626,7 @@ function getSinglePremiseAgendaCandidates(index, fact) {
1662
1626
  let exact = null;
1663
1627
  if (fact.p instanceof Iri) {
1664
1628
  const pk = fact.p.__tid;
1665
- if ((sk === null && termContainsVar(fact.s)) || (ok === null && termContainsVar(fact.o))) {
1629
+ if ((sk === null && containsVarTerm(fact.s)) || (ok === null && containsVarTerm(fact.o))) {
1666
1630
  // A fact with a variable-bearing subject/object (most importantly a
1667
1631
  // top-level variable fact such as `?S :p ?O.`) can match rules whose
1668
1632
  // premise is fixed in that position. The ordinary `(p,s)` / `(p,o)` lookup
@@ -1707,11 +1671,11 @@ function getSinglePremiseAgendaCandidates(index, fact) {
1707
1671
  // ===========================================================================
1708
1672
 
1709
1673
  function isLogImplies(p) {
1710
- return p instanceof Iri && p.value === LOG_NS + 'implies';
1674
+ return p instanceof Iri && p.value === LOG_IMPLIES_IRI;
1711
1675
  }
1712
1676
 
1713
1677
  function isLogImpliedBy(p) {
1714
- return p instanceof Iri && p.value === LOG_NS + 'impliedBy';
1678
+ return p instanceof Iri && p.value === LOG_IMPLIED_BY_IRI;
1715
1679
  }
1716
1680
 
1717
1681
  // ===========================================================================
@@ -1744,16 +1708,7 @@ function __makeGoalTable() {
1744
1708
 
1745
1709
  function __attachGoalTable(scopeCarrier, goalTable) {
1746
1710
  if (!scopeCarrier) return goalTable;
1747
- if (!hasOwn.call(scopeCarrier, 'goalTable')) {
1748
- Object.defineProperty(scopeCarrier, 'goalTable', {
1749
- value: goalTable,
1750
- enumerable: false,
1751
- writable: true,
1752
- configurable: true,
1753
- });
1754
- } else {
1755
- scopeCarrier.goalTable = goalTable;
1756
- }
1711
+ __setHiddenWritable(scopeCarrier, 'goalTable', goalTable);
1757
1712
  return goalTable;
1758
1713
  }
1759
1714
 
@@ -1808,11 +1763,10 @@ function __canStoreGoalMemo(visited, maxResults) {
1808
1763
  // Unification + substitution
1809
1764
  // ===========================================================================
1810
1765
 
1811
- function containsVarTerm(t, v) {
1812
- if (t instanceof Iri || t instanceof Literal || t instanceof Blank) return false;
1813
- if (t instanceof Var) return t.name === v;
1766
+ function containsVarTerm(t, v = null) {
1767
+ if (t instanceof Var) return v === null || t.name === v;
1814
1768
  if (t instanceof ListTerm) return t.elems.some((e) => containsVarTerm(e, v));
1815
- if (t instanceof OpenListTerm) return t.prefix.some((e) => containsVarTerm(e, v)) || t.tailVar === v;
1769
+ if (t instanceof OpenListTerm) return t.prefix.some((e) => containsVarTerm(e, v)) || v === null || t.tailVar === v;
1816
1770
  if (t instanceof GraphTerm)
1817
1771
  return t.triples.some((tr) => containsVarTerm(tr.s, v) || containsVarTerm(tr.p, v) || containsVarTerm(tr.o, v));
1818
1772
  return false;
@@ -2018,7 +1972,7 @@ function unifyOpenWithList(prefix, tailv, ys, subst) {
2018
1972
 
2019
1973
  function graphTriplesContainVars(triples) {
2020
1974
  for (const tr of triples) {
2021
- if (termContainsVar(tr.s) || termContainsVar(tr.p) || termContainsVar(tr.o)) return true;
1975
+ if (containsVarTerm(tr.s) || containsVarTerm(tr.p) || containsVarTerm(tr.o)) return true;
2022
1976
  }
2023
1977
  return false;
2024
1978
  }
@@ -2303,19 +2257,7 @@ function __tripleHasVarOrBlank(tr) {
2303
2257
  }
2304
2258
 
2305
2259
  function __builtinIsSatisfiableWhenFullyUnbound(pIriVal) {
2306
- return (
2307
- pIriVal === MATH_NS + 'sin' ||
2308
- pIriVal === MATH_NS + 'cos' ||
2309
- pIriVal === MATH_NS + 'tan' ||
2310
- pIriVal === MATH_NS + 'asin' ||
2311
- pIriVal === MATH_NS + 'acos' ||
2312
- pIriVal === MATH_NS + 'atan' ||
2313
- pIriVal === MATH_NS + 'sinh' ||
2314
- pIriVal === MATH_NS + 'cosh' ||
2315
- pIriVal === MATH_NS + 'tanh' ||
2316
- pIriVal === MATH_NS + 'degrees' ||
2317
- pIriVal === MATH_NS + 'negation'
2318
- );
2260
+ return MATH_BUILTINS_SATISFIABLE_WHEN_FULLY_UNBOUND.has(pIriVal);
2319
2261
  }
2320
2262
 
2321
2263
  function proveGoals(goals, subst, facts, backRules, depth, visited, varGen, maxResults, opts) {
@@ -2950,12 +2892,7 @@ function __proofTripleKey(tr) {
2950
2892
 
2951
2893
  function __copyProofSource(from, to) {
2952
2894
  if (from && to && Object.prototype.hasOwnProperty.call(from, '__source')) {
2953
- Object.defineProperty(to, '__source', {
2954
- value: from.__source,
2955
- enumerable: false,
2956
- writable: false,
2957
- configurable: true,
2958
- });
2895
+ __defineHiddenValue(to, '__source', from.__source);
2959
2896
  }
2960
2897
  return to;
2961
2898
  }
@@ -2967,12 +2904,7 @@ function __annotateProofVarSourceNames(rule) {
2967
2904
  const m = /^(.*)__\d+$/.exec(name);
2968
2905
  sourceNames[name] = m ? m[1] : name;
2969
2906
  }
2970
- Object.defineProperty(rule, '__proofVarSourceNames', {
2971
- value: sourceNames,
2972
- enumerable: false,
2973
- writable: false,
2974
- configurable: true,
2975
- });
2907
+ __defineHiddenValue(rule, '__proofVarSourceNames', sourceNames);
2976
2908
  return rule;
2977
2909
  }
2978
2910
 
@@ -3178,45 +3110,16 @@ function forwardChain(facts, forwardRules, backRules, onDerived /* optional */,
3178
3110
  // until a scoped snapshot exists (or a given closure level is reached).
3179
3111
  // Helper functions are module-scoped: __computeForwardRuleScopedSkipInfo, etc.
3180
3112
  function setScopedSnapshot(snap, level) {
3181
- if (!hasOwn.call(facts, '__scopedSnapshot')) {
3182
- Object.defineProperty(facts, '__scopedSnapshot', {
3183
- value: snap,
3184
- enumerable: false,
3185
- writable: true,
3186
- configurable: true,
3187
- });
3188
- } else {
3189
- facts.__scopedSnapshot = snap;
3190
- }
3191
-
3192
- if (!hasOwn.call(facts, '__scopedClosureLevel')) {
3193
- Object.defineProperty(facts, '__scopedClosureLevel', {
3194
- value: level,
3195
- enumerable: false,
3196
- writable: true,
3197
- configurable: true,
3198
- });
3199
- } else {
3200
- facts.__scopedClosureLevel = level;
3201
- }
3113
+ __setHiddenWritable(facts, '__scopedSnapshot', snap);
3114
+ __setHiddenWritable(facts, '__scopedClosureLevel', level);
3202
3115
  }
3203
3116
 
3204
3117
  function makeScopedSnapshot() {
3205
3118
  const snap = facts.slice();
3206
3119
  cloneFactIndexesForSnapshot(facts, snap);
3207
- Object.defineProperty(snap, '__scopedSnapshot', {
3208
- value: snap,
3209
- enumerable: false,
3210
- writable: true,
3211
- configurable: true,
3212
- });
3120
+ __defineHiddenWritable(snap, '__scopedSnapshot', snap);
3213
3121
  // Propagate closure level so nested scoped builtins can see it.
3214
- Object.defineProperty(snap, '__scopedClosureLevel', {
3215
- value: scopedClosureLevel,
3216
- enumerable: false,
3217
- writable: true,
3218
- configurable: true,
3219
- });
3122
+ __defineHiddenWritable(snap, '__scopedClosureLevel', scopedClosureLevel);
3220
3123
  return snap;
3221
3124
  }
3222
3125
 
@@ -3564,36 +3467,12 @@ function __withScopedSnapshotForQueries(facts, fn) {
3564
3467
  // Create a frozen snapshot of the saturated closure.
3565
3468
  const snap = facts.slice();
3566
3469
  ensureFactIndexes(snap);
3567
- Object.defineProperty(snap, '__scopedSnapshot', {
3568
- value: snap,
3569
- enumerable: false,
3570
- writable: true,
3571
- configurable: true,
3572
- });
3573
- Object.defineProperty(snap, '__scopedClosureLevel', {
3574
- value: Number.MAX_SAFE_INTEGER,
3575
- enumerable: false,
3576
- writable: true,
3577
- configurable: true,
3578
- });
3470
+ __defineHiddenWritable(snap, '__scopedSnapshot', snap);
3471
+ __defineHiddenWritable(snap, '__scopedClosureLevel', Number.MAX_SAFE_INTEGER);
3579
3472
 
3580
3473
  // Ensure the live facts array exposes the snapshot/level for builtins.
3581
- if (!hasOwn.call(facts, '__scopedSnapshot')) {
3582
- Object.defineProperty(facts, '__scopedSnapshot', {
3583
- value: null,
3584
- enumerable: false,
3585
- writable: true,
3586
- configurable: true,
3587
- });
3588
- }
3589
- if (!hasOwn.call(facts, '__scopedClosureLevel')) {
3590
- Object.defineProperty(facts, '__scopedClosureLevel', {
3591
- value: 0,
3592
- enumerable: false,
3593
- writable: true,
3594
- configurable: true,
3595
- });
3596
- }
3474
+ __setHiddenWritable(facts, '__scopedSnapshot', null);
3475
+ __setHiddenWritable(facts, '__scopedClosureLevel', 0);
3597
3476
 
3598
3477
  facts.__scopedSnapshot = snap;
3599
3478
  facts.__scopedClosureLevel = Number.MAX_SAFE_INTEGER;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.26.3",
3
+ "version": "1.26.4",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [