eyeling 1.28.9 → 1.29.0

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 CHANGED
@@ -321,6 +321,7 @@ Import from the package root for Node.js:
321
321
  const {
322
322
  reason,
323
323
  reasonStream,
324
+ runAsync,
324
325
  reasonRdfJs,
325
326
  rdfjs,
326
327
  registerBuiltin,
@@ -328,6 +329,7 @@ const {
328
329
  registerBuiltinModule,
329
330
  loadBuiltinModule,
330
331
  listBuiltinIris,
332
+ createFactStore,
331
333
  INFERENCE_FUSE_EXIT_CODE,
332
334
  } = require('eyeling');
333
335
  ```
@@ -357,6 +359,9 @@ Useful options:
357
359
  | `args` | Extra CLI-style arguments. |
358
360
  | `maxBuffer` | Child-process output buffer limit. |
359
361
  | `builtinModules` | Custom built-in module path or paths. |
362
+ | `store` | Optional persistent store name or options object; passed through to CLI `--store`. |
363
+ | `storePath` | Optional Node.js persistent store directory. |
364
+ | `storeClear` | Clear the named persistent store before the run. |
360
365
 
361
366
  `reason()` accepts N3 text, supported RDF-JS input objects, AST bundles, and multi-source inputs.
362
367
 
@@ -427,6 +432,58 @@ Useful options:
427
432
  | `skipUnsupportedRdfJs` | Skip N3-only terms when producing RDF-JS quads. |
428
433
  | `builtinModules` | Register custom built-ins before reasoning. |
429
434
 
435
+ ### `runAsync(input, options)`
436
+
437
+ `runAsync()` is the async execution API. Without a `store` option it keeps the same in-memory behavior as `reasonStream()`, but can also normalize async RDF-JS iterables before reasoning. With `store`, Eyeling opens a named persistent fact store, adds the new explicit facts, reuses facts already present in that store, reasons over the combined closure, and writes newly inferred facts back as inferred facts.
438
+
439
+ ```js
440
+ const { runAsync } = require('eyeling');
441
+
442
+ await runAsync(input); // memory store
443
+
444
+ await runAsync(input, {
445
+ store: 'my-dataset',
446
+ });
447
+
448
+ await runAsync(input, {
449
+ store: {
450
+ name: 'my-dataset',
451
+ clear: true,
452
+ path: './.eyeling-store', // Node.js path override
453
+ },
454
+ });
455
+ ```
456
+
457
+ Persistent stores use a term dictionary plus `spo`, `pos`, and `osp` triple indexes. Exact lookup and all subject/predicate/object bound-pattern scans are available through the `FactStore` API:
458
+
459
+ ```js
460
+ const { createFactStore, rdfjs } = require('eyeling');
461
+
462
+ const store = await createFactStore({ name: 'my-dataset' });
463
+ for await (const triple of store.match(null, rdfjs.namedNode('http://example.org/p'), null)) {
464
+ console.log(triple);
465
+ }
466
+ await store.close();
467
+ ```
468
+
469
+ Node.js uses `classic-level` when it is installed and falls back to a small JSON-file key/value backend for dependency-free use and tests. Browser runtimes use IndexedDB through the same abstraction. The current synchronous `reasonStream()` path remains the default and does not open persistent storage.
470
+
471
+ CLI equivalents:
472
+
473
+ ```bash
474
+ eyeling input.n3
475
+ # memory store
476
+
477
+ eyeling input.n3 --store my-dataset
478
+ # persistent store
479
+
480
+ eyeling input.n3 --store my-dataset --store-clear
481
+ # clear persistent store first
482
+
483
+ eyeling input.n3 --store my-dataset --store-path ./.eyeling-store
484
+ # Node.js path override
485
+ ```
486
+
430
487
  ### `reasonRdfJs(input, options)`
431
488
 
432
489
  `reasonRdfJs()` returns an async iterable of derived RDF-JS quads:
@@ -929,6 +986,7 @@ CLI output, API result, proof document, RDF-JS quads, or browser result
929
986
  | `lib/entry.js` | Bundle entry that exposes public APIs and selected playground internals. |
930
987
  | `lib/cli.js` | CLI argument handling, source loading, syntax errors, stream message mode. |
931
988
  | `lib/engine.js` | Core reasoning engine, proof collection, stream APIs, RDF-JS output hooks. |
989
+ | `lib/store.js` | Optional async fact-store abstraction with memory and persistent backends. |
932
990
  | `lib/builtins.js` | Built-in predicates, custom built-in registry, helper API. |
933
991
  | `lib/lexer.js` | Lexer and compatibility normalization. |
934
992
  | `lib/parser.js` | Parser for supported N3/RDF syntax. |
@@ -973,7 +1031,7 @@ Everything else should be treated as internal unless explicitly documented.
973
1031
  ├── dist/browser/ Browser bundle and ESM wrapper
974
1032
  ├── examples/ N3 examples, RDF message inputs, and generated decks
975
1033
  ├── spec/ RDF 1.2 parser test adapter
976
- ├── test/ API, built-in, example, package, playground, and stream tests
1034
+ ├── test/ API, built-in, store, example, package, playground, and stream tests
977
1035
  ├── tools/ Build tooling
978
1036
  ├── playground.html Browser playground
979
1037
  └── demo.html Simple browser demo
@@ -1040,6 +1098,7 @@ Package scripts are defined in `package.json`.
1040
1098
  | `npm run test:manifest` | Validate example/test manifest expectations. |
1041
1099
  | `npm run test:playground` | Check playground serving headers. |
1042
1100
  | `npm run test:package` | Verify package-level behavior. |
1101
+ | `npm run test:store` | Verify memory and persistent fact-store matching. |
1043
1102
  | `npm run test:rdf12` | Run RDF 1.2 Turtle, N-Triples, N-Quads, and TriG syntax suites. |
1044
1103
  | `npm test` | Build and run the full suite. |
1045
1104