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.
Files changed (301) hide show
  1. package/HANDBOOK.md +2 -101
  2. package/README.md +2 -2
  3. package/dist/browser/eyeling.browser.js +256 -4
  4. package/examples/annotation.n3 +3 -4
  5. package/{see/examples/n3/backward_recursion.n3 → examples/backward-recursion.n3} +0 -2
  6. package/examples/collection.n3 +1 -2
  7. package/examples/context-association.n3 +56 -30
  8. package/{see/examples/n3/dijkstra_risk_path.n3 → examples/dijkstra-risk-path.n3} +3 -18
  9. package/{see/examples/n3/eco_route_insight.n3 → examples/eco-route-insight.n3} +2 -47
  10. package/{see/examples/n3/genetic_knapsack_selection.n3 → examples/genetic-knapsack-selection.n3} +2 -24
  11. package/{see/examples → examples}/input/annotation.trig +3 -3
  12. package/{see/examples/input/backward_recursion.trig → examples/input/backward-recursion.trig} +2 -2
  13. package/{see/examples/input/builtin_coverage.trig → examples/input/builtin-coverage.trig} +2 -2
  14. package/{see/examples → examples}/input/collection.trig +3 -3
  15. package/{see/examples/input/dijkstra_risk_path.trig → examples/input/dijkstra-risk-path.trig} +4 -4
  16. package/{see/examples/input/eco_route_insight.trig → examples/input/eco-route-insight.trig} +4 -4
  17. package/{see/examples/input/genetic_knapsack_selection.trig → examples/input/genetic-knapsack-selection.trig} +4 -4
  18. package/{see/examples/input/rc_discharge_envelope.trig → examples/input/rc-discharge-envelope.trig} +4 -4
  19. package/{see/examples/input/rdf_dataset.trig → examples/input/rdf-dataset.trig} +4 -4
  20. package/{see/examples/input/rdf_message_flow.trig → examples/input/rdf-message-flow.trig} +3 -3
  21. package/{see/examples/input/rdf_messages.trig → examples/input/rdf-messages.trig} +4 -4
  22. package/{see/examples/input/school_placement_audit.trig → examples/input/school-placement-audit.trig} +4 -4
  23. package/{see/examples/input/smoke_arithmetic.trig → examples/input/smoke-arithmetic.trig} +3 -3
  24. package/{see/examples/input/triple_terms.trig → examples/input/triple-terms.trig} +3 -3
  25. package/examples/output/backward-recursion.n3 +4 -0
  26. package/examples/output/context-association.n3 +9 -0
  27. package/examples/output/dijkstra-risk-path.n3 +3 -0
  28. package/examples/output/eco-route-insight.n3 +3 -0
  29. package/examples/output/genetic-knapsack-selection.n3 +3 -0
  30. package/examples/output/rc-discharge-envelope.n3 +9 -0
  31. package/examples/output/rc-discharge-envelope.txt +9 -0
  32. package/examples/output/rdf-dataset.n3 +5 -0
  33. package/examples/output/rdf-message-flow.n3 +7 -0
  34. package/examples/output/rdf-messages.n3 +7 -0
  35. package/examples/output/school-placement-audit.n3 +3 -0
  36. package/examples/output/smoke-arithmetic.n3 +5 -0
  37. package/examples/output/smoke-arithmetic.txt +5 -0
  38. package/examples/output/triple-terms.n3 +5 -0
  39. package/{see/examples/n3/rc_discharge_envelope.n3 → examples/rc-discharge-envelope.n3} +2 -15
  40. package/{see/examples/n3/rdf_dataset.n3 → examples/rdf-dataset.n3} +2 -11
  41. package/{see/examples/n3/rdf_message_flow.n3 → examples/rdf-message-flow.n3} +9 -75
  42. package/{see/examples/n3/rdf_messages.n3 → examples/rdf-messages.n3} +6 -43
  43. package/{see/examples/n3/school_placement_audit.n3 → examples/school-placement-audit.n3} +2 -14
  44. package/{see/examples/n3/smoke_arithmetic.n3 → examples/smoke-arithmetic.n3} +3 -5
  45. package/{see/examples/n3/triple_terms.n3 → examples/triple-terms.n3} +1 -4
  46. package/eyeling.js +256 -4
  47. package/lib/builtins.js +6 -0
  48. package/lib/lexer.js +250 -4
  49. package/package.json +4 -7
  50. package/test/api.test.js +65 -8
  51. package/test/examples.test.js +22 -2
  52. package/test/package.test.js +16 -2
  53. package/examples/arcling/README.md +0 -11
  54. package/examples/input/annotation.ttl +0 -6
  55. package/examples/input/collection.ttl +0 -13
  56. package/examples/input/reifies.ttl +0 -10
  57. package/examples/input/triple-term.ttl +0 -8
  58. package/examples/output/triple-term.n3 +0 -0
  59. package/examples/reifies.n3 +0 -8
  60. package/examples/triple-term.n3 +0 -7
  61. package/see/README.md +0 -149
  62. package/see/examples/_see.js +0 -249
  63. package/see/examples/age.js +0 -1459
  64. package/see/examples/annotation.js +0 -1320
  65. package/see/examples/backward.js +0 -1405
  66. package/see/examples/backward_recursion.js +0 -1504
  67. package/see/examples/bayes_diagnosis.js +0 -2883
  68. package/see/examples/bayes_therapy.js +0 -4152
  69. package/see/examples/bmi.js +0 -3038
  70. package/see/examples/builtin_coverage.js +0 -2524
  71. package/see/examples/collection.js +0 -1320
  72. package/see/examples/complex.js +0 -3762
  73. package/see/examples/complex_matrix_stability.js +0 -2973
  74. package/see/examples/composition_of_injective_functions_is_injective.js +0 -2170
  75. package/see/examples/control_system.js +0 -1918
  76. package/see/examples/crypto_builtins_tests.js +0 -1489
  77. package/see/examples/delfour.js +0 -3174
  78. package/see/examples/digital_product_passport.js +0 -2856
  79. package/see/examples/dijkstra.js +0 -2070
  80. package/see/examples/dijkstra_risk_path.js +0 -1874
  81. package/see/examples/doc/age.md +0 -27
  82. package/see/examples/doc/annotation.md +0 -24
  83. package/see/examples/doc/backward.md +0 -26
  84. package/see/examples/doc/backward_recursion.md +0 -26
  85. package/see/examples/doc/bayes_diagnosis.md +0 -41
  86. package/see/examples/doc/bayes_therapy.md +0 -40
  87. package/see/examples/doc/bmi.md +0 -38
  88. package/see/examples/doc/builtin_coverage.md +0 -53
  89. package/see/examples/doc/collection.md +0 -24
  90. package/see/examples/doc/complex.md +0 -38
  91. package/see/examples/doc/complex_matrix_stability.md +0 -35
  92. package/see/examples/doc/composition_of_injective_functions_is_injective.md +0 -24
  93. package/see/examples/doc/control_system.md +0 -32
  94. package/see/examples/doc/crypto_builtins_tests.md +0 -27
  95. package/see/examples/doc/delfour.md +0 -37
  96. package/see/examples/doc/digital_product_passport.md +0 -36
  97. package/see/examples/doc/dijkstra.md +0 -28
  98. package/see/examples/doc/dijkstra_risk_path.md +0 -30
  99. package/see/examples/doc/dog.md +0 -28
  100. package/see/examples/doc/eco_route_insight.md +0 -33
  101. package/see/examples/doc/equals.md +0 -26
  102. package/see/examples/doc/equivalence_classes_overlap_implies_same_class.md +0 -24
  103. package/see/examples/doc/euler_identity.md +0 -39
  104. package/see/examples/doc/ev_roundtrip_planner.md +0 -32
  105. package/see/examples/doc/existential_rule.md +0 -24
  106. package/see/examples/doc/expression_eval.md +0 -26
  107. package/see/examples/doc/family_cousins.md +0 -24
  108. package/see/examples/doc/fastpow.md +0 -29
  109. package/see/examples/doc/fibonacci.md +0 -28
  110. package/see/examples/doc/french_cities.md +0 -28
  111. package/see/examples/doc/fundamental_theorem_arithmetic.md +0 -36
  112. package/see/examples/doc/genetic_knapsack_selection.md +0 -29
  113. package/see/examples/doc/goldbach_1000.md +0 -31
  114. package/see/examples/doc/good_cobbler.md +0 -27
  115. package/see/examples/doc/gps.md +0 -35
  116. package/see/examples/doc/gray_code_counter.md +0 -31
  117. package/see/examples/doc/greatest_lower_bound_uniqueness.md +0 -24
  118. package/see/examples/doc/group_inverse_uniqueness.md +0 -24
  119. package/see/examples/doc/hadamard_approx.md +0 -32
  120. package/see/examples/doc/hanoi.md +0 -26
  121. package/see/examples/doc/odrl_dpv_risk_ranked.md +0 -57
  122. package/see/examples/doc/path_discovery.md +0 -33
  123. package/see/examples/doc/rc_discharge_envelope.md +0 -33
  124. package/see/examples/doc/rdf_dataset.md +0 -26
  125. package/see/examples/doc/rdf_message_flow.md +0 -35
  126. package/see/examples/doc/rdf_messages.md +0 -37
  127. package/see/examples/doc/school_placement_audit.md +0 -31
  128. package/see/examples/doc/smoke_arithmetic.md +0 -31
  129. package/see/examples/doc/socrates.md +0 -24
  130. package/see/examples/doc/triple_terms.md +0 -26
  131. package/see/examples/doc/wind_turbine.md +0 -37
  132. package/see/examples/doc/witch.md +0 -28
  133. package/see/examples/dog.js +0 -1436
  134. package/see/examples/eco_route_insight.js +0 -2110
  135. package/see/examples/equals.js +0 -1363
  136. package/see/examples/equivalence_classes_overlap_implies_same_class.js +0 -1792
  137. package/see/examples/euler_identity.js +0 -2038
  138. package/see/examples/ev_roundtrip_planner.js +0 -2562
  139. package/see/examples/existential_rule.js +0 -1363
  140. package/see/examples/expression_eval.js +0 -1798
  141. package/see/examples/family_cousins.js +0 -1586
  142. package/see/examples/fastpow.js +0 -2207
  143. package/see/examples/fibonacci.js +0 -1594
  144. package/see/examples/french_cities.js +0 -1492
  145. package/see/examples/fundamental_theorem_arithmetic.js +0 -2106
  146. package/see/examples/genetic_knapsack_selection.js +0 -1743
  147. package/see/examples/goldbach_1000.js +0 -1798
  148. package/see/examples/good_cobbler.js +0 -1396
  149. package/see/examples/gps.js +0 -2813
  150. package/see/examples/gray_code_counter.js +0 -1641
  151. package/see/examples/greatest_lower_bound_uniqueness.js +0 -1918
  152. package/see/examples/group_inverse_uniqueness.js +0 -1897
  153. package/see/examples/hadamard_approx.js +0 -4417
  154. package/see/examples/hanoi.js +0 -1625
  155. package/see/examples/input/age.trig +0 -27
  156. package/see/examples/input/backward.trig +0 -25
  157. package/see/examples/input/bayes_diagnosis.trig +0 -111
  158. package/see/examples/input/bayes_therapy.trig +0 -130
  159. package/see/examples/input/bmi.trig +0 -28
  160. package/see/examples/input/complex.trig +0 -26
  161. package/see/examples/input/complex_matrix_stability.trig +0 -65
  162. package/see/examples/input/composition_of_injective_functions_is_injective.trig +0 -35
  163. package/see/examples/input/control_system.trig +0 -31
  164. package/see/examples/input/crypto_builtins_tests.trig +0 -25
  165. package/see/examples/input/delfour.trig +0 -90
  166. package/see/examples/input/digital_product_passport.trig +0 -116
  167. package/see/examples/input/dijkstra.trig +0 -34
  168. package/see/examples/input/dog.trig +0 -31
  169. package/see/examples/input/equals.trig +0 -25
  170. package/see/examples/input/equivalence_classes_overlap_implies_same_class.trig +0 -28
  171. package/see/examples/input/euler_identity.trig +0 -34
  172. package/see/examples/input/ev_roundtrip_planner.trig +0 -90
  173. package/see/examples/input/existential_rule.trig +0 -26
  174. package/see/examples/input/expression_eval.trig +0 -41
  175. package/see/examples/input/family_cousins.trig +0 -39
  176. package/see/examples/input/fastpow.trig +0 -25
  177. package/see/examples/input/fibonacci.trig +0 -51
  178. package/see/examples/input/french_cities.trig +0 -38
  179. package/see/examples/input/fundamental_theorem_arithmetic.trig +0 -42
  180. package/see/examples/input/goldbach_1000.trig +0 -53
  181. package/see/examples/input/good_cobbler.trig +0 -24
  182. package/see/examples/input/gps.trig +0 -35
  183. package/see/examples/input/gray_code_counter.trig +0 -33
  184. package/see/examples/input/greatest_lower_bound_uniqueness.trig +0 -29
  185. package/see/examples/input/group_inverse_uniqueness.trig +0 -29
  186. package/see/examples/input/hadamard_approx.trig +0 -32
  187. package/see/examples/input/hanoi.trig +0 -26
  188. package/see/examples/input/odrl_dpv_risk_ranked.trig +0 -107
  189. package/see/examples/input/path-discovery.trig +0 -96448
  190. package/see/examples/input/path_discovery.trig +0 -29
  191. package/see/examples/input/socrates.trig +0 -26
  192. package/see/examples/input/wind_turbine.trig +0 -48
  193. package/see/examples/input/witch.trig +0 -26
  194. package/see/examples/n3/age.n3 +0 -28
  195. package/see/examples/n3/annotation.n3 +0 -7
  196. package/see/examples/n3/backward.n3 +0 -22
  197. package/see/examples/n3/bayes_diagnosis.n3 +0 -122
  198. package/see/examples/n3/bayes_therapy.n3 +0 -149
  199. package/see/examples/n3/bmi.n3 +0 -145
  200. package/see/examples/n3/collection.n3 +0 -3
  201. package/see/examples/n3/complex.n3 +0 -140
  202. package/see/examples/n3/complex_matrix_stability.n3 +0 -113
  203. package/see/examples/n3/composition_of_injective_functions_is_injective.n3 +0 -27
  204. package/see/examples/n3/control_system.n3 +0 -59
  205. package/see/examples/n3/crypto_builtins_tests.n3 +0 -18
  206. package/see/examples/n3/delfour.n3 +0 -167
  207. package/see/examples/n3/digital_product_passport.n3 +0 -156
  208. package/see/examples/n3/dijkstra.n3 +0 -46
  209. package/see/examples/n3/dog.n3 +0 -20
  210. package/see/examples/n3/equals.n3 +0 -11
  211. package/see/examples/n3/equivalence_classes_overlap_implies_same_class.n3 +0 -19
  212. package/see/examples/n3/euler_identity.n3 +0 -41
  213. package/see/examples/n3/ev_roundtrip_planner.n3 +0 -82
  214. package/see/examples/n3/existential_rule.n3 +0 -10
  215. package/see/examples/n3/expression_eval.n3 +0 -21
  216. package/see/examples/n3/family_cousins.n3 +0 -62
  217. package/see/examples/n3/fastpow.n3 +0 -56
  218. package/see/examples/n3/fibonacci.n3 +0 -44
  219. package/see/examples/n3/french_cities.n3 +0 -28
  220. package/see/examples/n3/fundamental_theorem_arithmetic.n3 +0 -84
  221. package/see/examples/n3/goldbach_1000.n3 +0 -66
  222. package/see/examples/n3/good_cobbler.n3 +0 -10
  223. package/see/examples/n3/gps.n3 +0 -70
  224. package/see/examples/n3/gray_code_counter.n3 +0 -53
  225. package/see/examples/n3/greatest_lower_bound_uniqueness.n3 +0 -20
  226. package/see/examples/n3/group_inverse_uniqueness.n3 +0 -19
  227. package/see/examples/n3/hadamard_approx.n3 +0 -43
  228. package/see/examples/n3/hanoi.n3 +0 -16
  229. package/see/examples/n3/odrl_dpv_risk_ranked.n3 +0 -460
  230. package/see/examples/n3/path_discovery.n3 +0 -43
  231. package/see/examples/n3/socrates.n3 +0 -21
  232. package/see/examples/n3/wind_turbine.n3 +0 -85
  233. package/see/examples/n3/witch.n3 +0 -30
  234. package/see/examples/odrl_dpv_risk_ranked.js +0 -5128
  235. package/see/examples/output/age.md +0 -48
  236. package/see/examples/output/annotation.md +0 -43
  237. package/see/examples/output/backward.md +0 -50
  238. package/see/examples/output/backward_recursion.md +0 -54
  239. package/see/examples/output/bayes_diagnosis.md +0 -103
  240. package/see/examples/output/bayes_therapy.md +0 -84
  241. package/see/examples/output/bmi.md +0 -164
  242. package/see/examples/output/builtin_coverage.md +0 -99
  243. package/see/examples/output/collection.md +0 -44
  244. package/see/examples/output/complex.md +0 -61
  245. package/see/examples/output/complex_matrix_stability.md +0 -55
  246. package/see/examples/output/composition_of_injective_functions_is_injective.md +0 -62
  247. package/see/examples/output/control_system.md +0 -61
  248. package/see/examples/output/crypto_builtins_tests.md +0 -68
  249. package/see/examples/output/delfour.md +0 -100
  250. package/see/examples/output/digital_product_passport.md +0 -100
  251. package/see/examples/output/dijkstra.md +0 -74
  252. package/see/examples/output/dijkstra_risk_path.md +0 -76
  253. package/see/examples/output/dog.md +0 -50
  254. package/see/examples/output/eco_route_insight.md +0 -88
  255. package/see/examples/output/equals.md +0 -50
  256. package/see/examples/output/equivalence_classes_overlap_implies_same_class.md +0 -86
  257. package/see/examples/output/euler_identity.md +0 -73
  258. package/see/examples/output/ev_roundtrip_planner.md +0 -79
  259. package/see/examples/output/existential_rule.md +0 -54
  260. package/see/examples/output/expression_eval.md +0 -50
  261. package/see/examples/output/family_cousins.md +0 -187
  262. package/see/examples/output/fastpow.md +0 -36
  263. package/see/examples/output/fibonacci.md +0 -53
  264. package/see/examples/output/french_cities.md +0 -70
  265. package/see/examples/output/fundamental_theorem_arithmetic.md +0 -101
  266. package/see/examples/output/genetic_knapsack_selection.md +0 -66
  267. package/see/examples/output/goldbach_1000.md +0 -58
  268. package/see/examples/output/good_cobbler.md +0 -54
  269. package/see/examples/output/gps.md +0 -102
  270. package/see/examples/output/gray_code_counter.md +0 -68
  271. package/see/examples/output/greatest_lower_bound_uniqueness.md +0 -60
  272. package/see/examples/output/group_inverse_uniqueness.md +0 -60
  273. package/see/examples/output/hadamard_approx.md +0 -510
  274. package/see/examples/output/hanoi.md +0 -51
  275. package/see/examples/output/odrl_dpv_risk_ranked.md +0 -139
  276. package/see/examples/output/path_discovery.md +0 -65
  277. package/see/examples/output/rc_discharge_envelope.md +0 -102
  278. package/see/examples/output/rdf_dataset.md +0 -54
  279. package/see/examples/output/rdf_message_flow.md +0 -198
  280. package/see/examples/output/rdf_messages.md +0 -134
  281. package/see/examples/output/school_placement_audit.md +0 -99
  282. package/see/examples/output/smoke_arithmetic.md +0 -54
  283. package/see/examples/output/socrates.md +0 -55
  284. package/see/examples/output/triple_terms.md +0 -53
  285. package/see/examples/output/wind_turbine.md +0 -108
  286. package/see/examples/output/witch.md +0 -87
  287. package/see/examples/path_discovery.js +0 -1774
  288. package/see/examples/rc_discharge_envelope.js +0 -1993
  289. package/see/examples/rdf_dataset.js +0 -1512
  290. package/see/examples/rdf_message_flow.js +0 -2580
  291. package/see/examples/rdf_messages.js +0 -2176
  292. package/see/examples/school_placement_audit.js +0 -1867
  293. package/see/examples/smoke_arithmetic.js +0 -1483
  294. package/see/examples/socrates.js +0 -1420
  295. package/see/examples/triple_terms.js +0 -1442
  296. package/see/examples/wind_turbine.js +0 -2853
  297. package/see/examples/witch.js +0 -1519
  298. package/see/see.js +0 -2179
  299. package/test/see.test.js +0 -159
  300. /package/{see/examples/n3/builtin_coverage.n3 → examples/builtin-coverage.n3} +0 -0
  301. /package/examples/output/{reifies.n3 → builtin-coverage.n3} +0 -0
