eyeling 1.5.28 → 1.5.30

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 CHANGED
@@ -9,8 +9,8 @@ A minimal [Notation3 (N3)](https://notation3.org/) reasoner in **JavaScript**.
9
9
  - a practical N3/Turtle superset (enough for lots of real rulesets)
10
10
  - supports forward (`=>`) + backward (`<=`) chaining over Horn-style rules
11
11
  - prints only newly derived forward facts, optionally preceded by compact proof comments
12
- - we never want to leak raw data, hence pass-only-new and backward rules for functions that work with raw data
13
- - and of course we also keep all reasoning in the browser
12
+ - “pass-only-new” style output (we never want to leak raw input data; backward rules can act like “functions” over raw data)
13
+ - works fully client-side (browser) and in Node.js
14
14
 
15
15
  ## Playground (in your browser)
16
16
 
@@ -75,14 +75,13 @@ ESM:
75
75
 
76
76
  ```js
77
77
  import eyeling from "eyeling";
78
-
79
78
  const output = eyeling.reason({ proofComments: false }, input);
80
79
  console.log(output);
81
80
  ```
82
81
 
83
82
  Note: the API currently shells out to the bundled `eyeling.js` CLI under the hood (simple + robust).
84
83
 
85
- ### Testing
84
+ ## Testing
86
85
 
87
86
  From a repo checkout:
88
87
 
@@ -134,15 +133,6 @@ node eyeling.js --no-proof-comments examples/socrates.n3
134
133
  node eyeling.js -n examples/socrates.n3
135
134
  ```
136
135
 
137
- ### Run all examples
138
-
139
- ```bash
140
- npm run test:examples
141
- ```
142
-
143
- This runs `eyeling.js` over each example and compares against the golden outputs in `examples/output`
144
- (works both in a git checkout and in an npm-installed package).
145
-
146
136
  ## What output do I get?
147
137
 
148
138
  For each newly derived triple, `eyeling` prints:
@@ -194,6 +184,10 @@ Supported:
194
184
  - forward rules `{ P } => { C } .`
195
185
  - backward rules `{ H } <= { B } .`
196
186
  - datatyped literals with `^^`
187
+ - language-tagged string literals: `"hello"@en`, `"colour"@en-GB`
188
+ - long string literals: `"""..."""` (can contain newlines; can also carry a language tag)
189
+ - inverted predicate sugar: `?x <- :p ?y` (swaps subject/object for that predicate)
190
+ - resource paths (forward `!` and reverse `^`): `:joe!:hasAddress!:hasCity "Metropolis".`
197
191
  - `#` line comments
198
192
 
199
193
  Non-goals / current limits:
@@ -244,7 +238,7 @@ As soon as the premise is provable, `eyeling` exits with status code `2`.
244
238
  - **crypto**: `crypto:md5` `crypto:sha` `crypto:sha256` `crypto:sha512`
245
239
  - **list**: `list:append` `list:first` `list:firstRest` `list:in` `list:iterate` `list:last` `list:length` `list:map` `list:member` `list:memberAt` `list:notMember` `list:remove` `list:rest` `list:reverse` `list:sort`
246
240
  - **log**: `log:collectAllIn` `log:equalTo` `log:forAllIn` `log:impliedBy` `log:implies` `log:notEqualTo` `log:notIncludes` `log:skolem` `log:uri`
247
- - **math**: `math:absoluteValue` `math:acos` `math:asin` `math:atan` `math:cos` `math:cosh` `math:degrees` `math:difference` `math:equalTo` `math:exponentiation` `math:greaterThan` `math:lessThan` `math:negation` `math:notEqualTo` `math:notGreaterThan` `math:notLessThan` `math:product` `math:quotient` `math:remainder` `math:rounded` `math:sin` `math:sinh` `math:sum` `math:tan` `math:tanh`
241
+ - **math**: `math:absoluteValue` `math:acos` `math:asin` `math:atan` `math:cos` `math:cosh` `math:degrees` `math:difference` `math:equalTo` `math:exponentiation` `math:greaterThan` `math:integerQuotient` `math:lessThan` `math:negation` `math:notEqualTo` `math:notGreaterThan` `math:notLessThan` `math:product` `math:quotient` `math:remainder` `math:rounded` `math:sin` `math:sinh` `math:sum` `math:tan` `math:tanh`
248
242
  - **string**: `string:concatenation` `string:contains` `string:containsIgnoringCase` `string:endsWith` `string:equalIgnoringCase` `string:format` `string:greaterThan` `string:lessThan` `string:matches` `string:notEqualIgnoringCase` `string:notGreaterThan` `string:notLessThan` `string:notMatches` `string:replace` `string:scrape` `string:startsWith`
249
243
  - **time**: `time:localTime`
250
244
 
@@ -0,0 +1,78 @@
1
+ # =====================================================================
2
+ # Easter Date
3
+ # Calculation of easter dates.
4
+ # original copy at http://www.w3.org/2000/10/swap/test/easter/easter.n3
5
+ # =====================================================================
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 string: <http://www.w3.org/2000/10/swap/string#>.
10
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
11
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
12
+ @prefix prolog: <http://eulersharp.sourceforge.net/2003/03swap/prolog#>.
13
+ @prefix : <http://www.agfa.com/w3c/euler/easterP#>.
14
+
15
+ <> rdfs:comment """
16
+ Divide by Quotient Remainder
17
+ ---------------------------------------------------
18
+ y 19 j
19
+ y 100 k h
20
+ k 4 m n
21
+ k + 8 25 p
22
+ k - p + 1 3 q
23
+ 19j + k - m - q + 15 30 r
24
+ h 4 s u
25
+ 32 + 2n + 2s - r - u 7 v
26
+ j + 11r + 22v 451 w
27
+ r + v - 7w + 114 31 x z
28
+
29
+ Here x is the number of the month ond 1 + z is the day of that
30
+ month upon which Easter Sunday falls in the year y.
31
+ """.
32
+
33
+ 2021 a :Year.
34
+ 2022 a :Year.
35
+ 2023 a :Year.
36
+ 2024 a :Year.
37
+ 2025 a :Year.
38
+ 2026 a :Year.
39
+ 2027 a :Year.
40
+ 2028 a :Year.
41
+ 2029 a :Year.
42
+ 2030 a :Year.
43
+ 2031 a :Year.
44
+ 2032 a :Year.
45
+ 2033 a :Year.
46
+ 2034 a :Year.
47
+ 2035 a :Year.
48
+ 2036 a :Year.
49
+ 2037 a :Year.
50
+ 2038 a :Year.
51
+ 2039 a :Year.
52
+ 2040 a :Year.
53
+ 2041 a :Year.
54
+ 2042 a :Year.
55
+ 2043 a :Year.
56
+ 2044 a :Year.
57
+ 2045 a :Year.
58
+ 2046 a :Year.
59
+ 2047 a :Year.
60
+ 2048 a :Year.
61
+ 2049 a :Year.
62
+ 2050 a :Year.
63
+
64
+ { ?Y a :Year.
65
+ (?Y 19) math:remainder ?J.
66
+ (?Y 100) math:integerQuotient ?K; math:remainder ?H.
67
+ (?K 4) math:integerQuotient ?M; math:remainder ?N.
68
+ ((?K 8)!math:sum 25) math:integerQuotient ?P.
69
+ (((?K ?P)!math:difference 1)!math:sum 3) math:integerQuotient ?Q.
70
+ ((((((19 ?J)!math:product ?K)!math:sum ?M)!math:difference ?Q)!math:difference 15)!math:sum 30) math:remainder ?R.
71
+ (?H 4) math:integerQuotient ?S; math:remainder ?U.
72
+ ((32 (2 ?N)!math:product (2 ?S)!math:product ?R!math:negation ?U!math:negation)!math:sum 7) math:remainder ?V.
73
+ ((?J (11 ?R)!math:product (22 ?V)!math:product)!math:sum 451) math:integerQuotient ?W.
74
+ ((?R ?V (7 ?W)!math:product!math:negation 114)!math:sum 31) math:integerQuotient ?X; math:remainder ?Z.
75
+ (?Z 1) math:sum ?DAY.
76
+ } => {
77
+ (?DAY ?X) :easterFor ?Y.
78
+ }.
@@ -242,6 +242,17 @@
242
242
  :status :pass .
243
243
  } .
244
244
 
245
+ # math:integerQuotient
246
+ { (10 3) math:integerQuotient ?q . ?q math:equalTo 3 . }
247
+ => {
248
+ :test-integerQuotient-1 a :MathBuiltinTest;
249
+ :builtin math:integerQuotient;
250
+ :input (10 3);
251
+ :expected 3;
252
+ :actual ?q;
253
+ :status :pass .
254
+ } .
255
+
245
256
  # math:lessThan
246
257
  {
247
258
  41 math:lessThan 42 .