eyeling 1.5.11 → 1.5.13

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 (96) hide show
  1. package/README.md +4 -6
  2. package/examples/age.n3 +29 -0
  3. package/examples/backward.n3 +24 -0
  4. package/examples/basic-monadic.n3 +10032 -0
  5. package/examples/cat-koko.n3 +29 -0
  6. package/examples/collect-all-in.n3 +32 -0
  7. package/examples/complex.n3 +142 -0
  8. package/examples/control-system.n3 +77 -0
  9. package/examples/crypto-builtins-tests.n3 +60 -0
  10. package/examples/deep-taxonomy-10.n3 +21 -0
  11. package/examples/deep-taxonomy-100.n3 +111 -0
  12. package/examples/deep-taxonomy-1000.n3 +1011 -0
  13. package/examples/deep-taxonomy-10000.n3 +10011 -0
  14. package/examples/derived-backward-rule-2.n3 +28 -0
  15. package/examples/derived-backward-rule.n3 +32 -0
  16. package/examples/derived-rule.n3 +19 -0
  17. package/examples/dijkstra.n3 +64 -0
  18. package/examples/dog.n3 +21 -0
  19. package/examples/equals.n3 +12 -0
  20. package/examples/existential-rule.n3 +18 -0
  21. package/examples/fibonacci.n3 +34 -0
  22. package/examples/for-all-in.n3 +21 -0
  23. package/examples/french-cities.n3 +32 -0
  24. package/examples/fuse.n3 +13 -0
  25. package/examples/good-cobbler.n3 +18 -0
  26. package/examples/gray-code-counter.n3 +64 -0
  27. package/examples/hanoi.n3 +21 -0
  28. package/examples/liar.n3 +6 -0
  29. package/examples/list-builtins-tests.n3 +84 -0
  30. package/examples/lldm.n3 +133 -0
  31. package/examples/math-builtins-tests.n3 +612 -0
  32. package/examples/monkey.n3 +11 -0
  33. package/examples/output/age.n3 +20 -0
  34. package/examples/output/backward.n3 +18 -0
  35. package/examples/output/basic-monadic.n3 +122 -0
  36. package/examples/output/cat-koko.n3 +125 -0
  37. package/examples/output/collect-all-in.n3 +122 -0
  38. package/examples/output/complex.n3 +57 -0
  39. package/examples/output/control-system.n3 +79 -0
  40. package/examples/output/crypto-builtins-tests.n3 +66 -0
  41. package/examples/output/deep-taxonomy-10.n3 +636 -0
  42. package/examples/output/deep-taxonomy-100.n3 +6036 -0
  43. package/examples/output/deep-taxonomy-1000.n3 +60036 -0
  44. package/examples/output/deep-taxonomy-10000.n3 +600036 -0
  45. package/examples/output/derived-backward-rule-2.n3 +71 -0
  46. package/examples/output/derived-backward-rule.n3 +53 -0
  47. package/examples/output/derived-rule.n3 +52 -0
  48. package/examples/output/dijkstra.n3 +315 -0
  49. package/examples/output/dog.n3 +33 -0
  50. package/examples/output/equals.n3 +18 -0
  51. package/examples/output/existential-rule.n3 +38 -0
  52. package/examples/output/fibonacci.n3 +44 -0
  53. package/examples/output/for-all-in.n3 +30 -0
  54. package/examples/output/french-cities.n3 +507 -0
  55. package/examples/output/fuse.n3 +1 -0
  56. package/examples/output/good-cobbler.n3 +27 -0
  57. package/examples/output/gray-code-counter.n3 +20 -0
  58. package/examples/output/hanoi.n3 +20 -0
  59. package/examples/output/liar.n3 +1 -0
  60. package/examples/output/list-builtins-tests.n3 +148 -0
  61. package/examples/output/lldm.n3 +1000 -0
  62. package/examples/output/math-builtins-tests.n3 +4479 -0
  63. package/examples/output/monkey.n3 +40 -0
  64. package/examples/output/peano.n3 +26 -0
  65. package/examples/output/pi.n3 +20 -0
  66. package/examples/output/polygon.n3 +20 -0
  67. package/examples/output/reordering.n3 +29 -0
  68. package/examples/output/rule-matching.n3 +29 -0
  69. package/examples/output/self-referential.n3 +88 -0
  70. package/examples/output/similar.n3 +18 -0
  71. package/examples/output/skolem.n3 +20 -0
  72. package/examples/output/snaf.n3 +26 -0
  73. package/examples/output/socrates.n3 +24 -0
  74. package/examples/output/string-builtins-tests.n3 +258 -0
  75. package/examples/output/turing.n3 +44 -0
  76. package/examples/output/uri.n3 +46 -0
  77. package/examples/output/witch.n3 +115 -0
  78. package/examples/output/zebra.n3 +114 -0
  79. package/examples/peano.n3 +45 -0
  80. package/examples/pi.n3 +32 -0
  81. package/examples/polygon.n3 +26 -0
  82. package/examples/reordering.n3 +23 -0
  83. package/examples/rule-matching.n3 +15 -0
  84. package/examples/self-referential.n3 +32 -0
  85. package/examples/similar.n3 +28 -0
  86. package/examples/skolem.n3 +15 -0
  87. package/examples/snaf.n3 +18 -0
  88. package/examples/socrates.n3 +19 -0
  89. package/examples/string-builtins-tests.n3 +210 -0
  90. package/examples/test +154 -0
  91. package/examples/turing.n3 +93 -0
  92. package/examples/uri.n3 +17 -0
  93. package/examples/witch.n3 +33 -0
  94. package/examples/zebra.n3 +47 -0
  95. package/package.json +6 -5
  96. package/test/api.test.js +22 -0
package/README.md CHANGED
@@ -34,14 +34,13 @@ This link preloads a small “Socrates is Mortal” ruleset:
34
34
 
35
35
  - A reasonably recent Node.js (anything modern with `BigInt` support is fine).
36
36
 
37
- ```md
38
- ## Install (npm)
37
+ ### Install (npm)
39
38
 
40
39
  ```bash
41
40
  npm i eyeling
42
41
  ```
43
42
 
44
- ## CLI (npm)
43
+ ### CLI (npm)
45
44
 
46
45
  Run on a file:
47
46
 
@@ -51,7 +50,7 @@ npx eyeling examples/socrates.n3
51
50
 
52
51
  (Or install globally: `npm i -g eyeling` and run `eyeling ...`.)
53
52
 
54
- ## JavaScript API (Node)
53
+ ### JavaScript API (Node)
55
54
 
56
55
  ```js
57
56
  const { reason } = require('eyeling');
@@ -114,8 +113,7 @@ node eyeling.js -n examples/socrates.n3
114
113
  ### Run all examples
115
114
 
116
115
  ```bash
117
- cd examples
118
- ./test
116
+ npm run test:examples
119
117
  ```
120
118
 
121
119
  This runs `eyeling.js` over each example and compares against the golden outputs in `examples/output`.
@@ -0,0 +1,29 @@
1
+ # -----------
2
+ # Age checker
3
+ # -----------
4
+ #
5
+ # Is the age of a person above some duration?
6
+
7
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
8
+ @prefix time: <http://www.w3.org/2000/10/swap/time#>.
9
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
10
+ @prefix log: <http://www.w3.org/2000/10/swap/log#>.
11
+ @prefix : <https://example.org/#>.
12
+
13
+ # person data
14
+ :patH :birthDay "1944-08-21"^^xsd:date.
15
+
16
+ # is the age of a person above some duration?
17
+ { ?S :ageAbove ?A } <= {
18
+ ?S :birthDay ?B.
19
+ "" time:localTime ?D.
20
+ (?D ?B) math:difference ?F.
21
+ ?F math:greaterThan ?A.
22
+ }.
23
+
24
+ # test
25
+ {
26
+ ?S :ageAbove "P80Y"^^xsd:duration.
27
+ } => {
28
+ :test :is true.
29
+ }.
@@ -0,0 +1,24 @@
1
+ # ---------------------
2
+ # Backward rule example
3
+ # ---------------------
4
+ #
5
+ # See https://www.w3.org/2000/10/swap/doc/tutorial-1.pdf page 17
6
+
7
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
8
+ @prefix log: <http://www.w3.org/2000/10/swap/log#>.
9
+ @prefix : <http://example.org/#>.
10
+
11
+ # something is more interesting if it is greater
12
+ {
13
+ ?X :moreInterestingThan ?Y.
14
+ } <= {
15
+ ?X math:greaterThan ?Y.
16
+ }.
17
+
18
+ # derivation (forward)
19
+ {
20
+ 5 :moreInterestingThan 3.
21
+ } => {
22
+ 5 :isIndeedMoreInterestingThan 3.
23
+ }.
24
+