eyeling 1.24.2 → 1.24.4
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 +43 -7
- package/dist/browser/eyeling.browser.js +401 -72
- package/eyeling.js +401 -72
- package/index.js +2 -0
- package/lib/cli.js +27 -10
- package/lib/engine.js +17 -7
- package/lib/lexer.js +242 -52
- package/lib/multisource.js +9 -2
- package/lib/printing.js +106 -1
- package/package.json +2 -3
- package/see/README.md +2 -1
- package/see/examples/doc/rdf_dataset.md +26 -0
- package/see/examples/input/path_discovery.trig +1 -1
- package/see/examples/input/rdf_dataset.trig +34 -0
- package/see/examples/n3/rdf_dataset.n3 +34 -0
- package/see/examples/output/rdf_dataset.md +54 -0
- package/see/examples/rdf_dataset.js +1512 -0
- package/see/see.js +27 -3
- package/test/api.test.js +68 -2
- package/test/see.test.js +0 -0
- package/tools/bundle.js +0 -0
- package/test/n3gen.test.js +0 -166
- package/tools/n3gen.js +0 -2166
package/HANDBOOK.md
CHANGED
|
@@ -237,7 +237,9 @@ The lexer turns the input into tokens like:
|
|
|
237
237
|
|
|
238
238
|
Parsing becomes dramatically simpler because tokenization already decided where strings end, where numbers are, and so on.
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
By default, Eyeling parses ordinary N3. Selected RDF/TriG surface syntax is accepted only when RDF compatibility is explicitly enabled with `eyeling -r file.trig`, `eyeling --rdf file.trig`, or API option `{ rdf: true }`. In that mode, the lexer normalizes RDF/TriG input syntax to ordinary N3 graph terms before normal parsing, and the printer emits RDF/TriG-compatible output where feasible. Eyeling remains an N3 reasoner; this is syntax compatibility, not a separate RDF dataset reasoning model.
|
|
241
|
+
|
|
242
|
+
In RDF compatibility mode, RDF 1.2 triple terms written as `<<( s p o )>>` are normalized to Eyeling's existing singleton quoted-formula term `{ s p o }`. A leading `VERSION "1.2"` or `@version "1.2"` directive is ignored for the same reason. On output, `--rdf` converts a singleton graph term back to `<<( ... )>>` only when its inner triple is valid as an RDF triple term; otherwise it stays in N3 graph-term form. It also prints `log:nameOf` graph-term triples back as TriG named graph blocks. For example:
|
|
241
243
|
|
|
242
244
|
```n3
|
|
243
245
|
:observation rdf:reifies <<( :sensor :reports :overheating )>> .
|
|
@@ -249,7 +251,23 @@ is treated internally like:
|
|
|
249
251
|
:observation rdf:reifies { :sensor :reports :overheating } .
|
|
250
252
|
```
|
|
251
253
|
|
|
252
|
-
|
|
254
|
+
RDF/TriG named graph blocks are normalized to ordinary N3 graph terms:
|
|
255
|
+
|
|
256
|
+
```trig
|
|
257
|
+
:factoryDataset {
|
|
258
|
+
:observation rdf:reifies <<( :sensor :reports :overheating )>> .
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
is treated internally like:
|
|
263
|
+
|
|
264
|
+
```n3
|
|
265
|
+
:factoryDataset log:nameOf {
|
|
266
|
+
:observation rdf:reifies { :sensor :reports :overheating } .
|
|
267
|
+
} .
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This keeps Eyeling's N3 model stable while allowing small RDF 1.1/RDF 1.2 dataset-shaped inputs to run through the existing `GraphTerm` machinery when the caller opts in. More exotic future RDF forms should be added only if they can be mapped cleanly onto Eyeling's quoted-formula term model.
|
|
253
271
|
|
|
254
272
|
### 4.2 Parsing triples, with Turtle-style convenience
|
|
255
273
|
|
|
@@ -2576,7 +2594,7 @@ Quoted graphs/formulas use `{ ... }`. Inside a quoted formula, directive scope m
|
|
|
2576
2594
|
|
|
2577
2595
|
- `@prefix/@base` and `PREFIX/BASE` directives may appear at top level **or inside `{ ... }`**, and apply to the formula they occur in (formula-local scoping).
|
|
2578
2596
|
|
|
2579
|
-
Eyeling also accepts the RDF 1.2 triple-term surface form `<<( s p o )>>` as a compatibility spelling for a singleton quoted formula `{ s p o }`. This is useful for inputs that use `rdf:reifies` or other predicates whose objects are RDF 1.2 triple terms, while keeping the rest of Eyeling on its N3 formula-term model.
|
|
2597
|
+
With `-r, --rdf` / `{ rdf: true }`, Eyeling also accepts the RDF 1.2 triple-term surface form `<<( s p o )>>` as a compatibility spelling for a singleton quoted formula `{ s p o }`. In the same mode, feasible singleton graph terms are printed back as RDF 1.2 triple terms, while invalid cases such as a literal subject remain ordinary N3 graph terms. This is useful for inputs that use `rdf:reifies` or other predicates whose objects are RDF 1.2 triple terms, while keeping the default language and the rest of Eyeling on its N3 formula-term model.
|
|
2580
2598
|
|
|
2581
2599
|
For the formal grammar, see the N3 spec grammar:
|
|
2582
2600
|
|
|
@@ -3849,7 +3867,9 @@ This vocabulary is deliberately more precise than a generic “result”. It say
|
|
|
3849
3867
|
|
|
3850
3868
|
Generated SEE runners read their committed `.trig` input directly. Earlier versions used an intermediate `.n3` conversion step, but the current design keeps the evidence in TriG and lets the runner parse that committed input. This matters for examples that are closer to RDF data exchange than to hand-written N3 rule files.
|
|
3851
3869
|
|
|
3852
|
-
SEE
|
|
3870
|
+
SEE includes RDF compatibility examples. The `triple_terms` example uses RDF 1.2 triple terms, and the `rdf_dataset` example combines ordinary default-graph triples, an RDF/TriG named graph block, and RDF 1.2 triple terms.
|
|
3871
|
+
|
|
3872
|
+
A triple-term input can contain:
|
|
3853
3873
|
|
|
3854
3874
|
```trig
|
|
3855
3875
|
VERSION "1.2"
|
|
@@ -3857,13 +3877,29 @@ VERSION "1.2"
|
|
|
3857
3877
|
:observation rdf:reifies <<( :sensor :reports :overheating )>> .
|
|
3858
3878
|
```
|
|
3859
3879
|
|
|
3860
|
-
Eyeling accepts this surface form by translating the triple term to a singleton quoted formula internally:
|
|
3880
|
+
In RDF compatibility mode, Eyeling accepts this surface form by translating the triple term to a singleton quoted formula internally:
|
|
3861
3881
|
|
|
3862
3882
|
```n3
|
|
3863
3883
|
:observation rdf:reifies { :sensor :reports :overheating } .
|
|
3864
3884
|
```
|
|
3865
3885
|
|
|
3866
|
-
|
|
3886
|
+
The dataset example also uses named graph syntax, which RDF compatibility mode normalizes to `log:nameOf` graph terms:
|
|
3887
|
+
|
|
3888
|
+
```trig
|
|
3889
|
+
:factoryDataset {
|
|
3890
|
+
:observation rdf:reifies <<( :sensor :reports :overheating )>> .
|
|
3891
|
+
}
|
|
3892
|
+
```
|
|
3893
|
+
|
|
3894
|
+
is compiled through the same internal N3 shape:
|
|
3895
|
+
|
|
3896
|
+
```n3
|
|
3897
|
+
:factoryDataset log:nameOf {
|
|
3898
|
+
:observation rdf:reifies { :sensor :reports :overheating } .
|
|
3899
|
+
} .
|
|
3900
|
+
```
|
|
3901
|
+
|
|
3902
|
+
That is enough for SEE to demonstrate RDF 1.1/RDF 1.2-style dataset input and triple-term output without forcing Eyeling to implement a separate full RDF dataset model. The compatibility layer is explicit rather than default, so ordinary N3 files remain strict N3.
|
|
3867
3903
|
|
|
3868
3904
|
### L.4 Generation and tests
|
|
3869
3905
|
|
|
@@ -3876,7 +3912,7 @@ npm run test:see
|
|
|
3876
3912
|
|
|
3877
3913
|
`npm run generate` refreshes the generated SEE artifacts from `see/examples/n3/*.n3`. `npm run test:see` runs every generated SEE example and compares its Markdown output with the committed reference output.
|
|
3878
3914
|
|
|
3879
|
-
In the full test suite, this means SEE is not just documentation. It is executable regression coverage for a broad range of Eyeling behavior: forward rules, backward rules, builtins, fuses, queries, RDF lists, formula-valued terms, generated explanations,
|
|
3915
|
+
In the full test suite, this means SEE is not just documentation. It is executable regression coverage for a broad range of Eyeling behavior: forward rules, backward rules, builtins, fuses, queries, RDF lists, formula-valued terms, generated explanations, opt-in RDF 1.2 triple-term compatibility, and opt-in RDF/TriG dataset-syntax compatibility.
|
|
3880
3916
|
|
|
3881
3917
|
### L.5 When to add a SEE example
|
|
3882
3918
|
|