@@ -1,48 +0,0 @@
1
- # Age checker
2
-
3
- ## Entailment
4
- The compiled query selected 1 fact(s) after the rule closure was computed.
5
- Main entailment: **:test is true.**
6
-
7
- Selected entailments:
8
- - :test :is true .
9
-
10
- ## Explanation
11
- Starts with 1 source fact(s), applies 1 rule(s), and reaches a fixpoint.
12
- The log:query projection then keeps only the matching fact(s) shown above.
13
-
14
- Selected explanation support:
15
- - :test :is true . _(no recorded rule support)_
16
-
17
- The query-selected facts are serialized in the Formal TriG Output section.
18
-
19
- ## Formal TriG Output
20
-
21
- ```trig
22
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23
- @prefix time: <http://www.w3.org/2000/10/swap/time#> .
24
- @prefix math: <http://www.w3.org/2000/10/swap/math#> .
25
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
26
- @prefix : <https://example.org/#> .
27
- @prefix see: <https://example.org/see#> .
28
- @prefix in: <https://example.org/see/input#> .
29
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
30
-
31
- :test :is true .
32
-
33
- in:metadata {
34
- in:run a see:InputDataset .
35
- in:run see:name "age" .
36
- in:run see:title "Age checker" .
37
- in:run see:sourceFile "examples/n3/age.n3" .
38
- in:run see:sourceSHA256 "bf52bb918b595bb68a0a6304729e8129f3a851dc16cd3980ec5932115f2e7aea" .
39
- in:run see:description "Is the age of a person above some duration?" .
40
- in:run see:compiler "see.js N3-to-JS compiler" .
41
- in:run see:inputFacts 1 .
42
- in:run see:compiledRules 0 .
43
- in:run see:compiledBackwardRules 1 .
44
- in:run see:compiledFuses 0 .
45
- in:run see:compiledQueries 1 .
46
- }
47
- ```
48
-
@@ -1,43 +0,0 @@
1
- # Annotation
2
-
3
- ## Entailment
4
- The derivation produced 1 formula-valued entailment(s).
5
- Main entailment: **:t log:nameOf { :a :name "Alice" }.**
6
-
7
- Selected entailments:
8
- - :t log:nameOf { :a :name "Alice" } .
9
-
10
- ## Explanation
11
- Starts with 4 source fact(s), applies 0 rule(s), and reaches a fixpoint.
12
-
13
- Selected explanation support:
14
- - :t log:nameOf { :a :name "Alice" } . _(source)_
15
-
16
- The formula-valued facts are serialized in the Formal TriG Output section.
17
-
18
- ## Formal TriG Output
19
-
20
- ```trig
21
- @prefix : <https://eyereasoner.github.io/see/examples/annotation#> .
22
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
23
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
24
- @prefix see: <https://example.org/see#> .
25
- @prefix in: <https://example.org/see/input#> .
26
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
27
-
28
- in:metadata {
29
- in:run a see:InputDataset .
30
- in:run see:name "annotation" .
31
- in:run see:title "Annotation" .
32
- in:run see:sourceFile "examples/n3/annotation.n3" .
33
- in:run see:sourceSHA256 "fa6faef8fac2e328ccfb894c21eef260b0935a936b5e9806f8889719e7f39e4f" .
34
- in:run see:description "" .
35
- in:run see:compiler "see.js N3-to-JS compiler" .
36
- in:run see:inputFacts 4 .
37
- in:run see:compiledRules 0 .
38
- in:run see:compiledBackwardRules 0 .
39
- in:run see:compiledFuses 0 .
40
- in:run see:compiledQueries 0 .
41
- }
42
- ```
43
-
@@ -1,50 +0,0 @@
1
- # Backward rule example
2
-
3
- ## Entailment
4
- The derivation produced 1 new fact(s) from 0 stated fact(s).
5
- Main entailment: **5 :isIndeedMoreInterestingThan 3.**
6
-
7
- Selected entailments:
8
- - 5 :isIndeedMoreInterestingThan 3 .
9
-
10
- ## Explanation
11
- Starts with 0 source fact(s), applies 2 rule(s), and reaches a fixpoint.
12
-
13
- Derivation steps:
14
- - Rule 2: 5 :moreInterestingThan 3 => 5 :isIndeedMoreInterestingThan 3 derives 5 :isIndeedMoreInterestingThan 3 .
15
- - Uses: no graph premises; built-ins/constants satisfied the rule.
16
-
17
- Selected explanation support:
18
- - 5 :isIndeedMoreInterestingThan 3 . _(derived by Rule 2)_
19
- - no graph premises; built-ins/constants satisfied the rule.
20
-
21
- The selected facts are serialized in the Formal TriG Output section.
22
-
23
- ## Formal TriG Output
24
-
25
- ```trig
26
- @prefix math: <http://www.w3.org/2000/10/swap/math#> .
27
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
28
- @prefix : <http://example.org/#> .
29
- @prefix see: <https://example.org/see#> .
30
- @prefix in: <https://example.org/see/input#> .
31
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
32
-
33
- 5 :isIndeedMoreInterestingThan 3 .
34
-
35
- in:metadata {
36
- in:run a see:InputDataset .
37
- in:run see:name "backward" .
38
- in:run see:title "Backward rule example" .
39
- in:run see:sourceFile "examples/n3/backward.n3" .
40
- in:run see:sourceSHA256 "328d66402900d98dda0c02e3c64a7f3633f01a0ba148031c17e8fbf353057d33" .
41
- in:run see:description "See https://www.w3.org/2000/10/swap/doc/tutorial-1.pdf page 17" .
42
- in:run see:compiler "see.js N3-to-JS compiler" .
43
- in:run see:inputFacts 0 .
44
- in:run see:compiledRules 1 .
45
- in:run see:compiledBackwardRules 1 .
46
- in:run see:compiledFuses 0 .
47
- in:run see:compiledQueries 0 .
48
- }
49
- ```
50
-
@@ -1,54 +0,0 @@
1
- # Backward recursion coverage
2
-
3
- ## Entailment
4
- The compiled query selected 2 fact(s) after the rule closure was computed.
5
- Main entailment: **:a :reaches :c.**
6
-
7
- Selected entailments:
8
- - :a :reaches :c .
9
- - :a :reaches :b .
10
-
11
- ## Explanation
12
- Starts with 2 source fact(s), applies 3 rule(s), and reaches a fixpoint.
13
- The log:query projection then keeps only the matching fact(s) shown above.
14
-
15
- Derivation steps:
16
- - Rule 3: :a :ancestor ?who => :a :reaches ?who derives :a :reaches :b ., :a :reaches :c .
17
- - Uses: no graph premises; built-ins/constants satisfied the rule.
18
-
19
- Selected explanation support:
20
- - :a :reaches :c . _(derived by Rule 3)_
21
- - no graph premises; built-ins/constants satisfied the rule.
22
- - :a :reaches :b . _(derived by Rule 3)_
23
- - no graph premises; built-ins/constants satisfied the rule.
24
-
25
- The query-selected facts are serialized in the Formal TriG Output section.
26
-
27
- ## Formal TriG Output
28
-
29
- ```trig
30
- @prefix : <urn:example#> .
31
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
32
- @prefix see: <https://example.org/see#> .
33
- @prefix in: <https://example.org/see/input#> .
34
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
35
-
36
- :a :reaches :b .
37
- :a :reaches :c .
38
-
39
- in:metadata {
40
- in:run a see:InputDataset .
41
- in:run see:name "backward_recursion" .
42
- in:run see:title "Backward recursion coverage" .
43
- in:run see:sourceFile "examples/n3/backward_recursion.n3" .
44
- in:run see:sourceSHA256 "1249b9825793b7f0174c87a4d0e44752cb63f3940cc332c0d00fc6bb15a081d1" .
45
- in:run see:description "Demonstrates recursive <= rules compiled into specialized JavaScript." .
46
- in:run see:compiler "see.js N3-to-JS compiler" .
47
- in:run see:inputFacts 2 .
48
- in:run see:compiledRules 1 .
49
- in:run see:compiledBackwardRules 2 .
50
- in:run see:compiledFuses 0 .
51
- in:run see:compiledQueries 1 .
52
- }
53
- ```
54
-
@@ -1,103 +0,0 @@
1
- # Bayes Diagnosis
2
-
3
- ## Entailment
4
- The most likely disease is COVID-19 (posterior = 0.941209).
5
-
6
- Full posterior distribution:
7
- COVID-19 posterior = 0.941209 (unnormalized = 0.00154700)
8
- Influenza posterior = 0.029204 (unnormalized = 0.00004800)
9
- Allergic rhinitis posterior = 0.000456 (unnormalized = 0.00000075)
10
- Bacterial pneumonia posterior = 0.029131 (unnormalized = 0.00004788)
11
-
12
- ## Explanation
13
- Evidence: Fever=present, DryCough=present, LossOfSmell=present, Sneezing=absent, ShortBreath=present. Evidence total (normalizing constant) = 0.00164363. Each posterior is prior(d) times the product of symptom likelihood factors, divided by the evidence total.
14
-
15
- **Generated derivation support**
16
-
17
- Compiled support: 85 source fact(s), 9 rule(s), fixpoint reached before rendering.
18
-
19
- Derivation steps:
20
- - Rule 10 (3 premise pattern(s) => 2 conclusion pattern(s)) derives :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) ., :Case :evidenceTotal 0.00164363 .
21
- - Uses: :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
22
- - Rule 11 (6 premise pattern(s) => 5 conclusion pattern(s)) derives _:r11_6fcdcfca2e82_headBlank30 :disease :COVID19 ., _:r11_6fcdcfca2e82_headBlank30 :unnormalized 0.001547 ., _:r11_6fcdcfca2e82_headBlank30 :posterior 0.941209396275317 ., :Case :result _:r11_6fcdcfca2e82_headBlank30 ., … +16 more
23
- - Uses: :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_; :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived)_; :Case :evidenceTotal 0.00164363 . _(derived)_
24
- - Rule 12 (11 premise pattern(s) => 2 conclusion pattern(s)) derives :Case :winner :COVID19 ., :Case :winnerPosterior 0.941209396275317 .
25
- - Uses: _:r11_6fcdcfca2e82_headBlank30 :disease :COVID19 . _(derived)_; _:r11_6fcdcfca2e82_headBlank30 :posterior 0.941209396275317 . _(derived)_; :Case :result _:r11_6fcdcfca2e82_headBlank30 . _(derived)_; :COVID19 :posterior 0.941209396275317 . _(derived)_; … +3 more premise fact(s)
26
- - Rule 13 (13 premise pattern(s) => 2 conclusion pattern(s)) derives :bayesDiagnosis log:outputString "[authored report]" ., :bayesDiagnosis :recommends :COVID19 .
27
- - Uses: :Case :winner :COVID19 . _(derived)_; :Case :winnerPosterior 0.941209396275317 . _(derived)_; :Case :evidenceTotal 0.00164363 . _(derived)_; :COVID19 :label "COVID-19" . _(source)_; … +4 more premise fact(s)
28
-
29
- Selected explanation support:
30
- - :bayesDiagnosis :recommends :COVID19 . _(derived by Rule 13)_
31
- - :Case :winner :COVID19 . _(derived by Rule 12)_
32
- - _:r11_6fcdcfca2e82_headBlank30 :disease :COVID19 . _(derived by Rule 11)_
33
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
34
- - :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived by Rule 10)_
35
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
36
- - :Case :evidenceTotal 0.00164363 . _(derived by Rule 10)_
37
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
38
- - _:r11_6fcdcfca2e82_headBlank30 :posterior 0.941209396275317 . _(derived by Rule 11)_
39
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
40
- - :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived by Rule 10)_
41
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
42
- - :Case :evidenceTotal 0.00164363 . _(derived by Rule 10)_
43
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
44
- - :Case :result _:r11_6fcdcfca2e82_headBlank30 . _(derived by Rule 11)_
45
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
46
- - :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived by Rule 10)_
47
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
48
- - :Case :evidenceTotal 0.00164363 . _(derived by Rule 10)_
49
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
50
- - :COVID19 :posterior 0.941209396275317 . _(derived by Rule 11)_
51
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
52
- - :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived by Rule 10)_
53
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
54
- - :Case :evidenceTotal 0.00164363 . _(derived by Rule 10)_
55
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
56
- - ... 3 more premise fact(s)
57
- - :Case :winnerPosterior 0.941209396275317 . _(derived by Rule 12)_
58
- - _:r11_6fcdcfca2e82_headBlank30 :disease :COVID19 . _(derived by Rule 11)_
59
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
60
- - :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived by Rule 10)_
61
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
62
- - :Case :evidenceTotal 0.00164363 . _(derived by Rule 10)_
63
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
64
- - _:r11_6fcdcfca2e82_headBlank30 :posterior 0.941209396275317 . _(derived by Rule 11)_
65
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
66
- - :Case :scores (0.001547 0.000048 7.5e-7 0.00004788) . _(derived by Rule 10)_
67
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
68
- - :Case :evidenceTotal 0.00164363 . _(derived by Rule 10)_
69
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
70
- - ... 3 more premise fact(s)
71
- - ... 4 more premise fact(s)
72
- - … support tree truncated after 40 line(s)
73
-
74
- ## Formal TriG Output
75
-
76
- ```trig
77
- @prefix : <https://eyereasoner.github.io/see/examples/bayes-diagnosis#> .
78
- @prefix math: <http://www.w3.org/2000/10/swap/math#> .
79
- @prefix list: <http://www.w3.org/2000/10/swap/list#> .
80
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
81
- @prefix string: <http://www.w3.org/2000/10/swap/string#> .
82
- @prefix see: <https://example.org/see#> .
83
- @prefix in: <https://example.org/see/input#> .
84
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
85
-
86
- :bayesDiagnosis :recommends :COVID19 .
87
-
88
- in:metadata {
89
- in:run a see:InputDataset .
90
- in:run see:name "bayes_diagnosis" .
91
- in:run see:title "Bayes Diagnosis" .
92
- in:run see:sourceFile "examples/n3/bayes_diagnosis.n3" .
93
- in:run see:sourceSHA256 "46feebe5109b413a4143b7bcb4bc77ac6c0b18a8fdd8f6a62ab06c42287035d9" .
94
- in:run see:description "Naive Bayes diagnosis example, adapted from Eyeling's bayes-diagnosis.n3.\nThe facts and rules compute unnormalized likelihoods, normalize them into\nposterior probabilities, and emit a SEE report for the highest posterior.\nValues are illustrative only and are not medical advice." .
95
- in:run see:compiler "see.js N3-to-JS compiler" .
96
- in:run see:inputFacts 85 .
97
- in:run see:compiledRules 4 .
98
- in:run see:compiledBackwardRules 5 .
99
- in:run see:compiledFuses 4 .
100
- in:run see:compiledQueries 1 .
101
- }
102
- ```
103
-
@@ -1,84 +0,0 @@
1
- # Bayes Therapy
2
-
3
- ## Entailment
4
- Recommended therapy: Paxlovid (utility = 3.585174).
5
- expected success : 0.388517
6
- adverse probability : 0.100000
7
-
8
- Therapy utilities:
9
- Paxlovid utility = 3.585174 success = 0.388517 adverse = 0.100000
10
- Oseltamivir utility = 2.611410 success = 0.285141 adverse = 0.080000
11
- Supportive care utility = 2.885120 success = 0.291512 adverse = 0.010000
12
- Antibiotic utility = 0.899526 success = 0.110953 adverse = 0.070000
13
- Antihistamine utility = 0.912689 success = 0.100269 adverse = 0.030000
14
-
15
- ## Explanation
16
- The N3 source first computes disease posteriors from the symptom evidence. It then combines those posterior probabilities with therapy-specific success probabilities, subtracting the weighted adverse-effect penalty from the weighted expected benefit.
17
-
18
- **Generated derivation support**
19
-
20
- Compiled support: 104 source fact(s), 20 rule(s), fixpoint reached before rendering.
21
-
22
- Derivation steps:
23
- - Rule 20 (5 premise pattern(s) => 3 conclusion pattern(s)) derives :Case :scores (0.009282 0.008208 0.00012825 0.00156408) ., :Case :evidenceTotal 0.01918233 ., :Case :posteriors (0.48388282341092 0.42789379600914 0.00668584056264281 0.0815375400172972) .
24
- - Uses: :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
25
- - Rule 21 (4 premise pattern(s) => 1 conclusion pattern(s)) derives :COVID19 :posterior 0.48388282341092 ., :Influenza :posterior 0.42789379600914 ., :AllergicRhinitis :posterior 0.00668584056264281 ., :BacterialPneumonia :posterior 0.0815375400172972 .
26
- - Uses: :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_; :Case :posteriors (0.48388282341092 0.42789379600914 0.00668584056264281 0.0815375400172972) . _(derived)_
27
- - Rule 22 (12 premise pattern(s) => 3 conclusion pattern(s)) derives :Paxlovid :expectedSuccess 0.388517401170765 ., :Paxlovid :expectedAdverse 0.1 ., :Paxlovid :utility 3.58517401170765 ., :Oseltamivir :expectedSuccess 0.285141012588148 ., … +11 more
28
- - Uses: :Case :posteriors (0.48388282341092 0.42789379600914 0.00668584056264281 0.0815375400172972) . _(derived)_; :Paxlovid rdf:type :Therapy . _(source)_; :Paxlovid :successByDisease (0.75 0.05 0.02 0.05) . _(source)_; :Paxlovid :adverse 0.1 . _(source)_; … +14 more premise fact(s)
29
- - Rule 27: :Case :therapies ?ts; (?ts) :bestTherapy ?best => :Case :recommendedTherapy ?best derives :Case :recommendedTherapy :Paxlovid .
30
- - Uses: :Case :therapies (:Paxlovid :Oseltamivir :SupportiveCare :Antibiotic :Antihistamine) . _(source)_
31
- - Rule 28 (21 premise pattern(s) => 2 conclusion pattern(s)) derives :bayesTherapy log:outputString "[authored report]" ., :bayesTherapy :recommends :Paxlovid .
32
- - Uses: :Case :recommendedTherapy :Paxlovid . _(derived)_; :Paxlovid :label "Paxlovid" . _(source)_; :Paxlovid :expectedSuccess 0.388517401170765 . _(derived)_; :Paxlovid :expectedAdverse 0.1 . _(derived)_; … +13 more premise fact(s)
33
-
34
- Selected explanation support:
35
- - :bayesTherapy :recommends :Paxlovid . _(derived by Rule 28)_
36
- - :Case :recommendedTherapy :Paxlovid . _(derived by Rule 27)_
37
- - :Case :therapies (:Paxlovid :Oseltamivir :SupportiveCare :Antibiotic :Antihistamine) . _(source)_
38
- - :Paxlovid :label "Paxlovid" . _(source)_
39
- - :Paxlovid :expectedSuccess 0.388517401170765 . _(derived by Rule 22)_
40
- - :Case :posteriors (0.48388282341092 0.42789379600914 0.00668584056264281 0.0815375400172972) . _(derived by Rule 20)_
41
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
42
- - :Paxlovid rdf:type :Therapy . _(source)_
43
- - :Paxlovid :successByDisease (0.75 0.05 0.02 0.05) . _(source)_
44
- - :Paxlovid :adverse 0.1 . _(source)_
45
- - ... 2 more premise fact(s)
46
- - :Paxlovid :expectedAdverse 0.1 . _(derived by Rule 22)_
47
- - :Case :posteriors (0.48388282341092 0.42789379600914 0.00668584056264281 0.0815375400172972) . _(derived by Rule 20)_
48
- - :Case :diseases (:COVID19 :Influenza :AllergicRhinitis :BacterialPneumonia) . _(source)_
49
- - :Paxlovid rdf:type :Therapy . _(source)_
50
- - :Paxlovid :successByDisease (0.75 0.05 0.02 0.05) . _(source)_
51
- - :Paxlovid :adverse 0.1 . _(source)_
52
- - ... 2 more premise fact(s)
53
- - ... 13 more premise fact(s)
54
-
55
- ## Formal TriG Output
56
-
57
- ```trig
58
- @prefix : <https://eyereasoner.github.io/see/examples/bayes-therapy#> .
59
- @prefix math: <http://www.w3.org/2000/10/swap/math#> .
60
- @prefix list: <http://www.w3.org/2000/10/swap/list#> .
61
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
62
- @prefix string: <http://www.w3.org/2000/10/swap/string#> .
63
- @prefix see: <https://example.org/see#> .
64
- @prefix in: <https://example.org/see/input#> .
65
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
66
-
67
- :bayesTherapy :recommends :Paxlovid .
68
-
69
- in:metadata {
70
- in:run a see:InputDataset .
71
- in:run see:name "bayes_therapy" .
72
- in:run see:title "Bayes Therapy" .
73
- in:run see:sourceFile "examples/n3/bayes_therapy.n3" .
74
- in:run see:sourceSHA256 "18244b81f37328f7d77c8e88a4749891c3d773ffbf19affecd7f118c6208395d" .
75
- in:run see:description "Extends the Bayesian diagnosis model with a therapy utility layer. Adapted\nfrom Eyeling's bayes-therapy.n3. Values are illustrative only and are not\nmedical advice." .
76
- in:run see:compiler "see.js N3-to-JS compiler" .
77
- in:run see:inputFacts 104 .
78
- in:run see:compiledRules 5 .
79
- in:run see:compiledBackwardRules 15 .
80
- in:run see:compiledFuses 8 .
81
- in:run see:compiledQueries 1 .
82
- }
83
- ```
84
-
@@ -1,164 +0,0 @@
1
- # BMI — Body Mass Index example.
2
-
3
- ## Entailment
4
- BMI = 22.72
5
- Category = Normal
6
- At height 178 cm, a healthy-weight range is about 58.6–78.9 kg (BMI 18.5–24.9).
7
-
8
- ## Explanation
9
- BMI is defined as weight in kilograms divided by height in meters squared. This program first normalizes the input to SI units, computes BMI, and then applies WHO adult categories as half-open intervals. The healthy-weight band is the weight range at the same height that corresponds to BMI 18.5 through 24.9.
10
-
11
- **Generated derivation support**
12
-
13
- Compiled support: 3 source fact(s), 12 rule(s), fixpoint reached before rendering.
14
-
15
- Derivation steps:
16
- - Rule 1 (4 premise pattern(s) => 3 conclusion pattern(s)) derives :Case :weightKg 72 ., :Case :heightM 1.78 ., :Reason :units "Inputs were already metric, so kilograms stay kilograms and centimeters are divided by 100 to obtain meters." .
17
- - Uses: :Input :unitSystem "metric" . _(source)_; :Input :weight 72 . _(source)_; :Input :height 178 . _(source)_
18
- - Rule 3 (15 premise pattern(s) => 7 conclusion pattern(s)) derives :Case :heightSquared 3.1684 ., :Case :bmi 22.7244034844085 ., :Case :bmiRounded 22.72 ., :Case :healthyMinKg 58.6154 ., … +3 more
19
- - Uses: :Case :weightKg 72 . _(derived)_; :Case :heightM 1.78 . _(derived)_
20
- - Rule 5 (3 premise pattern(s) => 1 conclusion pattern(s)) derives :Decision :category "Normal" .
21
- - Uses: :Case :bmi 22.7244034844085 . _(derived)_
22
- - Rule 10 (7 premise pattern(s) => 5 conclusion pattern(s)) derives :Answer :bmi 22.72 ., :Answer :category "Normal" ., :Answer :healthyMinKg 58.6 ., :Answer :healthyMaxKg 78.9 ., … +1 more
23
- - Uses: :Case :bmiRounded 22.72 . _(derived)_; :Case :healthyMinKgRounded 58.6 . _(derived)_; :Case :healthyMaxKgRounded 78.9 . _(derived)_; :Case :heightM 1.78 . _(derived)_; … +1 more premise fact(s)
24
- - Rule 11 (6 premise pattern(s) => 4 conclusion pattern(s)) derives :Reason :formula "BMI is defined as weight in kilograms divided by height in meters squared." ., :Reason :calculation "The normalized weight and height were used to compute BMI, then the result was mapped to the WHO adult category table." ., :Reason :categoryRule "Normal" ., :Reason :unitsExplanation "Inputs were already metric, so kilograms stay kilograms and centimeters are divided by 100 to obtain meters." .
25
- - Uses: :Case :weightKg 72 . _(derived)_; :Case :heightM 1.78 . _(derived)_; :Case :heightSquared 3.1684 . _(derived)_; :Case :bmiRounded 22.72 . _(derived)_; … +2 more premise fact(s)
26
- - Rule 13 (6 premise pattern(s) => 1 conclusion pattern(s)) derives :report log:outputString "[authored report]" .
27
- - Uses: :Answer :bmi 22.72 . _(derived)_; :Answer :category "Normal" . _(derived)_; :Answer :healthyMinKg 58.6 . _(derived)_; :Answer :healthyMaxKg 78.9 . _(derived)_; … +1 more premise fact(s)
28
-
29
- Selected explanation support:
30
- - :report log:outputString "[authored report]" . _(authored report, Rule 13)_
31
- - :Reason :unitsExplanation "Inputs were already metric, so kilograms stay kilograms and centimeters are divided by 100 to obtain meters." . _(derived by Rule 11)_
32
- - :Case :weightKg 72 . _(derived by Rule 1)_
33
- - :Input :unitSystem "metric" . _(source)_
34
- - :Input :weight 72 . _(source)_
35
- - :Input :height 178 . _(source)_
36
- - :Case :heightM 1.78 . _(derived by Rule 1)_
37
- - :Input :unitSystem "metric" . _(source)_
38
- - :Input :weight 72 . _(source)_
39
- - :Input :height 178 . _(source)_
40
- - :Case :heightSquared 3.1684 . _(derived by Rule 3)_
41
- - :Case :weightKg 72 . _(derived by Rule 1)_
42
- - :Input :unitSystem "metric" . _(source)_
43
- - :Input :weight 72 . _(source)_
44
- - :Input :height 178 . _(source)_
45
- - :Case :heightM 1.78 . _(derived by Rule 1)_
46
- - :Input :unitSystem "metric" . _(source)_
47
- - :Input :weight 72 . _(source)_
48
- - :Input :height 178 . _(source)_
49
- - :Case :bmiRounded 22.72 . _(derived by Rule 3)_
50
- - :Case :weightKg 72 . _(derived by Rule 1)_
51
- - :Input :unitSystem "metric" . _(source)_
52
- - :Input :weight 72 . _(source)_
53
- - :Input :height 178 . _(source)_
54
- - :Case :heightM 1.78 . _(derived by Rule 1)_
55
- - :Input :unitSystem "metric" . _(source)_
56
- - :Input :weight 72 . _(source)_
57
- - :Input :height 178 . _(source)_
58
- - ... 2 more premise fact(s)
59
- - :Reason :categoryRule "Normal" . _(derived by Rule 11)_
60
- - :Case :weightKg 72 . _(derived by Rule 1)_
61
- - :Input :unitSystem "metric" . _(source)_
62
- - :Input :weight 72 . _(source)_
63
- - :Input :height 178 . _(source)_
64
- - :Case :heightM 1.78 . _(derived by Rule 1)_
65
- - :Input :unitSystem "metric" . _(source)_
66
- - :Input :weight 72 . _(source)_
67
- - :Input :height 178 . _(source)_
68
- - :Case :heightSquared 3.1684 . _(derived by Rule 3)_
69
- - :Case :weightKg 72 . _(derived by Rule 1)_
70
- - :Input :unitSystem "metric" . _(source)_
71
- - :Input :weight 72 . _(source)_
72
- - :Input :height 178 . _(source)_
73
- - :Case :heightM 1.78 . _(derived by Rule 1)_
74
- - :Input :unitSystem "metric" . _(source)_
75
- - :Input :weight 72 . _(source)_
76
- - :Input :height 178 . _(source)_
77
- - :Case :bmiRounded 22.72 . _(derived by Rule 3)_
78
- - :Case :weightKg 72 . _(derived by Rule 1)_
79
- - :Input :unitSystem "metric" . _(source)_
80
- - :Input :weight 72 . _(source)_
81
- - :Input :height 178 . _(source)_
82
- - :Case :heightM 1.78 . _(derived by Rule 1)_
83
- - :Input :unitSystem "metric" . _(source)_
84
- - :Input :weight 72 . _(source)_
85
- - :Input :height 178 . _(source)_
86
- - ... 2 more premise fact(s)
87
- - :Reason :calculation "The normalized weight and height were used to compute BMI, then the result was mapped to the WHO adult category table." . _(derived by Rule 11)_
88
- - :Case :weightKg 72 . _(derived by Rule 1)_
89
- - :Input :unitSystem "metric" . _(source)_
90
- - :Input :weight 72 . _(source)_
91
- - :Input :height 178 . _(source)_
92
- - :Case :heightM 1.78 . _(derived by Rule 1)_
93
- - :Input :unitSystem "metric" . _(source)_
94
- - :Input :weight 72 . _(source)_
95
- - :Input :height 178 . _(source)_
96
- - :Case :heightSquared 3.1684 . _(derived by Rule 3)_
97
- - :Case :weightKg 72 . _(derived by Rule 1)_
98
- - :Input :unitSystem "metric" . _(source)_
99
- - :Input :weight 72 . _(source)_
100
- - :Input :height 178 . _(source)_
101
- - :Case :heightM 1.78 . _(derived by Rule 1)_
102
- - :Input :unitSystem "metric" . _(source)_
103
- - :Input :weight 72 . _(source)_
104
- - :Input :height 178 . _(source)_
105
- - :Case :bmiRounded 22.72 . _(derived by Rule 3)_
106
- - :Case :weightKg 72 . _(derived by Rule 1)_
107
- - :Input :unitSystem "metric" . _(source)_
108
- - :Input :weight 72 . _(source)_
109
- - :Input :height 178 . _(source)_
110
- - :Case :heightM 1.78 . _(derived by Rule 1)_
111
- - :Input :unitSystem "metric" . _(source)_
112
- - :Input :weight 72 . _(source)_
113
- - :Input :height 178 . _(source)_
114
- - ... 2 more premise fact(s)
115
-
116
- ## Formal TriG Output
117
-
118
- ```trig
119
- @prefix : <https://example.org/bmi#> .
120
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
121
- @prefix math: <http://www.w3.org/2000/10/swap/math#> .
122
- @prefix string: <http://www.w3.org/2000/10/swap/string#> .
123
- @prefix see: <https://example.org/see#> .
124
- @prefix in: <https://example.org/see/input#> .
125
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
126
-
127
- :Case :weightKg 72 .
128
- :Case :heightM 1.78 .
129
- :Reason :units "Inputs were already metric, so kilograms stay kilograms and centimeters are divided by 100 to obtain meters." .
130
- :Case :heightSquared 3.1684 .
131
- :Case :bmi 22.7244034844085 .
132
- :Case :bmiRounded 22.72 .
133
- :Case :healthyMinKg 58.6154 .
134
- :Case :healthyMaxKg 78.89316 .
135
- :Case :healthyMinKgRounded 58.6 .
136
- :Case :healthyMaxKgRounded 78.9 .
137
- :Decision :category "Normal" .
138
- :Answer :bmi 22.72 .
139
- :Answer :category "Normal" .
140
- :Answer :healthyMinKg 58.6 .
141
- :Answer :healthyMaxKg 78.9 .
142
- :Answer :heightCm 178 .
143
- :Reason :formula "BMI is defined as weight in kilograms divided by height in meters squared." .
144
- :Reason :calculation "The normalized weight and height were used to compute BMI, then the result was mapped to the WHO adult category table." .
145
- :Reason :categoryRule "Normal" .
146
- :Reason :unitsExplanation "Inputs were already metric, so kilograms stay kilograms and centimeters are divided by 100 to obtain meters." .
147
- :report log:outputString "=== Answer ===\nBMI = 22.72\nCategory = Normal\nAt height 178 cm, a healthy-weight range is about 58.6–78.9 kg (BMI 18.5–24.9).\n\n=== Explanation ===\nBMI is defined as weight in kilograms divided by height in meters squared. This program first normalizes the input to SI units, computes BMI, and then applies WHO adult categories as half-open intervals. The healthy-weight band is the weight range at the same height that corresponds to BMI 18.5 through 24.9.\n\n" .
148
-
149
- in:metadata {
150
- in:run a see:InputDataset .
151
- in:run see:name "bmi" .
152
- in:run see:title "BMI — Body Mass Index example." .
153
- in:run see:sourceFile "examples/n3/bmi.n3" .
154
- in:run see:sourceSHA256 "c7163f49a56f4405350787563e15aee0975fabd71ca773a8b32077b19ef25d3c" .
155
- in:run see:description "This example turns a familiar health calculation into a small, inspectable\nSEE example. It normalizes either metric or US inputs, computes BMI, assigns\na WHO adult category, and derives a healthy-range weight band for the given\nheight. The report explains the result and includes independent validations for\nboundary handling and category behavior.\nFor reproducibility and documentation only; not medical advice." .
156
- in:run see:compiler "see.js N3-to-JS compiler" .
157
- in:run see:inputFacts 3 .
158
- in:run see:compiledRules 12 .
159
- in:run see:compiledBackwardRules 0 .
160
- in:run see:compiledFuses 1 .
161
- in:run see:compiledQueries 0 .
162
- }
163
- ```
164
-
@@ -1,99 +0,0 @@
1
- # Builtin coverage smoke
2
-
3
- ## Entailment
4
- The compiled query selected 29 fact(s) after the rule closure was computed.
5
- Main entailment: **:assurance :member "c".**
6
-
7
- Selected entailments:
8
- - :assurance :member "c" .
9
- - :assurance :member "b" .
10
- - :assurance :formula { :x :p :y . :a :b :c } .
11
- - :assurance :month 1 .
12
- - :assurance :year 2024 .
13
- - :assurance :member "a" .
14
-
15
- ## Explanation
16
- Starts with 0 source fact(s), applies 1 rule(s), and reaches a fixpoint.
17
- The log:query projection then keeps only the matching fact(s) shown above.
18
-
19
- Derivation steps:
20
- - Rule 1 (30 premise pattern(s) => 27 conclusion pattern(s)) derives :assurance :sum 9 ., :assurance :product 24 ., :assurance :difference 5 ., :assurance :quotient 3 ., … +25 more
21
- - Uses: no graph premises; built-ins/constants satisfied the rule.
22
-
23
- Selected explanation support:
24
- - :assurance :member "c" . _(derived by Rule 1)_
25
- - no graph premises; built-ins/constants satisfied the rule.
26
- - :assurance :member "b" . _(derived by Rule 1)_
27
- - no graph premises; built-ins/constants satisfied the rule.
28
- - :assurance :formula { :x :p :y . :a :b :c } . _(derived by Rule 1)_
29
- - no graph premises; built-ins/constants satisfied the rule.
30
- - :assurance :month 1 . _(derived by Rule 1)_
31
- - no graph premises; built-ins/constants satisfied the rule.
32
- - :assurance :year 2024 . _(derived by Rule 1)_
33
- - no graph premises; built-ins/constants satisfied the rule.
34
- - :assurance :member "a" . _(derived by Rule 1)_
35
- - no graph premises; built-ins/constants satisfied the rule.
36
-
37
- The query-selected facts are serialized in the Formal TriG Output section.
38
-
39
- ## Formal TriG Output
40
-
41
- ```trig
42
- @prefix : <urn:example#> .
43
- @prefix log: <http://www.w3.org/2000/10/swap/log#> .
44
- @prefix see: <https://example.org/see#> .
45
- @prefix in: <https://example.org/see/input#> .
46
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
47
- @prefix out: <https://example.org/see/output#> .
48
-
49
- :assurance :sum 9 .
50
- :assurance :product 24 .
51
- :assurance :difference 5 .
52
- :assurance :quotient 3 .
53
- :assurance :integerQuotient 2 .
54
- :assurance :remainder 1 .
55
- :assurance :negation -3 .
56
- :assurance :absoluteValue 3 .
57
- :assurance :degrees 180 .
58
- :assurance :stringLength 3 .
59
- :assurance :concatenation "abc" .
60
- :assurance :format "item x 7" .
61
- :assurance :scrape "ef" .
62
- :assurance :charAt "b" .
63
- :assurance :setCharAt "aZc" .
64
- :assurance :sha256 "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" .
65
- :assurance :first "a" .
66
- :assurance :rest ("b" "c") .
67
- :assurance :last "c" .
68
- :assurance :listLength 3 .
69
- :assurance :reverse ("c" "b" "a") .
70
- :assurance :removed ("b") .
71
- :assurance :appended ("a" "b" "c") .
72
- :assurance :member "a" .
73
- :assurance :year 2024 .
74
- :assurance :month 1 .
75
- :assurance :formula out:formula1 .
76
-
77
- out:formula1 {
78
- :x :p :y .
79
- :a :b :c .
80
- }
81
- :assurance :member "b" .
82
- :assurance :member "c" .
83
-
84
- in:metadata {
85
- in:run a see:InputDataset .
86
- in:run see:name "builtin_coverage" .
87
- in:run see:title "Builtin coverage smoke" .
88
- in:run see:sourceFile "examples/n3/builtin_coverage.n3" .
89
- in:run see:sourceSHA256 "4ea25a79da436dd28fb54de1a7d0f5d49729b47f384f9bd36411c5cc1b821dbc" .
90
- in:run see:description "Exercises math, string, list, crypto, time, and log builtins in compiled JavaScript." .
91
- in:run see:compiler "see.js N3-to-JS compiler" .
92
- in:run see:inputFacts 0 .
93
- in:run see:compiledRules 1 .
94
- in:run see:compiledBackwardRules 0 .
95
- in:run see:compiledFuses 0 .
96
- in:run see:compiledQueries 1 .
97
- }
98
- ```
99
-