eyeling 1.22.6 → 1.22.8
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/HANDBOOK.md +245 -0
- package/dist/browser/eyeling.browser.js +188 -33
- package/examples/act-alarm-bit-interoperability.n3 +180 -0
- package/examples/act-barley-seed-lineage.n3 +565 -0
- package/examples/act-docking-abort.n3 +285 -0
- package/examples/act-gravity-mediator-witness.n3 +235 -0
- package/examples/act-isolation-breach.n3 +354 -0
- package/examples/act-photosynthetic-exciton-transfer.n3 +245 -0
- package/examples/act-sensor-memory-reset.n3 +190 -0
- package/examples/act-tunnel-junction-wake-switch.n3 +225 -0
- package/examples/act-yeast-self-reproduction.n3 +248 -0
- package/examples/complex-matrix-stability.n3 +288 -0
- package/examples/deck/act-barley-seed-lineage.md +593 -0
- package/examples/fundamental-theorem-arithmetic.n3 +244 -0
- package/examples/harborsmr.n3 +233 -0
- package/examples/meta-rule-audit.n3 +135 -0
- package/examples/output/act-alarm-bit-interoperability.txt +20 -0
- package/examples/output/act-barley-seed-lineage.txt +25 -0
- package/examples/output/act-docking-abort.txt +22 -0
- package/examples/output/act-gravity-mediator-witness.txt +24 -0
- package/examples/output/act-isolation-breach.txt +27 -0
- package/examples/output/act-photosynthetic-exciton-transfer.txt +20 -0
- package/examples/output/act-sensor-memory-reset.txt +20 -0
- package/examples/output/act-tunnel-junction-wake-switch.txt +21 -0
- package/examples/output/act-yeast-self-reproduction.txt +23 -0
- package/examples/output/complex-matrix-stability.txt +14 -0
- package/examples/output/fundamental-theorem-arithmetic.txt +15 -0
- package/examples/output/get-uuid.n3 +2 -2
- package/examples/output/harborsmr.txt +20 -0
- package/examples/output/meta-rule-audit.n3 +44 -0
- package/examples/output/theory-diff.n3 +22 -0
- package/examples/theory-diff.n3 +125 -0
- package/eyeling.js +188 -33
- package/lib/builtins.js +18 -1
- package/lib/cli.js +31 -5
- package/lib/engine.js +139 -27
- package/package.json +1 -1
- package/test/api.test.js +100 -0
package/package.json
CHANGED
package/test/api.test.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const assert = require('node:assert/strict');
|
|
4
|
+
const fs = require('node:fs');
|
|
4
5
|
const path = require('node:path');
|
|
5
6
|
const { spawnSync } = require('node:child_process');
|
|
6
7
|
const ROOT = path.resolve(__dirname, '..');
|
|
@@ -2236,6 +2237,105 @@ _:x :hates { _:foo :making :mess }.
|
|
|
2236
2237
|
`,
|
|
2237
2238
|
expect: [/^:result\s+:is\s+\{[\s\S]*\?A\s+a\s+\?B\s*\.[\s\S]*\?B\s+rdfs:subClassOf\s+\?C\s*\.[\s\S]*\}\s*\./m],
|
|
2238
2239
|
},
|
|
2240
|
+
{
|
|
2241
|
+
name: 'regression: log:rawType accepts quoted variables found via log:includes',
|
|
2242
|
+
opt: { proofComments: false },
|
|
2243
|
+
input: `@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
2244
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
2245
|
+
@prefix : <http://example.org/ns#> .
|
|
2246
|
+
|
|
2247
|
+
{ ?X :likes ?Y } <= { ?X :loves ?Y }.
|
|
2248
|
+
|
|
2249
|
+
{
|
|
2250
|
+
?X log:impliedBy ?Y .
|
|
2251
|
+
?X log:includes { ?Z1 :likes ?Z2 }.
|
|
2252
|
+
?Z1 log:rawType ?T.
|
|
2253
|
+
}
|
|
2254
|
+
=>
|
|
2255
|
+
{
|
|
2256
|
+
:test :is true .
|
|
2257
|
+
}.
|
|
2258
|
+
`,
|
|
2259
|
+
expect: [/^:test\s+:is\s+true\s*\./m],
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
name: 'regression: log:semantics body alpha-renaming does not refire blank-head rule forever',
|
|
2263
|
+
async run() {
|
|
2264
|
+
const os = require('node:os');
|
|
2265
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'eyeling-alpha-fire-'));
|
|
2266
|
+
const mainPath = path.join(tmp, 'main.n3');
|
|
2267
|
+
const examplePath = path.join(tmp, 'example.n3');
|
|
2268
|
+
|
|
2269
|
+
fs.writeFileSync(
|
|
2270
|
+
mainPath,
|
|
2271
|
+
`@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
2272
|
+
@prefix : <urn:test#>.
|
|
2273
|
+
|
|
2274
|
+
<> :facts <./example.n3> .
|
|
2275
|
+
|
|
2276
|
+
{ ?X :load ?S } <= { <> :facts ?F . ?F log:semantics ?S . }.
|
|
2277
|
+
|
|
2278
|
+
{ ?This :load ?S . } => { [] a :Test . }.
|
|
2279
|
+
`,
|
|
2280
|
+
'utf8',
|
|
2281
|
+
);
|
|
2282
|
+
|
|
2283
|
+
fs.writeFileSync(
|
|
2284
|
+
examplePath,
|
|
2285
|
+
`@prefix : <urn:test#>.
|
|
2286
|
+
{ ?A :p ?B } <= { ?A :q ?B }.
|
|
2287
|
+
`,
|
|
2288
|
+
'utf8',
|
|
2289
|
+
);
|
|
2290
|
+
|
|
2291
|
+
try {
|
|
2292
|
+
const r = spawnSync(process.execPath, [path.join(ROOT, 'bin', 'eyeling.cjs'), mainPath], {
|
|
2293
|
+
cwd: ROOT,
|
|
2294
|
+
encoding: 'utf8',
|
|
2295
|
+
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
2296
|
+
timeout: 5000,
|
|
2297
|
+
});
|
|
2298
|
+
|
|
2299
|
+
if (r.error) throw r.error;
|
|
2300
|
+
assert.equal(r.status, 0, r.stderr || `unexpected exit ${r.status}`);
|
|
2301
|
+
mustOccurExactly(r.stdout, /^_:sk_\d+\s+a\s+:Test\s*\.$/gm, 1, 'expected exactly one derived :Test witness');
|
|
2302
|
+
return r.stdout;
|
|
2303
|
+
} finally {
|
|
2304
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
2305
|
+
}
|
|
2306
|
+
},
|
|
2307
|
+
},
|
|
2308
|
+
{
|
|
2309
|
+
name: 'regression: unrelated blank bindings must not block alpha-equivalent quoted-formula matches',
|
|
2310
|
+
opt: { proofComments: false },
|
|
2311
|
+
input: `@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
2312
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
2313
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
|
|
2314
|
+
@prefix : <http://example.org/ns#> .
|
|
2315
|
+
|
|
2316
|
+
{
|
|
2317
|
+
_:b1 a :Mortal .
|
|
2318
|
+
} :because {
|
|
2319
|
+
:Socrates a :Human .
|
|
2320
|
+
:Human rdfs:subClassOf :Mortal .
|
|
2321
|
+
} .
|
|
2322
|
+
|
|
2323
|
+
<> :step {
|
|
2324
|
+
[ a :Mortal ].
|
|
2325
|
+
}.
|
|
2326
|
+
|
|
2327
|
+
{
|
|
2328
|
+
?A :step ?B .
|
|
2329
|
+
?B log:includes { ?S ?P ?O }.
|
|
2330
|
+
{ _:b2 a :Mortal } :because ?Y.
|
|
2331
|
+
}
|
|
2332
|
+
=>
|
|
2333
|
+
{
|
|
2334
|
+
:test :is true .
|
|
2335
|
+
}.
|
|
2336
|
+
`,
|
|
2337
|
+
expect: [/^:test\s+:is\s+true\s*\./m],
|
|
2338
|
+
},
|
|
2239
2339
|
];
|
|
2240
2340
|
|
|
2241
2341
|
let passed = 0;
|