eyeling 1.8.0 → 1.8.2
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/README.md +6 -7
- package/eyeling.js +19 -16
- package/package.json +1 -1
- package/test/api.test.js +27 -7
- package/test/examples.test.js +3 -1
- package/test/package.test.js +6 -2
package/README.md
CHANGED
|
@@ -114,15 +114,14 @@ npm run test:packlist
|
|
|
114
114
|
Usage: eyeling [options] <file.n3>
|
|
115
115
|
|
|
116
116
|
Options:
|
|
117
|
+
-a, --ast Print parsed AST as JSON and exit.
|
|
118
|
+
-e, --enforce-https Rewrite http:// IRIs to https:// for log dereferencing builtins.
|
|
117
119
|
-h, --help Show this help and exit.
|
|
118
|
-
-v, --version Print version and exit.
|
|
119
120
|
-p, --proof-comments Enable proof explanations.
|
|
120
|
-
-
|
|
121
|
+
-r, --strings Print log:outputString strings (ordered by key) instead of N3 output.
|
|
121
122
|
-s, --super-restricted Disable all builtins except => and <=.
|
|
122
|
-
-
|
|
123
|
-
--
|
|
124
|
-
--enforce-https Rewrite http:// IRIs to https:// for log dereferencing builtins.
|
|
125
|
-
--stream Stream derived triples as soon as they are derived.
|
|
123
|
+
-t, --stream Stream derived triples as soon as they are derived.
|
|
124
|
+
-v, --version Print version and exit.
|
|
126
125
|
```
|
|
127
126
|
|
|
128
127
|
By default, `eyeling`:
|
|
@@ -136,7 +135,7 @@ By default, `eyeling`:
|
|
|
136
135
|
|
|
137
136
|
For each newly derived triple, `eyeling` prints:
|
|
138
137
|
|
|
139
|
-
1. a proof-style comment block explaining why the triple holds
|
|
138
|
+
1. a proof-style comment block explaining why the triple holds, and then
|
|
140
139
|
2. the triple itself in N3/Turtle syntax.
|
|
141
140
|
|
|
142
141
|
The proof comments are compact “local justifications” per derived triple (not a single exported global proof tree).
|
package/eyeling.js
CHANGED
|
@@ -7427,7 +7427,17 @@ try {
|
|
|
7427
7427
|
|
|
7428
7428
|
function main() {
|
|
7429
7429
|
// Drop "node" and script name; keep only user-provided args
|
|
7430
|
-
|
|
7430
|
+
// Expand combined short options: -pt == -p -t
|
|
7431
|
+
const argvRaw = process.argv.slice(2);
|
|
7432
|
+
const argv = [];
|
|
7433
|
+
for (const a of argvRaw) {
|
|
7434
|
+
if (a === '-' || !a.startsWith('-') || a.startsWith('--') || a.length === 2) {
|
|
7435
|
+
argv.push(a);
|
|
7436
|
+
continue;
|
|
7437
|
+
}
|
|
7438
|
+
// Combined short flags (no flag in eyeling takes a value)
|
|
7439
|
+
for (const ch of a.slice(1)) argv.push('-' + ch);
|
|
7440
|
+
}
|
|
7431
7441
|
const prog = String(process.argv[1] || 'eyeling')
|
|
7432
7442
|
.split(/[\/]/)
|
|
7433
7443
|
.pop();
|
|
@@ -7436,15 +7446,14 @@ function main() {
|
|
|
7436
7446
|
const msg =
|
|
7437
7447
|
`Usage: ${prog} [options] <file.n3>\n\n` +
|
|
7438
7448
|
`Options:\n` +
|
|
7449
|
+
` -a, --ast Print parsed AST as JSON and exit.\n` +
|
|
7450
|
+
` -e, --enforce-https Rewrite http:// IRIs to https:// for log dereferencing builtins.\n` +
|
|
7439
7451
|
` -h, --help Show this help and exit.\n` +
|
|
7440
|
-
` -v, --version Print version and exit.\n` +
|
|
7441
7452
|
` -p, --proof-comments Enable proof explanations.\n` +
|
|
7442
|
-
` -
|
|
7453
|
+
` -r, --strings Print log:outputString strings (ordered by key) instead of N3 output.\n` +
|
|
7443
7454
|
` -s, --super-restricted Disable all builtins except => and <=.\n` +
|
|
7444
|
-
` -
|
|
7445
|
-
` --
|
|
7446
|
-
` --enforce-https Rewrite http:// IRIs to https:// for log dereferencing builtins.\n` +
|
|
7447
|
-
` --stream Stream derived triples as soon as they are derived.\n`;
|
|
7455
|
+
` -t, --stream Stream derived triples as soon as they are derived.\n` +
|
|
7456
|
+
` -v, --version Print version and exit.\n`;
|
|
7448
7457
|
(toStderr ? console.error : console.log)(msg);
|
|
7449
7458
|
}
|
|
7450
7459
|
|
|
@@ -7465,11 +7474,11 @@ function main() {
|
|
|
7465
7474
|
|
|
7466
7475
|
const showAst = argv.includes('--ast') || argv.includes('-a');
|
|
7467
7476
|
|
|
7468
|
-
const outputStringsMode = argv.includes('--strings');
|
|
7469
|
-
const streamMode = argv.includes('--stream');
|
|
7477
|
+
const outputStringsMode = argv.includes('--strings') || argv.includes('-r');
|
|
7478
|
+
const streamMode = argv.includes('--stream') || argv.includes('-t');
|
|
7470
7479
|
|
|
7471
7480
|
// --enforce-https: rewrite http:// -> https:// for log dereferencing builtins
|
|
7472
|
-
if (argv.includes('--enforce-https')) {
|
|
7481
|
+
if (argv.includes('--enforce-https') || argv.includes('-e')) {
|
|
7473
7482
|
enforceHttpsEnabled = true;
|
|
7474
7483
|
}
|
|
7475
7484
|
|
|
@@ -7478,12 +7487,6 @@ function main() {
|
|
|
7478
7487
|
proofCommentsEnabled = true;
|
|
7479
7488
|
}
|
|
7480
7489
|
|
|
7481
|
-
// --no-proof-comments / -n: disable proof explanations (default)
|
|
7482
|
-
// Keep this after --proof-comments so -n wins if both are present.
|
|
7483
|
-
if (argv.includes('--no-proof-comments') || argv.includes('-n')) {
|
|
7484
|
-
proofCommentsEnabled = false;
|
|
7485
|
-
}
|
|
7486
|
-
|
|
7487
7490
|
// --super-restricted / -s: disable all builtins except => / <=
|
|
7488
7491
|
if (argv.includes('--super-restricted') || argv.includes('-s')) {
|
|
7489
7492
|
superRestrictedMode = true;
|
package/package.json
CHANGED
package/test/api.test.js
CHANGED
|
@@ -7,7 +7,9 @@ const { reason } = require('..');
|
|
|
7
7
|
const { reasonStream } = require('../eyeling.js');
|
|
8
8
|
|
|
9
9
|
const TTY = process.stdout.isTTY;
|
|
10
|
-
const C = TTY
|
|
10
|
+
const C = TTY
|
|
11
|
+
? { g: '\x1b[32m', r: '\x1b[31m', y: '\x1b[33m', dim: '\x1b[2m', n: '\x1b[0m' }
|
|
12
|
+
: { g: '', r: '', y: '', dim: '', n: '' };
|
|
11
13
|
|
|
12
14
|
function ok(msg) {
|
|
13
15
|
console.log(`${C.g}OK${C.n} ${msg}`);
|
|
@@ -353,7 +355,10 @@ ${U('a')} ${U('p')} ${U('b')}.
|
|
|
353
355
|
name: '17 heavier reachability: branching graph reach closure',
|
|
354
356
|
opt: { proofComments: false, maxBuffer: 200 * 1024 * 1024 },
|
|
355
357
|
input: reachabilityGraphN3(12),
|
|
356
|
-
expect: [
|
|
358
|
+
expect: [
|
|
359
|
+
new RegExp(`${EX}g0>\\s+<${EX}reach>\\s+<${EX}g12>\\s*\\.`),
|
|
360
|
+
new RegExp(`${EX}g2>\\s+<${EX}reach>\\s+<${EX}g10>\\s*\\.`),
|
|
361
|
+
],
|
|
357
362
|
},
|
|
358
363
|
{
|
|
359
364
|
name: '18 heavier taxonomy: diamond subclass inference',
|
|
@@ -381,7 +386,10 @@ ${U('a')} ${U('p')} ${U('b')}.
|
|
|
381
386
|
name: '21 heavier equivalence: sameAs propagation (with symmetric sameAs)',
|
|
382
387
|
opt: { proofComments: false },
|
|
383
388
|
input: sameAsN3(),
|
|
384
|
-
expect: [
|
|
389
|
+
expect: [
|
|
390
|
+
new RegExp(`${EX}b>\\s+<${EX}p>\\s+<${EX}o>\\s*\\.`),
|
|
391
|
+
new RegExp(`${EX}b>\\s+<${EX}sameAs>\\s+<${EX}a>\\s*\\.`),
|
|
392
|
+
],
|
|
385
393
|
},
|
|
386
394
|
{
|
|
387
395
|
name: '22 heavier closure: transitive property via generic rule',
|
|
@@ -393,7 +401,10 @@ ${U('c')} ${U('sub')} ${U('d')}.
|
|
|
393
401
|
${U('d')} ${U('sub')} ${U('e')}.
|
|
394
402
|
${transitiveClosureN3('sub')}
|
|
395
403
|
`,
|
|
396
|
-
expect: [
|
|
404
|
+
expect: [
|
|
405
|
+
new RegExp(`${EX}a>\\s+<${EX}sub>\\s+<${EX}e>\\s*\\.`),
|
|
406
|
+
new RegExp(`${EX}b>\\s+<${EX}sub>\\s+<${EX}d>\\s*\\.`),
|
|
407
|
+
],
|
|
397
408
|
},
|
|
398
409
|
{
|
|
399
410
|
name: '23 heavier social: symmetric + reachFriend closure',
|
|
@@ -408,7 +419,10 @@ ${transitiveClosureN3('sub')}
|
|
|
408
419
|
name: '24 heavier volume: 400 facts, simple rewrite rule p -> q',
|
|
409
420
|
opt: { proofComments: false, maxBuffer: 200 * 1024 * 1024 },
|
|
410
421
|
input: bigFactsN3(400),
|
|
411
|
-
expect: [
|
|
422
|
+
expect: [
|
|
423
|
+
new RegExp(`${EX}x>\\s+<${EX}q>\\s+<${EX}o0>\\s*\\.`),
|
|
424
|
+
new RegExp(`${EX}x>\\s+<${EX}q>\\s+<${EX}o399>\\s*\\.`),
|
|
425
|
+
],
|
|
412
426
|
},
|
|
413
427
|
{
|
|
414
428
|
name: '25 heavier negative entailment: batch + forbidden => false (expect exit 2)',
|
|
@@ -494,7 +508,10 @@ ${U('c')} ${U('p')} ${U('d')}.
|
|
|
494
508
|
|
|
495
509
|
{ ?s ${U('p')} ?o. } => { ?s ${U('q')} ?o. }.
|
|
496
510
|
`,
|
|
497
|
-
expect: [
|
|
511
|
+
expect: [
|
|
512
|
+
new RegExp(`${EX}a>\\s+<${EX}q>\\s+<${EX}b>\\s*\\.`),
|
|
513
|
+
new RegExp(`${EX}c>\\s+<${EX}q>\\s+<${EX}d>\\s*\\.`),
|
|
514
|
+
],
|
|
498
515
|
},
|
|
499
516
|
|
|
500
517
|
{
|
|
@@ -540,7 +557,10 @@ ${U('s')} ${U('p')} ${U('o')}.
|
|
|
540
557
|
|
|
541
558
|
{ ${U('s')} ${U('p')} ${U('o')}. } => { ${U('s')} ${U('q')} ${U('o')}. ${U('s')} ${U('r')} ${U('o')}. }.
|
|
542
559
|
`,
|
|
543
|
-
expect: [
|
|
560
|
+
expect: [
|
|
561
|
+
new RegExp(`${EX}s>\\s+<${EX}q>\\s+<${EX}o>\\s*\\.`),
|
|
562
|
+
new RegExp(`${EX}s>\\s+<${EX}r>\\s+<${EX}o>\\s*\\.`),
|
|
563
|
+
],
|
|
544
564
|
},
|
|
545
565
|
|
|
546
566
|
{
|
package/test/examples.test.js
CHANGED
|
@@ -7,7 +7,9 @@ const path = require('node:path');
|
|
|
7
7
|
const cp = require('node:child_process');
|
|
8
8
|
|
|
9
9
|
const TTY = process.stdout.isTTY;
|
|
10
|
-
const C = TTY
|
|
10
|
+
const C = TTY
|
|
11
|
+
? { g: '\x1b[32m', r: '\x1b[31m', y: '\x1b[33m', dim: '\x1b[2m', n: '\x1b[0m' }
|
|
12
|
+
: { g: '', r: '', y: '', dim: '', n: '' };
|
|
11
13
|
const msTag = (ms) => `${C.dim}(${ms} ms)${C.n}`;
|
|
12
14
|
|
|
13
15
|
function ok(msg) {
|
package/test/package.test.js
CHANGED
|
@@ -7,7 +7,9 @@ const path = require('node:path');
|
|
|
7
7
|
const cp = require('node:child_process');
|
|
8
8
|
|
|
9
9
|
const TTY = process.stdout.isTTY;
|
|
10
|
-
const C = TTY
|
|
10
|
+
const C = TTY
|
|
11
|
+
? { g: '\x1b[32m', r: '\x1b[31m', y: '\x1b[33m', dim: '\x1b[2m', n: '\x1b[0m' }
|
|
12
|
+
: { g: '', r: '', y: '', dim: '', n: '' };
|
|
11
13
|
|
|
12
14
|
function info(msg) {
|
|
13
15
|
console.log(`${C.y}==${C.n} ${msg}`);
|
|
@@ -110,7 +112,9 @@ function main() {
|
|
|
110
112
|
ok('API works');
|
|
111
113
|
|
|
112
114
|
info('CLI smoke test');
|
|
113
|
-
const bin = isWin()
|
|
115
|
+
const bin = isWin()
|
|
116
|
+
? path.join(tmp, 'node_modules', '.bin', 'eyeling.cmd')
|
|
117
|
+
: path.join(tmp, 'node_modules', '.bin', 'eyeling');
|
|
114
118
|
runChecked(bin, ['-v'], { cwd: tmp, stdio: 'inherit' });
|
|
115
119
|
ok('CLI works');
|
|
116
120
|
|