eyeling 1.16.1 → 1.16.3

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/builtins.js CHANGED
@@ -282,7 +282,7 @@ function termToJsString(t) {
282
282
  if (t instanceof Iri) return t.value;
283
283
  if (!(t instanceof Literal)) return null;
284
284
 
285
- const [lex, _dt] = literalParts(t.value);
285
+ const [lex] = literalParts(t.value);
286
286
 
287
287
  if (isQuotedLexical(lex)) {
288
288
  // Interpret N3/Turtle string escapes (\" \n \uXXXX \UXXXXXXXX …)
@@ -304,7 +304,7 @@ function termToJsStringDecoded(t) {
304
304
  // Like termToJsString, but for short literals it *also* interprets escapes
305
305
  // (\" \n \uXXXX …) by attempting JSON.parse on the quoted lexical form.
306
306
  if (!(t instanceof Literal)) return null;
307
- const [lex, _dt] = literalParts(t.value);
307
+ const [lex] = literalParts(t.value);
308
308
 
309
309
  // Long strings: """ ... """ are taken verbatim.
310
310
  if (lex.length >= 6 && lex.startsWith('"""') && lex.endsWith('"""')) {
@@ -315,7 +315,7 @@ function termToJsStringDecoded(t) {
315
315
  if (lex.length >= 2 && lex[0] === '"' && lex[lex.length - 1] === '"') {
316
316
  try {
317
317
  return JSON.parse(lex);
318
- } catch (_e) {
318
+ } catch {
319
319
  /* fall through */
320
320
  }
321
321
  return stripQuotes(lex);
@@ -380,13 +380,13 @@ function compileSwapRegex(pattern, extraFlags) {
380
380
  const flags = (extraFlags || '') + (needU ? 'u' : '');
381
381
  try {
382
382
  return new RegExp(pattern, flags);
383
- } catch (_e) {
383
+ } catch {
384
384
  if (needU) {
385
385
  const p2 = sanitizeForUnicodeMode(pattern);
386
386
  if (p2 !== pattern) {
387
387
  try {
388
388
  return new RegExp(p2, flags);
389
- } catch (_e2) {}
389
+ } catch {}
390
390
  }
391
391
  }
392
392
  return null;
@@ -1408,7 +1408,7 @@ function hashLiteralTerm(t, algo) {
1408
1408
  try {
1409
1409
  const digest = nodeCrypto.createHash(algo).update(input, 'utf8').digest('hex');
1410
1410
  return internLiteral(JSON.stringify(digest));
1411
- } catch (_e) {
1411
+ } catch {
1412
1412
  return null;
1413
1413
  }
1414
1414
  }
@@ -2605,7 +2605,7 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
2605
2605
 
2606
2606
  const results = [];
2607
2607
  for (const el of inputList) {
2608
- const yvar = new Var('_mapY');
2608
+ const yvar = new Var('mapY');
2609
2609
  const goal2 = new Triple(el, pred, yvar);
2610
2610
  const sols = proveGoals([goal2], subst, facts, backRules, depth + 1, [], varGen);
2611
2611
 
package/lib/cli.js CHANGED
@@ -153,7 +153,7 @@ function main() {
153
153
  }
154
154
 
155
155
  if (showAst) {
156
- function astReplacer(_key, value) {
156
+ function astReplacer(unusedJsonKey, value) {
157
157
  if (value instanceof Set) return Array.from(value);
158
158
  if (value && typeof value === 'object' && value.constructor) {
159
159
  const t = value.constructor.name;
@@ -188,10 +188,12 @@ function main() {
188
188
  // collect log:outputString triples from the instantiated query conclusions.
189
189
  let outTriples;
190
190
  if (hasQueries) {
191
- const res = engine.forwardChainAndCollectLogQueryConclusions(facts, frules, brules, qrules);
191
+ const res = engine.forwardChainAndCollectLogQueryConclusions(facts, frules, brules, qrules, null, {
192
+ captureExplanations: engine.getProofCommentsEnabled(),
193
+ });
192
194
  outTriples = res.queryTriples;
193
195
  } else {
194
- engine.forwardChain(facts, frules, brules);
196
+ engine.forwardChain(facts, frules, brules, null, { captureExplanations: false });
195
197
  outTriples = facts;
196
198
  }
197
199
 
@@ -293,7 +295,7 @@ function main() {
293
295
  engine.setTracePrefixes(outPrefixes);
294
296
 
295
297
  const entries = Object.entries(outPrefixes.map)
296
- .filter(([_p, base]) => !!base)
298
+ .filter(([, base]) => !!base)
297
299
  .sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));
298
300
 
299
301
  for (const [pfx, base] of entries) {
@@ -302,15 +304,21 @@ function main() {
302
304
  }
303
305
  if (entries.length) console.log();
304
306
 
305
- engine.forwardChain(facts, frules, brules, (df) => {
306
- if (engine.getProofCommentsEnabled()) {
307
- engine.printExplanation(df, outPrefixes);
308
- console.log(engine.tripleToN3(df.fact, outPrefixes));
309
- console.log();
310
- } else {
311
- console.log(engine.tripleToN3(df.fact, outPrefixes));
312
- }
313
- });
307
+ engine.forwardChain(
308
+ facts,
309
+ frules,
310
+ brules,
311
+ (df) => {
312
+ if (engine.getProofCommentsEnabled()) {
313
+ engine.printExplanation(df, outPrefixes);
314
+ console.log(engine.tripleToN3(df.fact, outPrefixes));
315
+ console.log();
316
+ } else {
317
+ console.log(engine.tripleToN3(df.fact, outPrefixes));
318
+ }
319
+ },
320
+ { captureExplanations: engine.getProofCommentsEnabled() },
321
+ );
314
322
  return;
315
323
  }
316
324
 
@@ -330,7 +338,9 @@ function main() {
330
338
  outTriples = res.queryTriples;
331
339
  outDerived = res.queryDerived;
332
340
  } else {
333
- derived = engine.forwardChain(facts, frules, brules);
341
+ derived = engine.forwardChain(facts, frules, brules, null, {
342
+ captureExplanations: engine.getProofCommentsEnabled(),
343
+ });
334
344
  outDerived = derived;
335
345
  outTriples = derived.map((df) => df.fact);
336
346
  }
package/lib/deref.js CHANGED
@@ -359,7 +359,7 @@ function parseSemanticsToFormula(text, baseIri) {
359
359
  const parser = new Parser(toks);
360
360
  if (typeof baseIri === 'string' && baseIri) parser.prefixes.setBase(baseIri);
361
361
 
362
- const [_prefixes, triples, frules, brules] = parser.parseDocument();
362
+ const [, triples, frules, brules] = parser.parseDocument();
363
363
 
364
364
  const all = triples.slice();
365
365