eyeling 1.28.5 → 1.28.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.
- package/README.md +33 -1
- package/dist/browser/eyeling.browser.js +607 -1
- package/eyeling-builtins.ttl +28 -1
- package/eyeling.js +607 -1
- package/lib/builtins.js +604 -1
- package/lib/prelude.js +3 -0
- package/package.json +1 -1
- package/test/builtins.test.js +61 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Eyeling is characterized by:
|
|
|
19
19
|
- **Notation3 reasoning in a small JavaScript package** — facts, quoted formulas, and N3 rules are parsed and reasoned over directly.
|
|
20
20
|
- **Forward and backward chaining** — `=>` rules derive new facts, while `<=` rules act as goal-directed definitions.
|
|
21
21
|
- **Backward proving inside forward rules** — forward-rule bodies are solved with the backward engine, so rules can use derived predicates and built-ins without materializing everything first.
|
|
22
|
-
- **Built-ins in rule bodies** — N3 programs can combine logical rules with computations such as math, string, list, time, and web-oriented predicates.
|
|
22
|
+
- **Built-ins in rule bodies** — N3 programs can combine logical rules with computations such as math, string, datatype, list, time, and web-oriented predicates.
|
|
23
23
|
- **Streaming RDF Messages** — supports RDF Messages streams, enabling Eyeling to fit into streaming RDF pipelines.
|
|
24
24
|
- **Node.js, npm, and browser use** — run it from the command line, call it from JavaScript, or use the browser-oriented bundle.
|
|
25
25
|
- **RDF-JS interoperability** — use N3 text, RDF-JS quads, datasets, or Eyeling’s own AST-level API.
|
|
@@ -602,6 +602,7 @@ Eyeling implements SWAP-style built-ins across these namespaces:
|
|
|
602
602
|
| `rdf:` | `first`, `rest` | Aliases for list traversal over RDF collections. |
|
|
603
603
|
| `log:` | `includes`, `notIncludes`, `semantics`, `conclusion`, `query`, `outputString` | Formula, dereferencing, query, and output operations. |
|
|
604
604
|
| `string:` | `contains`, `matches`, `replace`, `format`, `length` | String tests and transformations. |
|
|
605
|
+
| `dt:` | `datatype`, `lexicalForm`, `validForDatatype`, `sameValueAs`, `canonicalLiteral` | XSD datatype inspection, value-space validity, equality, inequality, and canonicalization. |
|
|
605
606
|
|
|
606
607
|
The authoritative built-in catalog is `eyeling-builtins.ttl`. It documents each built-in as RDF, including its kind:
|
|
607
608
|
|
|
@@ -613,6 +614,37 @@ The authoritative built-in catalog is `eyeling-builtins.ttl`. It documents each
|
|
|
613
614
|
- `ex:Meta`: operates on formulas or types;
|
|
614
615
|
- `ex:SideEffect`: produces output.
|
|
615
616
|
|
|
617
|
+
### Datatype built-ins
|
|
618
|
+
|
|
619
|
+
Eyeling provides datatype built-ins in the namespace `https://eyereasoner.github.io/eyeling/datatype#`, usually used with the prefix `dt:`. They are intended for declarative datatype reasoning in N3 rule sets, including OWL 2 RL-style rules that need XSD value-space semantics without hard-coding OWL into the engine.
|
|
620
|
+
|
|
621
|
+
Supported operations include:
|
|
622
|
+
|
|
623
|
+
- `dt:datatype`, `dt:lexicalForm`, and `dt:language` for literal inspection;
|
|
624
|
+
- `dt:validForDatatype` and `dt:invalidForDatatype` for lexical validity and datatype membership checks;
|
|
625
|
+
- `dt:sameValueAs` and `dt:differentValueFrom` for value-space equality and inequality;
|
|
626
|
+
- `dt:canonicalLiteral` for canonical literal production.
|
|
627
|
+
|
|
628
|
+
The built-ins cover RDF language strings and the OWL 2 RL-relevant XSD set: `xsd:string`, `xsd:normalizedString`, `xsd:token`, `xsd:language`, `xsd:Name`, `xsd:NCName`, `xsd:NMTOKEN`, `xsd:boolean`, `xsd:decimal`, `xsd:integer` and its bounded integer subtypes, `xsd:float`, `xsd:double`, `xsd:hexBinary`, `xsd:base64Binary`, `xsd:anyURI`, `xsd:dateTime`, and `xsd:dateTimeStamp`.
|
|
629
|
+
|
|
630
|
+
Example:
|
|
631
|
+
|
|
632
|
+
```n3
|
|
633
|
+
@prefix : <http://example.org/> .
|
|
634
|
+
@prefix dt: <https://eyereasoner.github.io/eyeling/datatype#> .
|
|
635
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
636
|
+
|
|
637
|
+
{
|
|
638
|
+
"01"^^xsd:integer dt:sameValueAs "1.0"^^xsd:decimal .
|
|
639
|
+
"2026-06-10T12:00:00Z"^^xsd:dateTime
|
|
640
|
+
dt:sameValueAs "2026-06-10T14:00:00+02:00"^^xsd:dateTime .
|
|
641
|
+
}
|
|
642
|
+
=>
|
|
643
|
+
{
|
|
644
|
+
:check :status :pass .
|
|
645
|
+
} .
|
|
646
|
+
```
|
|
647
|
+
|
|
616
648
|
### Numeric built-ins
|
|
617
649
|
|
|
618
650
|
Numeric built-ins support common XSD numeric literals. Integer-oriented operations use `BigInt` where possible, with safety limits to avoid accidental memory exhaustion. Date/time comparisons and timestamp arithmetic are supported for relevant operations.
|