eyeling 1.24.4 → 1.24.6
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 +2 -101
- package/README.md +2 -2
- package/dist/browser/eyeling.browser.js +256 -4
- package/examples/annotation.n3 +3 -4
- package/{see/examples/n3/backward_recursion.n3 → examples/backward-recursion.n3} +0 -2
- package/examples/collection.n3 +1 -2
- package/examples/context-association.n3 +56 -30
- package/{see/examples/n3/dijkstra_risk_path.n3 → examples/dijkstra-risk-path.n3} +3 -18
- package/{see/examples/n3/eco_route_insight.n3 → examples/eco-route-insight.n3} +2 -47
- package/{see/examples/n3/genetic_knapsack_selection.n3 → examples/genetic-knapsack-selection.n3} +2 -24
- package/{see/examples → examples}/input/annotation.trig +3 -3
- package/{see/examples/input/backward_recursion.trig → examples/input/backward-recursion.trig} +2 -2
- package/{see/examples/input/builtin_coverage.trig → examples/input/builtin-coverage.trig} +2 -2
- package/{see/examples → examples}/input/collection.trig +3 -3
- package/{see/examples/input/dijkstra_risk_path.trig → examples/input/dijkstra-risk-path.trig} +4 -4
- package/{see/examples/input/eco_route_insight.trig → examples/input/eco-route-insight.trig} +4 -4
- package/{see/examples/input/genetic_knapsack_selection.trig → examples/input/genetic-knapsack-selection.trig} +4 -4
- package/{see/examples/input/rc_discharge_envelope.trig → examples/input/rc-discharge-envelope.trig} +4 -4
- package/{see/examples/input/rdf_dataset.trig → examples/input/rdf-dataset.trig} +4 -4
- package/{see/examples/input/rdf_message_flow.trig → examples/input/rdf-message-flow.trig} +3 -3
- package/{see/examples/input/rdf_messages.trig → examples/input/rdf-messages.trig} +4 -4
- package/{see/examples/input/school_placement_audit.trig → examples/input/school-placement-audit.trig} +4 -4
- package/{see/examples/input/smoke_arithmetic.trig → examples/input/smoke-arithmetic.trig} +3 -3
- package/{see/examples/input/triple_terms.trig → examples/input/triple-terms.trig} +3 -3
- package/examples/output/backward-recursion.n3 +4 -0
- package/examples/output/context-association.n3 +9 -0
- package/examples/output/dijkstra-risk-path.n3 +3 -0
- package/examples/output/eco-route-insight.n3 +3 -0
- package/examples/output/genetic-knapsack-selection.n3 +3 -0
- package/examples/output/rc-discharge-envelope.n3 +9 -0
- package/examples/output/rc-discharge-envelope.txt +9 -0
- package/examples/output/rdf-dataset.n3 +5 -0
- package/examples/output/rdf-message-flow.n3 +7 -0
- package/examples/output/rdf-messages.n3 +7 -0
- package/examples/output/school-placement-audit.n3 +3 -0
- package/examples/output/smoke-arithmetic.n3 +5 -0
- package/examples/output/smoke-arithmetic.txt +5 -0
- package/examples/output/triple-terms.n3 +5 -0
- package/{see/examples/n3/rc_discharge_envelope.n3 → examples/rc-discharge-envelope.n3} +2 -15
- package/{see/examples/n3/rdf_dataset.n3 → examples/rdf-dataset.n3} +2 -11
- package/{see/examples/n3/rdf_message_flow.n3 → examples/rdf-message-flow.n3} +9 -75
- package/{see/examples/n3/rdf_messages.n3 → examples/rdf-messages.n3} +6 -43
- package/{see/examples/n3/school_placement_audit.n3 → examples/school-placement-audit.n3} +2 -14
- package/{see/examples/n3/smoke_arithmetic.n3 → examples/smoke-arithmetic.n3} +3 -5
- package/{see/examples/n3/triple_terms.n3 → examples/triple-terms.n3} +1 -4
- package/eyeling.js +256 -4
- package/lib/builtins.js +6 -0
- package/lib/lexer.js +250 -4
- package/package.json +4 -7
- package/test/api.test.js +65 -8
- package/test/examples.test.js +22 -2
- package/test/package.test.js +16 -2
- package/examples/arcling/README.md +0 -11
- package/examples/input/annotation.ttl +0 -6
- package/examples/input/collection.ttl +0 -13
- package/examples/input/reifies.ttl +0 -10
- package/examples/input/triple-term.ttl +0 -8
- package/examples/output/triple-term.n3 +0 -0
- package/examples/reifies.n3 +0 -8
- package/examples/triple-term.n3 +0 -7
- package/see/README.md +0 -149
- package/see/examples/_see.js +0 -249
- package/see/examples/age.js +0 -1459
- package/see/examples/annotation.js +0 -1320
- package/see/examples/backward.js +0 -1405
- package/see/examples/backward_recursion.js +0 -1504
- package/see/examples/bayes_diagnosis.js +0 -2883
- package/see/examples/bayes_therapy.js +0 -4152
- package/see/examples/bmi.js +0 -3038
- package/see/examples/builtin_coverage.js +0 -2524
- package/see/examples/collection.js +0 -1320
- package/see/examples/complex.js +0 -3762
- package/see/examples/complex_matrix_stability.js +0 -2973
- package/see/examples/composition_of_injective_functions_is_injective.js +0 -2170
- package/see/examples/control_system.js +0 -1918
- package/see/examples/crypto_builtins_tests.js +0 -1489
- package/see/examples/delfour.js +0 -3174
- package/see/examples/digital_product_passport.js +0 -2856
- package/see/examples/dijkstra.js +0 -2070
- package/see/examples/dijkstra_risk_path.js +0 -1874
- package/see/examples/doc/age.md +0 -27
- package/see/examples/doc/annotation.md +0 -24
- package/see/examples/doc/backward.md +0 -26
- package/see/examples/doc/backward_recursion.md +0 -26
- package/see/examples/doc/bayes_diagnosis.md +0 -41
- package/see/examples/doc/bayes_therapy.md +0 -40
- package/see/examples/doc/bmi.md +0 -38
- package/see/examples/doc/builtin_coverage.md +0 -53
- package/see/examples/doc/collection.md +0 -24
- package/see/examples/doc/complex.md +0 -38
- package/see/examples/doc/complex_matrix_stability.md +0 -35
- package/see/examples/doc/composition_of_injective_functions_is_injective.md +0 -24
- package/see/examples/doc/control_system.md +0 -32
- package/see/examples/doc/crypto_builtins_tests.md +0 -27
- package/see/examples/doc/delfour.md +0 -37
- package/see/examples/doc/digital_product_passport.md +0 -36
- package/see/examples/doc/dijkstra.md +0 -28
- package/see/examples/doc/dijkstra_risk_path.md +0 -30
- package/see/examples/doc/dog.md +0 -28
- package/see/examples/doc/eco_route_insight.md +0 -33
- package/see/examples/doc/equals.md +0 -26
- package/see/examples/doc/equivalence_classes_overlap_implies_same_class.md +0 -24
- package/see/examples/doc/euler_identity.md +0 -39
- package/see/examples/doc/ev_roundtrip_planner.md +0 -32
- package/see/examples/doc/existential_rule.md +0 -24
- package/see/examples/doc/expression_eval.md +0 -26
- package/see/examples/doc/family_cousins.md +0 -24
- package/see/examples/doc/fastpow.md +0 -29
- package/see/examples/doc/fibonacci.md +0 -28
- package/see/examples/doc/french_cities.md +0 -28
- package/see/examples/doc/fundamental_theorem_arithmetic.md +0 -36
- package/see/examples/doc/genetic_knapsack_selection.md +0 -29
- package/see/examples/doc/goldbach_1000.md +0 -31
- package/see/examples/doc/good_cobbler.md +0 -27
- package/see/examples/doc/gps.md +0 -35
- package/see/examples/doc/gray_code_counter.md +0 -31
- package/see/examples/doc/greatest_lower_bound_uniqueness.md +0 -24
- package/see/examples/doc/group_inverse_uniqueness.md +0 -24
- package/see/examples/doc/hadamard_approx.md +0 -32
- package/see/examples/doc/hanoi.md +0 -26
- package/see/examples/doc/odrl_dpv_risk_ranked.md +0 -57
- package/see/examples/doc/path_discovery.md +0 -33
- package/see/examples/doc/rc_discharge_envelope.md +0 -33
- package/see/examples/doc/rdf_dataset.md +0 -26
- package/see/examples/doc/rdf_message_flow.md +0 -35
- package/see/examples/doc/rdf_messages.md +0 -37
- package/see/examples/doc/school_placement_audit.md +0 -31
- package/see/examples/doc/smoke_arithmetic.md +0 -31
- package/see/examples/doc/socrates.md +0 -24
- package/see/examples/doc/triple_terms.md +0 -26
- package/see/examples/doc/wind_turbine.md +0 -37
- package/see/examples/doc/witch.md +0 -28
- package/see/examples/dog.js +0 -1436
- package/see/examples/eco_route_insight.js +0 -2110
- package/see/examples/equals.js +0 -1363
- package/see/examples/equivalence_classes_overlap_implies_same_class.js +0 -1792
- package/see/examples/euler_identity.js +0 -2038
- package/see/examples/ev_roundtrip_planner.js +0 -2562
- package/see/examples/existential_rule.js +0 -1363
- package/see/examples/expression_eval.js +0 -1798
- package/see/examples/family_cousins.js +0 -1586
- package/see/examples/fastpow.js +0 -2207
- package/see/examples/fibonacci.js +0 -1594
- package/see/examples/french_cities.js +0 -1492
- package/see/examples/fundamental_theorem_arithmetic.js +0 -2106
- package/see/examples/genetic_knapsack_selection.js +0 -1743
- package/see/examples/goldbach_1000.js +0 -1798
- package/see/examples/good_cobbler.js +0 -1396
- package/see/examples/gps.js +0 -2813
- package/see/examples/gray_code_counter.js +0 -1641
- package/see/examples/greatest_lower_bound_uniqueness.js +0 -1918
- package/see/examples/group_inverse_uniqueness.js +0 -1897
- package/see/examples/hadamard_approx.js +0 -4417
- package/see/examples/hanoi.js +0 -1625
- package/see/examples/input/age.trig +0 -27
- package/see/examples/input/backward.trig +0 -25
- package/see/examples/input/bayes_diagnosis.trig +0 -111
- package/see/examples/input/bayes_therapy.trig +0 -130
- package/see/examples/input/bmi.trig +0 -28
- package/see/examples/input/complex.trig +0 -26
- package/see/examples/input/complex_matrix_stability.trig +0 -65
- package/see/examples/input/composition_of_injective_functions_is_injective.trig +0 -35
- package/see/examples/input/control_system.trig +0 -31
- package/see/examples/input/crypto_builtins_tests.trig +0 -25
- package/see/examples/input/delfour.trig +0 -90
- package/see/examples/input/digital_product_passport.trig +0 -116
- package/see/examples/input/dijkstra.trig +0 -34
- package/see/examples/input/dog.trig +0 -31
- package/see/examples/input/equals.trig +0 -25
- package/see/examples/input/equivalence_classes_overlap_implies_same_class.trig +0 -28
- package/see/examples/input/euler_identity.trig +0 -34
- package/see/examples/input/ev_roundtrip_planner.trig +0 -90
- package/see/examples/input/existential_rule.trig +0 -26
- package/see/examples/input/expression_eval.trig +0 -41
- package/see/examples/input/family_cousins.trig +0 -39
- package/see/examples/input/fastpow.trig +0 -25
- package/see/examples/input/fibonacci.trig +0 -51
- package/see/examples/input/french_cities.trig +0 -38
- package/see/examples/input/fundamental_theorem_arithmetic.trig +0 -42
- package/see/examples/input/goldbach_1000.trig +0 -53
- package/see/examples/input/good_cobbler.trig +0 -24
- package/see/examples/input/gps.trig +0 -35
- package/see/examples/input/gray_code_counter.trig +0 -33
- package/see/examples/input/greatest_lower_bound_uniqueness.trig +0 -29
- package/see/examples/input/group_inverse_uniqueness.trig +0 -29
- package/see/examples/input/hadamard_approx.trig +0 -32
- package/see/examples/input/hanoi.trig +0 -26
- package/see/examples/input/odrl_dpv_risk_ranked.trig +0 -107
- package/see/examples/input/path-discovery.trig +0 -96448
- package/see/examples/input/path_discovery.trig +0 -29
- package/see/examples/input/socrates.trig +0 -26
- package/see/examples/input/wind_turbine.trig +0 -48
- package/see/examples/input/witch.trig +0 -26
- package/see/examples/n3/age.n3 +0 -28
- package/see/examples/n3/annotation.n3 +0 -7
- package/see/examples/n3/backward.n3 +0 -22
- package/see/examples/n3/bayes_diagnosis.n3 +0 -122
- package/see/examples/n3/bayes_therapy.n3 +0 -149
- package/see/examples/n3/bmi.n3 +0 -145
- package/see/examples/n3/collection.n3 +0 -3
- package/see/examples/n3/complex.n3 +0 -140
- package/see/examples/n3/complex_matrix_stability.n3 +0 -113
- package/see/examples/n3/composition_of_injective_functions_is_injective.n3 +0 -27
- package/see/examples/n3/control_system.n3 +0 -59
- package/see/examples/n3/crypto_builtins_tests.n3 +0 -18
- package/see/examples/n3/delfour.n3 +0 -167
- package/see/examples/n3/digital_product_passport.n3 +0 -156
- package/see/examples/n3/dijkstra.n3 +0 -46
- package/see/examples/n3/dog.n3 +0 -20
- package/see/examples/n3/equals.n3 +0 -11
- package/see/examples/n3/equivalence_classes_overlap_implies_same_class.n3 +0 -19
- package/see/examples/n3/euler_identity.n3 +0 -41
- package/see/examples/n3/ev_roundtrip_planner.n3 +0 -82
- package/see/examples/n3/existential_rule.n3 +0 -10
- package/see/examples/n3/expression_eval.n3 +0 -21
- package/see/examples/n3/family_cousins.n3 +0 -62
- package/see/examples/n3/fastpow.n3 +0 -56
- package/see/examples/n3/fibonacci.n3 +0 -44
- package/see/examples/n3/french_cities.n3 +0 -28
- package/see/examples/n3/fundamental_theorem_arithmetic.n3 +0 -84
- package/see/examples/n3/goldbach_1000.n3 +0 -66
- package/see/examples/n3/good_cobbler.n3 +0 -10
- package/see/examples/n3/gps.n3 +0 -70
- package/see/examples/n3/gray_code_counter.n3 +0 -53
- package/see/examples/n3/greatest_lower_bound_uniqueness.n3 +0 -20
- package/see/examples/n3/group_inverse_uniqueness.n3 +0 -19
- package/see/examples/n3/hadamard_approx.n3 +0 -43
- package/see/examples/n3/hanoi.n3 +0 -16
- package/see/examples/n3/odrl_dpv_risk_ranked.n3 +0 -460
- package/see/examples/n3/path_discovery.n3 +0 -43
- package/see/examples/n3/socrates.n3 +0 -21
- package/see/examples/n3/wind_turbine.n3 +0 -85
- package/see/examples/n3/witch.n3 +0 -30
- package/see/examples/odrl_dpv_risk_ranked.js +0 -5128
- package/see/examples/output/age.md +0 -48
- package/see/examples/output/annotation.md +0 -43
- package/see/examples/output/backward.md +0 -50
- package/see/examples/output/backward_recursion.md +0 -54
- package/see/examples/output/bayes_diagnosis.md +0 -103
- package/see/examples/output/bayes_therapy.md +0 -84
- package/see/examples/output/bmi.md +0 -164
- package/see/examples/output/builtin_coverage.md +0 -99
- package/see/examples/output/collection.md +0 -44
- package/see/examples/output/complex.md +0 -61
- package/see/examples/output/complex_matrix_stability.md +0 -55
- package/see/examples/output/composition_of_injective_functions_is_injective.md +0 -62
- package/see/examples/output/control_system.md +0 -61
- package/see/examples/output/crypto_builtins_tests.md +0 -68
- package/see/examples/output/delfour.md +0 -100
- package/see/examples/output/digital_product_passport.md +0 -100
- package/see/examples/output/dijkstra.md +0 -74
- package/see/examples/output/dijkstra_risk_path.md +0 -76
- package/see/examples/output/dog.md +0 -50
- package/see/examples/output/eco_route_insight.md +0 -88
- package/see/examples/output/equals.md +0 -50
- package/see/examples/output/equivalence_classes_overlap_implies_same_class.md +0 -86
- package/see/examples/output/euler_identity.md +0 -73
- package/see/examples/output/ev_roundtrip_planner.md +0 -79
- package/see/examples/output/existential_rule.md +0 -54
- package/see/examples/output/expression_eval.md +0 -50
- package/see/examples/output/family_cousins.md +0 -187
- package/see/examples/output/fastpow.md +0 -36
- package/see/examples/output/fibonacci.md +0 -53
- package/see/examples/output/french_cities.md +0 -70
- package/see/examples/output/fundamental_theorem_arithmetic.md +0 -101
- package/see/examples/output/genetic_knapsack_selection.md +0 -66
- package/see/examples/output/goldbach_1000.md +0 -58
- package/see/examples/output/good_cobbler.md +0 -54
- package/see/examples/output/gps.md +0 -102
- package/see/examples/output/gray_code_counter.md +0 -68
- package/see/examples/output/greatest_lower_bound_uniqueness.md +0 -60
- package/see/examples/output/group_inverse_uniqueness.md +0 -60
- package/see/examples/output/hadamard_approx.md +0 -510
- package/see/examples/output/hanoi.md +0 -51
- package/see/examples/output/odrl_dpv_risk_ranked.md +0 -139
- package/see/examples/output/path_discovery.md +0 -65
- package/see/examples/output/rc_discharge_envelope.md +0 -102
- package/see/examples/output/rdf_dataset.md +0 -54
- package/see/examples/output/rdf_message_flow.md +0 -198
- package/see/examples/output/rdf_messages.md +0 -134
- package/see/examples/output/school_placement_audit.md +0 -99
- package/see/examples/output/smoke_arithmetic.md +0 -54
- package/see/examples/output/socrates.md +0 -55
- package/see/examples/output/triple_terms.md +0 -53
- package/see/examples/output/wind_turbine.md +0 -108
- package/see/examples/output/witch.md +0 -87
- package/see/examples/path_discovery.js +0 -1774
- package/see/examples/rc_discharge_envelope.js +0 -1993
- package/see/examples/rdf_dataset.js +0 -1512
- package/see/examples/rdf_message_flow.js +0 -2580
- package/see/examples/rdf_messages.js +0 -2176
- package/see/examples/school_placement_audit.js +0 -1867
- package/see/examples/smoke_arithmetic.js +0 -1483
- package/see/examples/socrates.js +0 -1420
- package/see/examples/triple_terms.js +0 -1442
- package/see/examples/wind_turbine.js +0 -2853
- package/see/examples/witch.js +0 -1519
- package/see/see.js +0 -2179
- package/test/see.test.js +0 -159
- /package/{see/examples/n3/builtin_coverage.n3 → examples/builtin-coverage.n3} +0 -0
- /package/examples/output/{reifies.n3 → builtin-coverage.n3} +0 -0
package/HANDBOOK.md
CHANGED
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
- [Appendix I — The Eyeling Playground](#app-i)
|
|
37
37
|
- [Appendix J — Formalism Is Fine](#app-j)
|
|
38
38
|
- [Appendix K — Whitehead-inspired becoming examples](#app-k)
|
|
39
|
-
- [Appendix L — SEE: Specialized Eyeling Executables](#app-l)
|
|
40
39
|
|
|
41
40
|
---
|
|
42
41
|
|
|
@@ -239,7 +238,7 @@ Parsing becomes dramatically simpler because tokenization already decided where
|
|
|
239
238
|
|
|
240
239
|
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
240
|
|
|
242
|
-
In RDF compatibility mode, RDF 1.2 triple terms written as `<<( s p o )
|
|
241
|
+
In RDF compatibility mode, RDF 1.2 triple terms written as `<<( s p o )>>`, plus the reified triple form `<<s p o ~ r>>`, are normalized to Eyeling's existing singleton quoted-formula term `{ s p o }`. A reifier `r` is preserved as `r rdf:reifies { 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:
|
|
243
242
|
|
|
244
243
|
```n3
|
|
245
244
|
:observation rdf:reifies <<( :sensor :reports :overheating )>> .
|
|
@@ -2594,7 +2593,7 @@ Quoted graphs/formulas use `{ ... }`. Inside a quoted formula, directive scope m
|
|
|
2594
2593
|
|
|
2595
2594
|
- `@prefix/@base` and `PREFIX/BASE` directives may appear at top level **or inside `{ ... }`**, and apply to the formula they occur in (formula-local scoping).
|
|
2596
2595
|
|
|
2597
|
-
With `-r, --rdf` / `{ rdf: true }`, Eyeling also accepts
|
|
2596
|
+
With `-r, --rdf` / `{ rdf: true }`, Eyeling also accepts RDF 1.2 triple-term surface forms such as `<<( s p o )>>` and `<<s p o ~ r>>` as compatibility spellings 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.
|
|
2598
2597
|
|
|
2599
2598
|
For the formal grammar, see the N3 spec grammar:
|
|
2600
2599
|
|
|
@@ -3830,101 +3829,3 @@ For the handbook, these examples matter for two reasons. First, they provide a c
|
|
|
3830
3829
|
|
|
3831
3830
|
That is why this appendix belongs after Appendix J. “Formalism is fine” not only because it supports rigor, but because it can remain flexible enough to describe worlds in motion. The becoming examples are small demonstrations of that claim. They show that a compact N3 reasoner can host process-oriented models without ceasing to be simple, readable, and executable.
|
|
3832
3831
|
|
|
3833
|
-
---
|
|
3834
|
-
|
|
3835
|
-
<a id="app-l"></a>
|
|
3836
|
-
|
|
3837
|
-
## Appendix L — SEE: Specialized Eyeling Executables
|
|
3838
|
-
|
|
3839
|
-
SEE, **Specialized Eyeling Executables**, is the companion example system under `see/`. It compiles selected Eyeling-style N3 programs into small, standalone JavaScript runners. The goal is not to replace the main reasoner. The goal is to turn a particular reasoning task into an executable artifact that carries its input evidence, derivation logic, entailment, explanation, and reference output together.
|
|
3840
|
-
|
|
3841
|
-
The short mental model is:
|
|
3842
|
-
|
|
3843
|
-
```text
|
|
3844
|
-
N3 source + TriG evidence -> specialized JavaScript -> entailment + explanation
|
|
3845
|
-
```
|
|
3846
|
-
|
|
3847
|
-
### L.1 Why SEE exists
|
|
3848
|
-
|
|
3849
|
-
The normal Eyeling CLI is a general reasoner: it parses an input file, runs the engine, and prints the resulting closure, selected query output, or rendered `log:outputString` report.
|
|
3850
|
-
|
|
3851
|
-
SEE is narrower and more packageable. For each committed example, `see.js` generates:
|
|
3852
|
-
|
|
3853
|
-
- `see/examples/<name>.js` — a runnable JavaScript derivation program,
|
|
3854
|
-
- `see/examples/input/<name>.trig` — the RDF/TriG evidence read by the runner,
|
|
3855
|
-
- `see/examples/output/<name>.md` — the expected Markdown result,
|
|
3856
|
-
- `see/examples/doc/<name>.md` — a short generated explanation of the compiled example.
|
|
3857
|
-
|
|
3858
|
-
That makes each example easier to audit. A reviewer can inspect the source N3, the generated runner, the input evidence, and the expected entailment/explanation without reconstructing the whole test setup.
|
|
3859
|
-
|
|
3860
|
-
### L.2 Entailment plus explanation
|
|
3861
|
-
|
|
3862
|
-
SEE reports use an **Entailment** section and an **Explanation** section. The entailment is the selected result of the reasoning task. The explanation records how the compiled runner reached it: source facts, rules, selected support trees, and the formal TriG output when relevant.
|
|
3863
|
-
|
|
3864
|
-
This vocabulary is deliberately more precise than a generic “result”. It says: the program is not merely presenting a suggestion; it is presenting something that follows from the encoded facts, rules, gates, and query projection.
|
|
3865
|
-
|
|
3866
|
-
### L.3 Direct TriG input
|
|
3867
|
-
|
|
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.
|
|
3869
|
-
|
|
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:
|
|
3873
|
-
|
|
3874
|
-
```trig
|
|
3875
|
-
VERSION "1.2"
|
|
3876
|
-
|
|
3877
|
-
:observation rdf:reifies <<( :sensor :reports :overheating )>> .
|
|
3878
|
-
```
|
|
3879
|
-
|
|
3880
|
-
In RDF compatibility mode, Eyeling accepts this surface form by translating the triple term to a singleton quoted formula internally:
|
|
3881
|
-
|
|
3882
|
-
```n3
|
|
3883
|
-
:observation rdf:reifies { :sensor :reports :overheating } .
|
|
3884
|
-
```
|
|
3885
|
-
|
|
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.
|
|
3903
|
-
|
|
3904
|
-
### L.4 Generation and tests
|
|
3905
|
-
|
|
3906
|
-
The root package scripts treat SEE as part of the normal repository workflow:
|
|
3907
|
-
|
|
3908
|
-
```bash
|
|
3909
|
-
npm run generate
|
|
3910
|
-
npm run test:see
|
|
3911
|
-
```
|
|
3912
|
-
|
|
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.
|
|
3914
|
-
|
|
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.
|
|
3916
|
-
|
|
3917
|
-
### L.5 When to add a SEE example
|
|
3918
|
-
|
|
3919
|
-
A normal Eyeling example is best when you want to demonstrate a language feature or a compact reasoning pattern directly in N3.
|
|
3920
|
-
|
|
3921
|
-
A SEE example is best when you want a more self-contained artifact:
|
|
3922
|
-
|
|
3923
|
-
- the input evidence matters,
|
|
3924
|
-
- the final entailment should be explained in Markdown,
|
|
3925
|
-
- the example should be runnable without an external reasoner at runtime,
|
|
3926
|
-
- the generated JavaScript itself is worth inspecting,
|
|
3927
|
-
- or the example should become stable regression coverage for a specific reasoning workflow.
|
|
3928
|
-
|
|
3929
|
-
In that sense, SEE is an executable publication format for selected Eyeling examples: small enough to read, deterministic enough to test, and explicit enough to audit.
|
|
3930
|
-
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# eyeling
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/eyeling)
|
|
3
|
+
[](https://www.npmjs.com/package/eyeling)
|
|
4
|
+
[](https://doi.org/10.5281/zenodo.19068086)
|
|
4
5
|
|
|
5
6
|
A compact [Notation3 (N3)](https://notation3.org/) reasoner in **JavaScript**.
|
|
6
7
|
|
|
@@ -16,5 +17,4 @@ echo '@prefix : <http://example.org/> .
|
|
|
16
17
|
|
|
17
18
|
- [Handbook](https://eyereasoner.github.io/eyeling/HANDBOOK)
|
|
18
19
|
- [Playground](https://eyereasoner.github.io/eyeling/demo)
|
|
19
|
-
- [SEE: Specialized Eyeling Executables](https://github.com/eyereasoner/eyeling/tree/main/see)
|
|
20
20
|
- [Conformance report](https://codeberg.org/phochste/notation3tests/src/branch/main/reports/report.md)
|
|
@@ -4249,6 +4249,12 @@ function isBuiltinPred(p) {
|
|
|
4249
4249
|
return v === LOG_NS + 'implies' || v === LOG_NS + 'impliedBy';
|
|
4250
4250
|
}
|
|
4251
4251
|
|
|
4252
|
+
// log:nameOf is the ordinary fact predicate used by the RDF/TriG
|
|
4253
|
+
// compatibility layer for named graph blocks. It must remain matchable
|
|
4254
|
+
// against extensional facts instead of being swallowed as an unimplemented
|
|
4255
|
+
// log:* builtin.
|
|
4256
|
+
if (v === LOG_NS + 'nameOf') return false;
|
|
4257
|
+
|
|
4252
4258
|
// Treat RDF Collections as list-term builtins too.
|
|
4253
4259
|
if (v === RDF_NS + 'first' || v === RDF_NS + 'rest') {
|
|
4254
4260
|
return true;
|
|
@@ -9590,6 +9596,7 @@ function stripQuotes(lex) {
|
|
|
9590
9596
|
// - A top-level default graph block { ... } is unwrapped into ordinary triples.
|
|
9591
9597
|
// This keeps all downstream parsing/reasoning N3-only.
|
|
9592
9598
|
const LOG_NAME_OF_IRI = '<http://www.w3.org/2000/10/swap/log#nameOf>';
|
|
9599
|
+
const RDF_REIFIES_IRI = '<http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies>';
|
|
9593
9600
|
|
|
9594
9601
|
function normalizeRdfCompatibility(inputText) {
|
|
9595
9602
|
let text = String(inputText ?? '');
|
|
@@ -9598,11 +9605,12 @@ function normalizeRdfCompatibility(inputText) {
|
|
|
9598
9605
|
// surface-syntax normalization. Avoid scanning large files character-by-character
|
|
9599
9606
|
// unless they actually contain RDF 1.2 triple terms, VERSION directives, or a
|
|
9600
9607
|
// plausible top-level TriG named graph block.
|
|
9601
|
-
const hasTripleTerms = text.includes('<<
|
|
9608
|
+
const hasTripleTerms = text.includes('<<');
|
|
9602
9609
|
const hasVersionDirective = /^\s*(?:@version|VERSION)\s+(["'])1\.2\1\s*\.?\s*(?:#.*)?$/im.test(text);
|
|
9603
9610
|
const hasNamedGraphCandidate = /(?:^|[.\r\n])\s*(?:GRAPH\s+)?(?:<[^>\r\n]*>|_:[A-Za-z][A-Za-z0-9_-]*|[A-Za-z][A-Za-z0-9_-]*:[^\s{};,.()[\]]*)\s*\{/m.test(text);
|
|
9611
|
+
const hasAnnotationSyntax = /(?:^|\s)~\s*(?:<|_:[A-Za-z]|[A-Za-z][A-Za-z0-9_-]*:|\{\|)|\{\|/.test(text);
|
|
9604
9612
|
|
|
9605
|
-
if (!hasTripleTerms && !hasVersionDirective && !hasNamedGraphCandidate) return text;
|
|
9613
|
+
if (!hasTripleTerms && !hasVersionDirective && !hasNamedGraphCandidate && !hasAnnotationSyntax) return text;
|
|
9606
9614
|
|
|
9607
9615
|
function isWordChar(ch) {
|
|
9608
9616
|
return ch != null && /[A-Za-z0-9_:-]/.test(ch);
|
|
@@ -9664,11 +9672,67 @@ function normalizeRdfCompatibility(inputText) {
|
|
|
9664
9672
|
|
|
9665
9673
|
function convertTripleTerms(s) {
|
|
9666
9674
|
let i = 0;
|
|
9675
|
+
const reifierTriples = [];
|
|
9667
9676
|
|
|
9668
9677
|
function startsAt(needle, at = i) {
|
|
9669
9678
|
return s.startsWith(needle, at);
|
|
9670
9679
|
}
|
|
9671
9680
|
|
|
9681
|
+
function splitTopLevelReifier(body) {
|
|
9682
|
+
let depthBrace = 0;
|
|
9683
|
+
let depthBracket = 0;
|
|
9684
|
+
let depthParen = 0;
|
|
9685
|
+
for (let j = 0; j < body.length; j++) {
|
|
9686
|
+
const ch = body[j];
|
|
9687
|
+
if (ch === '"' || ch === "'") {
|
|
9688
|
+
const str = readStringAt(body, j);
|
|
9689
|
+
j = str.end - 1;
|
|
9690
|
+
continue;
|
|
9691
|
+
}
|
|
9692
|
+
if (ch === '<') {
|
|
9693
|
+
const iri = readIriAt(body, j);
|
|
9694
|
+
j = iri.end - 1;
|
|
9695
|
+
continue;
|
|
9696
|
+
}
|
|
9697
|
+
if (ch === '#') {
|
|
9698
|
+
while (j < body.length && body[j] !== '\n' && body[j] !== '\r') j += 1;
|
|
9699
|
+
continue;
|
|
9700
|
+
}
|
|
9701
|
+
if (ch === '{') depthBrace += 1;
|
|
9702
|
+
else if (ch === '}' && depthBrace > 0) depthBrace -= 1;
|
|
9703
|
+
else if (ch === '[') depthBracket += 1;
|
|
9704
|
+
else if (ch === ']' && depthBracket > 0) depthBracket -= 1;
|
|
9705
|
+
else if (ch === '(') depthParen += 1;
|
|
9706
|
+
else if (ch === ')' && depthParen > 0) depthParen -= 1;
|
|
9707
|
+
else if (ch === '~' && depthBrace === 0 && depthBracket === 0 && depthParen === 0) {
|
|
9708
|
+
return { triple: body.slice(0, j).trim(), reifier: body.slice(j + 1).trim() };
|
|
9709
|
+
}
|
|
9710
|
+
}
|
|
9711
|
+
return { triple: body.trim(), reifier: '' };
|
|
9712
|
+
}
|
|
9713
|
+
|
|
9714
|
+
function firstTerm(text) {
|
|
9715
|
+
const at = skipWsAndComments(text, 0);
|
|
9716
|
+
if (at >= text.length) return '';
|
|
9717
|
+
if (text[at] === '<') return readIriAt(text, at).text;
|
|
9718
|
+
let j = at;
|
|
9719
|
+
while (j < text.length && !/\s/.test(text[j]) && !'{}[](),;.'.includes(text[j])) j += 1;
|
|
9720
|
+
return text.slice(at, j);
|
|
9721
|
+
}
|
|
9722
|
+
|
|
9723
|
+
function graphTermFromTripleBody(rawBody, parenthesized) {
|
|
9724
|
+
let body = rawBody.trim();
|
|
9725
|
+
if (parenthesized && body.startsWith('(') && body.endsWith(')')) body = body.slice(1, -1).trim();
|
|
9726
|
+
const split = splitTopLevelReifier(body);
|
|
9727
|
+
const triple = split.triple;
|
|
9728
|
+
const graph = '{ ' + triple + ' }';
|
|
9729
|
+
if (split.reifier) {
|
|
9730
|
+
const reifier = firstTerm(split.reifier);
|
|
9731
|
+
if (reifier) reifierTriples.push(`${reifier} ${RDF_REIFIES_IRI} ${graph} .`);
|
|
9732
|
+
}
|
|
9733
|
+
return graph;
|
|
9734
|
+
}
|
|
9735
|
+
|
|
9672
9736
|
function convertUntil(stopToken) {
|
|
9673
9737
|
let out = '';
|
|
9674
9738
|
while (i < s.length) {
|
|
@@ -9678,7 +9742,12 @@ function normalizeRdfCompatibility(inputText) {
|
|
|
9678
9742
|
}
|
|
9679
9743
|
if (startsAt('<<(')) {
|
|
9680
9744
|
i += 3;
|
|
9681
|
-
out +=
|
|
9745
|
+
out += graphTermFromTripleBody(convertUntil(')>>'), false);
|
|
9746
|
+
continue;
|
|
9747
|
+
}
|
|
9748
|
+
if (startsAt('<<')) {
|
|
9749
|
+
i += 2;
|
|
9750
|
+
out += graphTermFromTripleBody(convertUntil('>>'), false);
|
|
9682
9751
|
continue;
|
|
9683
9752
|
}
|
|
9684
9753
|
const ch = s[i];
|
|
@@ -9709,7 +9778,189 @@ function normalizeRdfCompatibility(inputText) {
|
|
|
9709
9778
|
return out;
|
|
9710
9779
|
}
|
|
9711
9780
|
|
|
9712
|
-
|
|
9781
|
+
const converted = convertUntil(null);
|
|
9782
|
+
if (reifierTriples.length === 0) return converted;
|
|
9783
|
+
return converted + (converted.endsWith('\n') ? '' : '\n') + reifierTriples.join('\n') + '\n';
|
|
9784
|
+
}
|
|
9785
|
+
|
|
9786
|
+
|
|
9787
|
+
function convertAnnotations(s) {
|
|
9788
|
+
let out = '';
|
|
9789
|
+
let i = 0;
|
|
9790
|
+
let statementStart = true;
|
|
9791
|
+
let generatedBlank = 0;
|
|
9792
|
+
|
|
9793
|
+
function readBalancedDelimited(s, at, open, close) {
|
|
9794
|
+
if (!s.startsWith(open, at)) return null;
|
|
9795
|
+
let j = at + open.length;
|
|
9796
|
+
let depth = 1;
|
|
9797
|
+
while (j < s.length) {
|
|
9798
|
+
const ch = s[j];
|
|
9799
|
+
if (ch === '"' || ch === "'") {
|
|
9800
|
+
j = readStringAt(s, j).end;
|
|
9801
|
+
continue;
|
|
9802
|
+
}
|
|
9803
|
+
if (ch === '<' && !s.startsWith('<<', j)) {
|
|
9804
|
+
j = readIriAt(s, j).end;
|
|
9805
|
+
continue;
|
|
9806
|
+
}
|
|
9807
|
+
if (ch === '#') {
|
|
9808
|
+
while (j < s.length && s[j] !== '\n' && s[j] !== '\r') j += 1;
|
|
9809
|
+
continue;
|
|
9810
|
+
}
|
|
9811
|
+
if (s.startsWith(open, j)) {
|
|
9812
|
+
depth += 1;
|
|
9813
|
+
j += open.length;
|
|
9814
|
+
continue;
|
|
9815
|
+
}
|
|
9816
|
+
if (s.startsWith(close, j)) {
|
|
9817
|
+
depth -= 1;
|
|
9818
|
+
j += close.length;
|
|
9819
|
+
if (depth === 0) return { text: s.slice(at, j), inner: s.slice(at + open.length, j - close.length), end: j };
|
|
9820
|
+
continue;
|
|
9821
|
+
}
|
|
9822
|
+
j += 1;
|
|
9823
|
+
}
|
|
9824
|
+
throw new N3SyntaxError(`Unterminated RDF annotation block, expected ${close}`);
|
|
9825
|
+
}
|
|
9826
|
+
|
|
9827
|
+
function readTermLikeAt(s, at) {
|
|
9828
|
+
const j = skipWsAndComments(s, at);
|
|
9829
|
+
if (j >= s.length) return null;
|
|
9830
|
+
if (s[j] === '<') return readIriAt(s, j);
|
|
9831
|
+
if (s[j] === '"' || s[j] === "'") {
|
|
9832
|
+
const str = readStringAt(s, j);
|
|
9833
|
+
let end = str.end;
|
|
9834
|
+
let text = str.text;
|
|
9835
|
+
if (s.startsWith('^^', end)) {
|
|
9836
|
+
const dt = readTermAt(s, end + 2);
|
|
9837
|
+
if (dt) {
|
|
9838
|
+
text += '^^' + dt.text;
|
|
9839
|
+
end = dt.end;
|
|
9840
|
+
}
|
|
9841
|
+
} else if (s[end] === '@') {
|
|
9842
|
+
let k = end + 1;
|
|
9843
|
+
if (/[A-Za-z]/.test(s[k] || '')) {
|
|
9844
|
+
while (k < s.length && /[A-Za-z0-9-]/.test(s[k])) k += 1;
|
|
9845
|
+
text += s.slice(end, k);
|
|
9846
|
+
end = k;
|
|
9847
|
+
}
|
|
9848
|
+
}
|
|
9849
|
+
return { text, end };
|
|
9850
|
+
}
|
|
9851
|
+
if (s[j] === '{') return readBalancedBlock(s, j);
|
|
9852
|
+
if (s[j] === '[') return readBalancedDelimited(s, j, '[', ']');
|
|
9853
|
+
if (s[j] === '(') return readBalancedDelimited(s, j, '(', ')');
|
|
9854
|
+
return readTermAt(s, j);
|
|
9855
|
+
}
|
|
9856
|
+
|
|
9857
|
+
function readAnnotationBlockAt(s, at) {
|
|
9858
|
+
if (!s.startsWith('{|', at)) return null;
|
|
9859
|
+
return readBalancedDelimited(s, at, '{|', '|}');
|
|
9860
|
+
}
|
|
9861
|
+
|
|
9862
|
+
function tryReadAnnotatedTriple(at) {
|
|
9863
|
+
const start = skipWsAndComments(s, at);
|
|
9864
|
+
if (start >= s.length) return null;
|
|
9865
|
+
if (s[start] === '@') return null;
|
|
9866
|
+
if (startsWordAt(s, 'PREFIX', start) || startsWordAt(s, 'BASE', start) || startsWordAt(s, 'VERSION', start)) return null;
|
|
9867
|
+
if (startsWordAt(s, 'GRAPH', start)) return null;
|
|
9868
|
+
|
|
9869
|
+
const subj = readTermLikeAt(s, start);
|
|
9870
|
+
if (!subj) return null;
|
|
9871
|
+
let j = skipWsAndComments(s, subj.end);
|
|
9872
|
+
const pred = readTermLikeAt(s, j);
|
|
9873
|
+
if (!pred) return null;
|
|
9874
|
+
j = skipWsAndComments(s, pred.end);
|
|
9875
|
+
const obj = readTermLikeAt(s, j);
|
|
9876
|
+
if (!obj) return null;
|
|
9877
|
+
j = skipWsAndComments(s, obj.end);
|
|
9878
|
+
if (s[j] !== '~' && !s.startsWith('{|', j)) return null;
|
|
9879
|
+
|
|
9880
|
+
let reifier = '';
|
|
9881
|
+
const annotationBlocks = [];
|
|
9882
|
+
while (j < s.length) {
|
|
9883
|
+
j = skipWsAndComments(s, j);
|
|
9884
|
+
if (s[j] === '~') {
|
|
9885
|
+
j += 1;
|
|
9886
|
+
j = skipWsAndComments(s, j);
|
|
9887
|
+
const term = readTermAt(s, j);
|
|
9888
|
+
if (term) {
|
|
9889
|
+
reifier = term.text;
|
|
9890
|
+
j = term.end;
|
|
9891
|
+
} else if (!reifier) {
|
|
9892
|
+
reifier = `_:rdfAnnotation${++generatedBlank}`;
|
|
9893
|
+
}
|
|
9894
|
+
continue;
|
|
9895
|
+
}
|
|
9896
|
+
if (s.startsWith('{|', j)) {
|
|
9897
|
+
const block = readAnnotationBlockAt(s, j);
|
|
9898
|
+
if (!reifier) reifier = `_:rdfAnnotation${++generatedBlank}`;
|
|
9899
|
+
annotationBlocks.push(block.inner.trim());
|
|
9900
|
+
j = block.end;
|
|
9901
|
+
continue;
|
|
9902
|
+
}
|
|
9903
|
+
break;
|
|
9904
|
+
}
|
|
9905
|
+
|
|
9906
|
+
const after = skipWsAndComments(s, j);
|
|
9907
|
+
if (s[after] !== '.') return null;
|
|
9908
|
+
if (!reifier && annotationBlocks.length === 0) return null;
|
|
9909
|
+
|
|
9910
|
+
const baseTriple = `${subj.text} ${pred.text} ${obj.text}`;
|
|
9911
|
+
const graph = `{ ${baseTriple} }`;
|
|
9912
|
+
const extra = [];
|
|
9913
|
+
if (reifier) extra.push(`${reifier} ${RDF_REIFIES_IRI} ${graph} .`);
|
|
9914
|
+
for (const inner of annotationBlocks) {
|
|
9915
|
+
if (inner) extra.push(`${reifier} ${inner} .`);
|
|
9916
|
+
}
|
|
9917
|
+
return {
|
|
9918
|
+
start,
|
|
9919
|
+
end: after + 1,
|
|
9920
|
+
text: `${baseTriple} .${extra.length ? '\n' + extra.join('\n') : ''}`,
|
|
9921
|
+
};
|
|
9922
|
+
}
|
|
9923
|
+
|
|
9924
|
+
while (i < s.length) {
|
|
9925
|
+
if (statementStart) {
|
|
9926
|
+
const converted = tryReadAnnotatedTriple(i);
|
|
9927
|
+
if (converted) {
|
|
9928
|
+
out += s.slice(i, converted.start) + converted.text;
|
|
9929
|
+
i = converted.end;
|
|
9930
|
+
statementStart = true;
|
|
9931
|
+
continue;
|
|
9932
|
+
}
|
|
9933
|
+
}
|
|
9934
|
+
|
|
9935
|
+
const ch = s[i];
|
|
9936
|
+
if (ch === '"' || ch === "'") {
|
|
9937
|
+
const str = readStringAt(s, i);
|
|
9938
|
+
out += str.text;
|
|
9939
|
+
i = str.end;
|
|
9940
|
+
continue;
|
|
9941
|
+
}
|
|
9942
|
+
if (ch === '<' && !s.startsWith('<<', i)) {
|
|
9943
|
+
const iri = readIriAt(s, i);
|
|
9944
|
+
out += iri.text;
|
|
9945
|
+
i = iri.end;
|
|
9946
|
+
continue;
|
|
9947
|
+
}
|
|
9948
|
+
if (ch === '#') {
|
|
9949
|
+
while (i < s.length) {
|
|
9950
|
+
const c = s[i++];
|
|
9951
|
+
out += c;
|
|
9952
|
+
if (c === '\n' || c === '\r') break;
|
|
9953
|
+
}
|
|
9954
|
+
statementStart = true;
|
|
9955
|
+
continue;
|
|
9956
|
+
}
|
|
9957
|
+
out += ch;
|
|
9958
|
+
if (ch === '.' || ch === '{' || ch === '}' || ch === '\n' || ch === '\r') statementStart = true;
|
|
9959
|
+
else if (!/\s/.test(ch)) statementStart = false;
|
|
9960
|
+
i += 1;
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9963
|
+
return out;
|
|
9713
9964
|
}
|
|
9714
9965
|
|
|
9715
9966
|
function stripVersionDirectives(s) {
|
|
@@ -9868,6 +10119,7 @@ function normalizeRdfCompatibility(inputText) {
|
|
|
9868
10119
|
}
|
|
9869
10120
|
|
|
9870
10121
|
if (hasTripleTerms) text = convertTripleTerms(text);
|
|
10122
|
+
if (hasAnnotationSyntax) text = convertAnnotations(text);
|
|
9871
10123
|
if (hasVersionDirective) text = stripVersionDirectives(text);
|
|
9872
10124
|
if (hasVersionDirective || hasNamedGraphCandidate) text = normalizeNamedGraphs(text);
|
|
9873
10125
|
return text;
|
package/examples/annotation.n3
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
@prefix : <
|
|
2
|
-
@prefix log: <http://www.w3.org/2000/10/swap/log
|
|
3
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema
|
|
4
|
-
|
|
1
|
+
@prefix : <https://eyereasoner.github.io/eyeling/examples/annotation#>.
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
3
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
|
|
5
4
|
:a :name "Alice" .
|
|
6
5
|
:t log:nameOf { :a :name "Alice" . } .
|
|
7
6
|
:t :statedBy :bob .
|
package/examples/collection.n3
CHANGED
|
@@ -1,33 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
1
|
+
# Context association
|
|
2
|
+
#
|
|
3
|
+
# Uses an external RDF/TriG input dataset whose named graph blocks associate a
|
|
4
|
+
# data graph, a signature graph, and a metadata graph. This Eyeling example
|
|
5
|
+
# verifies that the graph contexts form a signed association around Bob's data.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
|
|
8
|
+
@prefix sec: <https://w3id.org/security#>.
|
|
9
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
|
|
10
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
11
|
+
@prefix : <http://example.org/#>.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_:signature1 sec:cryptosuite "ecdsa-rdfc-2019" .
|
|
16
|
-
_:signature1 sec:created "2021-11-13T18:19:39Z" .
|
|
17
|
-
_:signature1 sec:verificationMethod "https://university.example/issuers/14#key-1" .
|
|
18
|
-
_:signature1 sec:proofPurpose "assertionMethod" .
|
|
19
|
-
_:signature1 sec:proofValue "z58DAdFfa9SkqZMVPxAQp...jQCrfFPP2oumHKtz" .
|
|
20
|
-
_:signature1 sec:issuer <https://university.example/issuers/14> .
|
|
21
|
-
_:signature1 sec:validFrom "2024-04-03T00:00:00.000Z"^^xsd:dateTime .
|
|
22
|
-
_:signature1 sec:validUntil "2025-04-03T00:00:00.000Z"^^xsd:dateTime .
|
|
23
|
-
} .
|
|
13
|
+
{
|
|
14
|
+
?dataGraph log:nameOf ?dataContext.
|
|
15
|
+
?dataContext log:includes { :Bob foaf:name "Bob" }.
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
?signatureGraph log:nameOf ?signatureContext.
|
|
18
|
+
?signatureContext log:includes {
|
|
19
|
+
?dataGraph sec:proof ?dataSignature.
|
|
20
|
+
?proof a sec:DataIntegrityProof.
|
|
21
|
+
?proof sec:cryptosuite "ecdsa-rdfc-2019".
|
|
22
|
+
?proof sec:issuer <https://university.example/issuers/14>.
|
|
23
|
+
?proof sec:validUntil "2025-04-03T00:00:00.000Z"^^xsd:dateTime.
|
|
24
|
+
}.
|
|
25
|
+
|
|
26
|
+
?metadataGraph log:nameOf ?metadataContext.
|
|
27
|
+
?metadataContext log:includes {
|
|
28
|
+
?signatureGraph sec:proof ?metadataSignature.
|
|
29
|
+
?metadataProof a sec:DataIntegrityProof.
|
|
30
|
+
?metadataProof sec:proofPurpose "assertionMethod".
|
|
31
|
+
}.
|
|
32
|
+
}
|
|
33
|
+
=>
|
|
34
|
+
{
|
|
35
|
+
:association :subject :Bob.
|
|
36
|
+
:association :dataGraph ?dataGraph.
|
|
37
|
+
:association :signatureGraph ?signatureGraph.
|
|
38
|
+
:association :metadataGraph ?metadataGraph.
|
|
39
|
+
:association :cryptosuite "ecdsa-rdfc-2019".
|
|
40
|
+
:association :issuer <https://university.example/issuers/14>.
|
|
41
|
+
:association :status :contextAssociationVerified.
|
|
42
|
+
}.
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
:association :status :contextAssociationVerified.
|
|
46
|
+
}
|
|
47
|
+
=>
|
|
48
|
+
{
|
|
49
|
+
:report log:outputString "# Context association\n\n## Entailment\nThe RDF dataset associates Bob's data graph with a Data Integrity proof graph and a second metadata proof graph.\n\n## Explanation\nThe input TriG names three graph contexts. The data graph states Bob's name. The signature graph links to that data graph with a proof and records an ecdsa-rdfc-2019 Data Integrity proof from the university issuer. The metadata graph then signs the signature graph itself, giving a chained context association.".
|
|
50
|
+
}.
|
|
51
|
+
|
|
52
|
+
# query
|
|
53
|
+
{
|
|
54
|
+
:association ?P ?O.
|
|
55
|
+
}
|
|
56
|
+
log:query
|
|
57
|
+
{
|
|
58
|
+
:association ?P ?O.
|
|
59
|
+
}.
|
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
# ==================
|
|
2
2
|
# Dijkstra Risk Path
|
|
3
3
|
# ==================
|
|
4
|
-
# N3
|
|
4
|
+
# N3 version of the risk-adjusted route example. The original JSON
|
|
5
5
|
# input is preserved as the data-input sidecar; this source compiles the
|
|
6
6
|
# executable derivation and report.
|
|
7
7
|
|
|
8
|
-
@prefix : <https://eyereasoner.github.io/
|
|
8
|
+
@prefix : <https://eyereasoner.github.io/eyeling/examples/dijkstra-risk-path#>.
|
|
9
9
|
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
10
10
|
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
11
11
|
@prefix string: <http://www.w3.org/2000/10/swap/string#>.
|
|
12
12
|
|
|
13
|
-
:Case
|
|
14
|
-
:question "Which clinic-to-hub route has the lowest risk-adjusted score?";
|
|
15
|
-
:start :ClinicA;
|
|
16
|
-
:goal :HubZ;
|
|
17
|
-
:riskWeight 2.0.
|
|
18
13
|
|
|
19
|
-
:pathB
|
|
20
|
-
:routeText "ClinicA -> DepotB -> LabD -> HubZ";
|
|
21
|
-
:rawCost 10.0;
|
|
22
|
-
:riskSum 0.55;
|
|
23
|
-
:score 11.10;
|
|
24
|
-
:edgeCount 3;
|
|
25
|
-
:uses :ClinicA, :DepotB, :LabD, :HubZ.
|
|
26
14
|
|
|
27
|
-
:pathC :score 11.30.
|
|
28
|
-
:pathRelay :score 11.70.
|
|
29
|
-
:pathDirectC :rawCost 10.0; :score 11.60; :riskSum 0.80.
|
|
30
|
-
:pathViaC :rawCost 8.0; :score 11.20; :riskSum 1.60.
|
|
31
15
|
|
|
32
16
|
# The selected route must be strictly lower than each enumerated alternative.
|
|
17
|
+
|
|
33
18
|
{
|
|
34
19
|
:pathB :score ?Best.
|
|
35
20
|
:pathC :score ?CScore.
|