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.
- package/README.md +4 -6
- package/examples/age.n3 +29 -0
- package/examples/backward.n3 +24 -0
- package/examples/basic-monadic.n3 +10032 -0
- package/examples/cat-koko.n3 +29 -0
- package/examples/collect-all-in.n3 +32 -0
- package/examples/complex.n3 +142 -0
- package/examples/control-system.n3 +77 -0
- package/examples/crypto-builtins-tests.n3 +60 -0
- package/examples/deep-taxonomy-10.n3 +21 -0
- package/examples/deep-taxonomy-100.n3 +111 -0
- package/examples/deep-taxonomy-1000.n3 +1011 -0
- package/examples/deep-taxonomy-10000.n3 +10011 -0
- package/examples/derived-backward-rule-2.n3 +28 -0
- package/examples/derived-backward-rule.n3 +32 -0
- package/examples/derived-rule.n3 +19 -0
- package/examples/dijkstra.n3 +64 -0
- package/examples/dog.n3 +21 -0
- package/examples/equals.n3 +12 -0
- package/examples/existential-rule.n3 +18 -0
- package/examples/fibonacci.n3 +34 -0
- package/examples/for-all-in.n3 +21 -0
- package/examples/french-cities.n3 +32 -0
- package/examples/fuse.n3 +13 -0
- package/examples/good-cobbler.n3 +18 -0
- package/examples/gray-code-counter.n3 +64 -0
- package/examples/hanoi.n3 +21 -0
- package/examples/liar.n3 +6 -0
- package/examples/list-builtins-tests.n3 +84 -0
- package/examples/lldm.n3 +133 -0
- package/examples/math-builtins-tests.n3 +612 -0
- package/examples/monkey.n3 +11 -0
- package/examples/output/age.n3 +20 -0
- package/examples/output/backward.n3 +18 -0
- package/examples/output/basic-monadic.n3 +122 -0
- package/examples/output/cat-koko.n3 +125 -0
- package/examples/output/collect-all-in.n3 +122 -0
- package/examples/output/complex.n3 +57 -0
- package/examples/output/control-system.n3 +79 -0
- package/examples/output/crypto-builtins-tests.n3 +66 -0
- package/examples/output/deep-taxonomy-10.n3 +636 -0
- package/examples/output/deep-taxonomy-100.n3 +6036 -0
- package/examples/output/deep-taxonomy-1000.n3 +60036 -0
- package/examples/output/deep-taxonomy-10000.n3 +600036 -0
- package/examples/output/derived-backward-rule-2.n3 +71 -0
- package/examples/output/derived-backward-rule.n3 +53 -0
- package/examples/output/derived-rule.n3 +52 -0
- package/examples/output/dijkstra.n3 +315 -0
- package/examples/output/dog.n3 +33 -0
- package/examples/output/equals.n3 +18 -0
- package/examples/output/existential-rule.n3 +38 -0
- package/examples/output/fibonacci.n3 +44 -0
- package/examples/output/for-all-in.n3 +30 -0
- package/examples/output/french-cities.n3 +507 -0
- package/examples/output/fuse.n3 +1 -0
- package/examples/output/good-cobbler.n3 +27 -0
- package/examples/output/gray-code-counter.n3 +20 -0
- package/examples/output/hanoi.n3 +20 -0
- package/examples/output/liar.n3 +1 -0
- package/examples/output/list-builtins-tests.n3 +148 -0
- package/examples/output/lldm.n3 +1000 -0
- package/examples/output/math-builtins-tests.n3 +4479 -0
- package/examples/output/monkey.n3 +40 -0
- package/examples/output/peano.n3 +26 -0
- package/examples/output/pi.n3 +20 -0
- package/examples/output/polygon.n3 +20 -0
- package/examples/output/reordering.n3 +29 -0
- package/examples/output/rule-matching.n3 +29 -0
- package/examples/output/self-referential.n3 +88 -0
- package/examples/output/similar.n3 +18 -0
- package/examples/output/skolem.n3 +20 -0
- package/examples/output/snaf.n3 +26 -0
- package/examples/output/socrates.n3 +24 -0
- package/examples/output/string-builtins-tests.n3 +258 -0
- package/examples/output/turing.n3 +44 -0
- package/examples/output/uri.n3 +46 -0
- package/examples/output/witch.n3 +115 -0
- package/examples/output/zebra.n3 +114 -0
- package/examples/peano.n3 +45 -0
- package/examples/pi.n3 +32 -0
- package/examples/polygon.n3 +26 -0
- package/examples/reordering.n3 +23 -0
- package/examples/rule-matching.n3 +15 -0
- package/examples/self-referential.n3 +32 -0
- package/examples/similar.n3 +28 -0
- package/examples/skolem.n3 +15 -0
- package/examples/snaf.n3 +18 -0
- package/examples/socrates.n3 +19 -0
- package/examples/string-builtins-tests.n3 +210 -0
- package/examples/test +154 -0
- package/examples/turing.n3 +93 -0
- package/examples/uri.n3 +17 -0
- package/examples/witch.n3 +33 -0
- package/examples/zebra.n3 +47 -0
- package/package.json +6 -5
- 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
|
-
|
|
38
|
-
## Install (npm)
|
|
37
|
+
### Install (npm)
|
|
39
38
|
|
|
40
39
|
```bash
|
|
41
40
|
npm i eyeling
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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`.
|
package/examples/age.n3
ADDED
|
@@ -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
|
+
|