eyeling 1.23.1 → 1.23.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/HANDBOOK.md CHANGED
@@ -1874,7 +1874,7 @@ echo '@prefix : <http://example.org/> .
1874
1874
  { ?x a :Man } => { ?x a :Mortal } .' | npx eyeling
1875
1875
  ```
1876
1876
 
1877
- You can also pass one or more file paths/URLs, or `-` to read explicitly from stdin. When multiple inputs are given, Eyeling parses each source separately, merges the parsed ASTs, and then runs one reasoning pass over the combined facts and rules. This avoids constructing one giant N3 source string.
1877
+ You can also pass one or more file paths/URLs, or `-` to read explicitly from stdin. When multiple inputs are given, Eyeling parses each source separately, merges the parsed ASTs, and then runs one reasoning pass over the combined facts and rules. This avoids constructing one giant N3 source string. During the merge path, parse-only artifacts such as source text and token arrays are discarded after the AST has been built, except while formatting syntax errors or when an internal caller explicitly asks to keep those artifacts for debugging.
1878
1878
 
1879
1879
  Show the available options:
1880
1880
 
@@ -1891,9 +1891,17 @@ A few practical defaults are worth remembering:
1891
1891
  Custom builtins can be loaded explicitly from the CLI:
1892
1892
 
1893
1893
  ```bash
1894
- npx eyeling --builtin lib/builtin-sudoku.js examples/sudoku.n3
1894
+ npx eyeling --builtin examples/builtin/sudoku.js examples/sudoku.n3
1895
1895
  ```
1896
1896
 
1897
+ Example-specific builtins live under `examples/builtin/`. When the examples test runner sees `examples/builtin/<stem>.js` next to `examples/<stem>.n3`, it auto-loads that builtin for the matching example by running the same command shape a user would run manually:
1898
+
1899
+ ```bash
1900
+ node eyeling.js --builtin examples/builtin/queens.js examples/queens.n3
1901
+ ```
1902
+
1903
+ Examples that do not need a custom builtin should not add a matching file under `examples/builtin/`. Examples that do need one should ship it there and let the examples test runner load it uniformly. For example, `examples/sudoku.n3` is paired with `examples/builtin/sudoku.js`, and `examples/queens.n3` is paired with `examples/builtin/queens.js`.
1904
+
1897
1905
  ### 14.2 The bundled Node CLI/runtime (`eyeling.js`)
1898
1906
 
1899
1907
  The bundle contains the whole engine. The CLI path is the “canonical behavior”:
@@ -2057,6 +2065,8 @@ console.log(out);
2057
2065
 
2058
2066
  In a source list, each source is parsed with its own blank-node scope and optional base IRI. That means the same explicit blank label, such as `_:x`, in two different sources does not accidentally become the same blank node after merging. Prefix declarations are merged mainly for readable output; IRI expansion has already happened while each source was parsed.
2059
2067
 
2068
+ For large inputs, the source-list path is also the preferred memory shape: each source is lexed and parsed independently, then Eyeling keeps the merged facts/rules rather than retaining the original source strings and token arrays. The parser still needs one JavaScript string per source, so source splitting is not a streaming parser, but it avoids both a single giant concatenated N3 string and long-lived token arrays after parsing.
2069
+
2060
2070
  For RDF/JS facts, the graph must be the default graph. Named-graph quads are rejected.
2061
2071
 
2062
2072
  If you already have rules in structured form, Eyeling rule objects can be passed directly in the API:
@@ -2374,14 +2384,16 @@ That API keeps the extension boundary explicit: custom builtins get the operatio
2374
2384
 
2375
2385
  ### 16.6 A shipped example: the Sudoku builtin
2376
2386
 
2377
- The repository now ships a Sudoku builtin module (`lib/builtin-sudoku.js`) and a matching example program (`sudoku.n3`).
2387
+ The repository ships a Sudoku example program (`examples/sudoku.n3`) together with its example-specific builtin module (`examples/builtin/sudoku.js`).
2378
2388
 
2379
- So this works out of the box:
2389
+ Run it explicitly like this:
2380
2390
 
2381
2391
  ```bash
2382
- eyeling sudoku.n3
2392
+ eyeling --builtin examples/builtin/sudoku.js examples/sudoku.n3
2383
2393
  ```
2384
2394
 
2395
+ `npm run test:examples` uses the same convention automatically: when it sees `examples/builtin/sudoku.js` next to `examples/sudoku.n3`, it loads that module for the Sudoku example.
2396
+
2385
2397
  That example is useful for two reasons:
2386
2398
 
2387
2399
  - it shows a realistic domain-specific builtin implemented outside the core builtin switchboard
@@ -2565,10 +2577,10 @@ It also supports **custom builtin modules**.
2565
2577
  - From JavaScript: `reason({ builtinModules: ['./my-builtins.js'] }, input)`
2566
2578
  - Programmatically in-process: `registerBuiltin(...)`, `registerBuiltinModule(...)`, `loadBuiltinModule(...)`
2567
2579
 
2568
- A concrete shipped example is the Sudoku builtin and the root-level `sudoku.n3` program:
2580
+ A concrete shipped example is the Sudoku builtin paired with `examples/sudoku.n3`:
2569
2581
 
2570
2582
  ```bash
2571
- eyeling sudoku.n3
2583
+ eyeling --builtin examples/builtin/sudoku.js examples/sudoku.n3
2572
2584
  ```
2573
2585
 
2574
2586
  References: