eyeling 1.10.21 → 1.11.0

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 (47) hide show
  1. package/HANDBOOK.md +2 -88
  2. package/eyeling-builtins.ttl +0 -48
  3. package/eyeling.js +67 -314
  4. package/lib/engine.js +67 -309
  5. package/lib/rules.js +0 -5
  6. package/package.json +1 -1
  7. package/test/n3gen.test.js +4 -4
  8. package/test/package.test.js +1 -1
  9. package/tools/n3gen.js +6 -1883
  10. package/examples/bind-builtins.n3 +0 -11
  11. package/examples/bind.n3 +0 -7
  12. package/examples/brussels-brew-club.n3 +0 -119
  13. package/examples/builtins-string-math.n3 +0 -11
  14. package/examples/builtins-triple-termtests.n3 +0 -7
  15. package/examples/family.n3 +0 -10
  16. package/examples/filter-demorgan.n3 +0 -9
  17. package/examples/filter-in-notin.n3 +0 -10
  18. package/examples/filter-nested-or.n3 +0 -10
  19. package/examples/filter.n3 +0 -8
  20. package/examples/input/bind-builtins.srl +0 -30
  21. package/examples/input/bind.srl +0 -12
  22. package/examples/input/builtins-string-math.srl +0 -38
  23. package/examples/input/builtins-triple-termtests.srl +0 -27
  24. package/examples/input/family.srl +0 -12
  25. package/examples/input/filter-demorgan.srl +0 -15
  26. package/examples/input/filter-in-notin.srl +0 -15
  27. package/examples/input/filter-nested-or.srl +0 -15
  28. package/examples/input/filter.srl +0 -9
  29. package/examples/input/snaf.srl +0 -6
  30. package/examples/it-is-about-time.n3 +0 -580
  31. package/examples/json-pointer.n3 +0 -75
  32. package/examples/json-reconcile-vat.n3 +0 -361
  33. package/examples/output/bind-builtins.n3 +0 -9
  34. package/examples/output/bind.n3 +0 -3
  35. package/examples/output/brussels-brew-club.n3 +0 -22
  36. package/examples/output/builtins-string-math.n3 +0 -0
  37. package/examples/output/builtins-triple-termtests.n3 +0 -0
  38. package/examples/output/family.n3 +0 -13
  39. package/examples/output/filter-demorgan.n3 +0 -3
  40. package/examples/output/filter-in-notin.n3 +0 -4
  41. package/examples/output/filter-nested-or.n3 +0 -4
  42. package/examples/output/filter.n3 +0 -3
  43. package/examples/output/it-is-about-time.n3 +0 -0
  44. package/examples/output/json-pointer.n3 +0 -13
  45. package/examples/output/json-reconcile-vat.n3 +0 -226
  46. package/examples/output/snaf.n3 +0 -3
  47. package/examples/snaf.n3 +0 -6
package/HANDBOOK.md CHANGED
@@ -702,7 +702,7 @@ With that, we can tour the builtin families as Eyeling actually implements them.
702
702
 
703
703
  These builtins hash a string and return a lowercase hex digest as a plain string literal.
704
704
 
705
- ### `crypto:sha`, `crypto:md5`, `crypto:sha256`, `crypto:sha384`, `crypto:sha512`
705
+ ### `crypto:sha`, `crypto:md5`, `crypto:sha256`, `crypto:sha512`
706
706
 
707
707
  **Shape:**
708
708
  `$literal crypto:sha256 $digest`
@@ -1224,22 +1224,6 @@ Returns one of four IRIs:
1224
1224
  * `rdf:List` (closed or open list terms)
1225
1225
  * `log:Other` (IRIs, blank nodes, etc.)
1226
1226
 
1227
-
1228
-
1229
- #### `log:isIRI` / `log:isLiteral` / `log:isBlank` / `log:isNumeric` / `log:isTriple` (extensions)
1230
-
1231
- Convenience *test* builtins (useful for SHACL/Sparql-style mappings). They **succeed** when the test holds and typically use `true` as the object.
1232
-
1233
- - **Shapes:**
1234
- - `$t+ log:isIRI true .`
1235
- - `$t+ log:isLiteral true .`
1236
- - `$t+ log:isBlank true .`
1237
- - `$t+ log:isNumeric true .`
1238
- - `$t+ log:isTriple true .` (formula with exactly one triple)
1239
-
1240
- These are treated as **constraints** for rule-body ordering.
1241
-
1242
-
1243
1227
  ### Literal constructors
1244
1228
 
1245
1229
  These two are classic N3 “bridge” operators between structured data and concrete RDF literal forms.
@@ -1337,19 +1321,6 @@ This is treated as a constraint builtin.
1337
1321
 
1338
1322
  Deterministically maps a *ground* term to a Skolem IRI in Eyeling’s well-known namespace. This is extremely useful when you want a repeatable identifier derived from structured content.
1339
1323
 
1340
-
1341
-
1342
- #### `log:uuid` / `log:struuid` (extensions)
1343
-
1344
- Generate fresh UUID values.
1345
-
1346
- - **Shapes:**
1347
- - `"" log:uuid ?u .` binds `?u` to an IRI like `<urn:uuid:...>`.
1348
- - `"" log:struuid ?s .` binds `?s` to a UUID string literal.
1349
-
1350
- **Warning:** These are non-deterministic and can affect termination; prefer `log:skolem` for deterministic identifiers.
1351
-
1352
-
1353
1324
  #### `log:uri`
1354
1325
 
1355
1326
  Bidirectional conversion between IRIs and their string form:
@@ -1383,7 +1354,7 @@ This is treated as a constraint builtin (it shouldn’t drive search; it should
1383
1354
 
1384
1355
  ---
1385
1356
 
1386
- ## 11.3.6 `string:` — string casting, tests, regexes, and JSON pointers
1357
+ ## 11.3.6 `string:` — string casting, tests, and regexes
1387
1358
 
1388
1359
  Eyeling implements string builtins with a deliberate interpretation of “domain is `xsd:string`”:
1389
1360
 
@@ -1414,35 +1385,6 @@ A tiny `sprintf` subset:
1414
1385
  * Any other specifier (`%d`, `%f`, …) causes the builtin to fail.
1415
1386
  * Missing arguments are treated as empty strings.
1416
1387
 
1417
-
1418
-
1419
- #### `string:length` (extension)
1420
-
1421
- Length of the subject string, like SPARQL `STRLEN`.
1422
-
1423
- - **Shape:** `$s+ string:length $o-`
1424
- - **Output:** `$o` is unified/bound to an integer token.
1425
-
1426
- #### `string:substring` (extension)
1427
-
1428
- Substring, like SPARQL `SUBSTR`.
1429
-
1430
- - **Shape:** `( $s+ $start+ [$len+] ) string:substring $o-`
1431
- - **Notes:** `start` is **1-based**. `len` is optional; if omitted, the substring runs to the end.
1432
-
1433
- #### `string:upperCase` / `string:lowerCase` (extension)
1434
-
1435
- Case conversion, like SPARQL `UCASE` / `LCASE`.
1436
-
1437
- - **Shape:** `$s+ string:upperCase $o-` and `$s+ string:lowerCase $o-`
1438
-
1439
- #### `string:encodeForURI` (extension)
1440
-
1441
- Percent-encode a string, like SPARQL `ENCODE_FOR_URI`.
1442
-
1443
- - **Shape:** `$s+ string:encodeForURI $o-`
1444
-
1445
-
1446
1388
  ### Containment and prefix/suffix tests (constraints)
1447
1389
 
1448
1390
  * `string:contains`
@@ -1496,34 +1438,6 @@ Tests whether `pattern` matches `data`.
1496
1438
 
1497
1439
  Matches the regex once and returns the **first capturing group** (group 1). If there is no match or no group, it fails.
1498
1440
 
1499
- ### JSON pointer lookup
1500
-
1501
- #### `string:jsonPointer`
1502
-
1503
- **Shape:**
1504
- `( jsonText pointer ) string:jsonPointer value`
1505
-
1506
- This builtin is intentionally “bridgey”: it lets you reach into JSON and get back an RDF/N3 term.
1507
-
1508
- Rules:
1509
-
1510
- * `jsonText` must be an `rdf:JSON` literal (Eyeling is permissive and may accept a couple of equivalent datatype spellings).
1511
- * `pointer` is a string; Eyeling supports:
1512
-
1513
- * standard RFC 6901 pointers like `/a/b/0`
1514
- * URI fragment form like `#/a/b` (it is decoded first)
1515
- * The JSON is parsed and cached; pointer results are cached per `(jsonText, pointer)`.
1516
-
1517
- Returned terms follow Eyeling’s `jsonToTerm` mapping:
1518
-
1519
- * JSON `null` → `"null"` (a plain string literal)
1520
- * JSON string → plain string literal
1521
- * JSON number → numeric token literal (untyped)
1522
- * JSON boolean → `true` / `false` token literal (untyped boolean token)
1523
- * JSON array → an N3 list term whose elements are recursively converted
1524
- * JSON object → an `rdf:JSON` literal containing the object’s JSON text
1525
-
1526
- This design keeps the builtin total and predictable even for nested structures.
1527
1441
 
1528
1442
  ## 11.4 `log:outputString` as a controlled side effect
1529
1443
 
@@ -55,9 +55,6 @@ crypto:md5 a ex:Builtin ; ex:kind ex:Function ;
55
55
  crypto:sha256 a ex:Builtin ; ex:kind ex:Function ;
56
56
  rdfs:comment "Hash builtin (SHA-256). Computes digest over the subject (string-ish) and unifies/binds the object with the digest." .
57
57
 
58
- crypto:sha384 a ex:Builtin ; ex:kind ex:Function ;
59
- rdfs:comment "Hash builtin (SHA-384). Computes digest over the subject (string-ish) and unifies/binds the object with the digest. (Eyeling extension; useful for SHACL/Sparql-style mappings.)" .
60
-
61
58
  crypto:sha512 a ex:Builtin ; ex:kind ex:Function ;
62
59
  rdfs:comment "Hash builtin (SHA-512). Computes digest over the subject (string-ish) and unifies/binds the object with the digest." .
63
60
 
@@ -104,12 +101,6 @@ math:remainder a ex:Builtin ; ex:kind ex:Function ;
104
101
  math:rounded a ex:Builtin ; ex:kind ex:Function ;
105
102
  rdfs:comment "Rounds subject to nearest integer (JS tie-breaking: toward +∞). Binds/unifies object with the rounded integer value." .
106
103
 
107
- math:ceiling a ex:Builtin ; ex:kind ex:Function ;
108
- rdfs:comment "Ceiling of a numeric value (like SPARQL CEIL). Returns an integer token. (Eyeling extension.)" .
109
-
110
- math:floor a ex:Builtin ; ex:kind ex:Function ;
111
- rdfs:comment "Floor of a numeric value (like SPARQL FLOOR). Returns an integer token. (Eyeling extension.)" .
112
-
113
104
  math:exponentiation a ex:Builtin ; ex:kind ex:Function ;
114
105
  rdfs:comment "Exponentiation. Forward: (base exponent) -> result. Limited inverse: if base is numeric and exponent is a variable, may solve exponent via logs for positive base != 1 and positive result." .
115
106
 
@@ -257,27 +248,6 @@ log:parsedAsN3 a ex:Builtin ; ex:kind ex:Meta ;
257
248
  log:rawType a ex:Builtin ; ex:kind ex:Meta ;
258
249
  rdfs:comment "Returns one of log:Formula, log:Literal, rdf:List, or log:Other for the subject term." .
259
250
 
260
- log:isIRI a ex:Builtin ; ex:kind ex:Test ; ex:isConstraint true ;
261
- rdfs:comment "Succeeds iff the subject is an IRI term (like SPARQL isIRI). Object is typically 'true'. (Eyeling extension.)" .
262
-
263
- log:isLiteral a ex:Builtin ; ex:kind ex:Test ; ex:isConstraint true ;
264
- rdfs:comment "Succeeds iff the subject is a literal term (like SPARQL isLITERAL). (Eyeling extension.)" .
265
-
266
- log:isBlank a ex:Builtin ; ex:kind ex:Test ; ex:isConstraint true ;
267
- rdfs:comment "Succeeds iff the subject is a blank node term (like SPARQL isBLANK). (Eyeling extension.)" .
268
-
269
- log:isNumeric a ex:Builtin ; ex:kind ex:Test ; ex:isConstraint true ;
270
- rdfs:comment "Succeeds iff the subject is a numeric literal (like SPARQL isNUMERIC). (Eyeling extension.)" .
271
-
272
- log:isTriple a ex:Builtin ; ex:kind ex:Test ; ex:isConstraint true ;
273
- rdfs:comment "Succeeds iff the subject is a formula with exactly one triple (like SPARQL isTRIPLE over RDF-star triple terms). (Eyeling extension.)" .
274
-
275
- log:uuid a ex:Builtin ; ex:kind ex:Function ;
276
- rdfs:comment "Generates a fresh UUID IRI (<urn:uuid:...>). Non-deterministic; can affect termination. (Eyeling extension.)" .
277
-
278
- log:struuid a ex:Builtin ; ex:kind ex:Function ;
279
- rdfs:comment "Generates a fresh UUID string literal. Non-deterministic; can affect termination. (Eyeling extension.)" .
280
-
281
251
  log:dtlit a ex:Builtin ; ex:kind ex:Function ;
282
252
  rdfs:comment "Builds a datatype literal from (lex datatypeIri). Binds/unifies object with the resulting Literal." .
283
253
 
@@ -364,21 +334,3 @@ string:scrape a ex:Builtin ; ex:kind ex:Function ;
364
334
  string:format a ex:Builtin ; ex:kind ex:Function ;
365
335
  rdfs:comment "Simple formatter: (fmt arg1 ... argN) -> output string. Only %s and %% are supported; other specifiers fail." .
366
336
 
367
- string:length a ex:Builtin ; ex:kind ex:Function ;
368
- rdfs:comment "Length of a string (like SPARQL STRLEN). (Eyeling extension.)" .
369
-
370
- string:substring a ex:Builtin ; ex:kind ex:Function ;
371
- rdfs:comment "Substring: subject must be a list (string start [len]); start is 1-based (like SPARQL SUBSTR). (Eyeling extension.)" .
372
-
373
- string:upperCase a ex:Builtin ; ex:kind ex:Function ;
374
- rdfs:comment "Uppercase conversion (like SPARQL UCASE). (Eyeling extension.)" .
375
-
376
- string:lowerCase a ex:Builtin ; ex:kind ex:Function ;
377
- rdfs:comment "Lowercase conversion (like SPARQL LCASE). (Eyeling extension.)" .
378
-
379
- string:encodeForURI a ex:Builtin ; ex:kind ex:Function ;
380
- rdfs:comment "Percent-encode a string (like SPARQL ENCODE_FOR_URI). (Eyeling extension.)" .
381
-
382
- string:jsonPointer a ex:Builtin ; ex:kind ex:Function ;
383
- rdfs:comment "JSON Pointer lookup: (jsonText pointer) -> value term. Expects rdf:JSON-typed literal (or treated as rdf:JSON); caches parsed JSON and pointer lookups." .
384
-