eyeling 1.33.2 → 1.33.4

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 (113) hide show
  1. package/examples/eyelang/README.md +11 -76
  2. package/examples/eyelang/SPEC.md +1 -2
  3. package/eyelang.d.ts +0 -12
  4. package/index.d.ts +0 -4
  5. package/index.js +1 -5
  6. package/lib/eyelang/builtins/registry.js +1 -2
  7. package/lib/eyelang/builtins/search.js +3 -3
  8. package/lib/eyelang/cli.js +1 -13
  9. package/lib/eyelang/hash.js +2 -2
  10. package/lib/eyelang/index.js +0 -1
  11. package/lib/eyelang/program.js +0 -7
  12. package/package.json +1 -1
  13. package/test/eyelang/run-examples.mjs +1 -2
  14. package/test/eyelang/run-regression.mjs +0 -61
  15. package/test/run.js +21 -3
  16. package/examples/eyelang/annotation-rdf12.ttl +0 -12
  17. package/examples/eyelang/directional-language.ttl +0 -9
  18. package/examples/eyelang/eyeling-ackermann.n3 +0 -41
  19. package/examples/eyelang/eyeling-age-threshold.n3 +0 -12
  20. package/examples/eyelang/eyeling-alignment-demo.n3 +0 -11
  21. package/examples/eyelang/eyeling-allen-interval-calculus-small.n3 +0 -13
  22. package/examples/eyelang/eyeling-backward-recursion.n3 +0 -11
  23. package/examples/eyelang/eyeling-backward.n3 +0 -10
  24. package/examples/eyelang/eyeling-basic-monadic-small.n3 +0 -11
  25. package/examples/eyelang/eyeling-bmi.n3 +0 -10
  26. package/examples/eyelang/eyeling-cat-koko.n3 +0 -15
  27. package/examples/eyelang/eyeling-collatz-small.n3 +0 -11
  28. package/examples/eyelang/eyeling-collection.n3 +0 -11
  29. package/examples/eyelang/eyeling-complex-arithmetic.n3 +0 -10
  30. package/examples/eyelang/eyeling-context-association.n3 +0 -11
  31. package/examples/eyelang/eyeling-control-system-small.n3 +0 -11
  32. package/examples/eyelang/eyeling-crypto-builtins-extra.n3 +0 -10
  33. package/examples/eyelang/eyeling-crypto-builtins.n3 +0 -8
  34. package/examples/eyelang/eyeling-deep-taxonomy-10.n3 +0 -18
  35. package/examples/eyelang/eyeling-derived-backward-rule-flat.n3 +0 -10
  36. package/examples/eyelang/eyeling-derived-rule-flat.n3 +0 -9
  37. package/examples/eyelang/eyeling-digital-product-passport-small.n3 +0 -11
  38. package/examples/eyelang/eyeling-dijkstra-tiny.n3 +0 -14
  39. package/examples/eyelang/eyeling-dog-license.n3 +0 -13
  40. package/examples/eyelang/eyeling-drone-corridor-planner-small.n3 +0 -13
  41. package/examples/eyelang/eyeling-equals.n3 +0 -8
  42. package/examples/eyelang/eyeling-equivalence-classes.n3 +0 -11
  43. package/examples/eyelang/eyeling-euler-identity.n3 +0 -9
  44. package/examples/eyelang/eyeling-existential-rule.n3 +0 -9
  45. package/examples/eyelang/eyeling-expression-eval.n3 +0 -11
  46. package/examples/eyelang/eyeling-family-cousins-extended.n3 +0 -12
  47. package/examples/eyelang/eyeling-fastpow.n3 +0 -10
  48. package/examples/eyelang/eyeling-fibonacci.n3 +0 -44
  49. package/examples/eyelang/eyeling-french-cities-reachability.n3 +0 -22
  50. package/examples/eyelang/eyeling-goldbach-small.n3 +0 -22
  51. package/examples/eyelang/eyeling-good-cobbler.n3 +0 -9
  52. package/examples/eyelang/eyeling-list-builtins.n3 +0 -10
  53. package/examples/eyelang/eyeling-list-collection-extra.n3 +0 -9
  54. package/examples/eyelang/eyeling-math-builtins.n3 +0 -9
  55. package/examples/eyelang/eyeling-string-builtins-extra.n3 +0 -9
  56. package/examples/eyelang/eyeling-string-builtins.n3 +0 -10
  57. package/examples/eyelang/eyeling-time-builtins.n3 +0 -11
  58. package/examples/eyelang/eyeling-time-components-extra.n3 +0 -10
  59. package/examples/eyelang/eyeling-witch.n3 +0 -10
  60. package/examples/eyelang/family-cousins.n3 +0 -17
  61. package/examples/eyelang/n3-builtins.n3 +0 -28
  62. package/examples/eyelang/output/annotation-rdf12.ttl +0 -1
  63. package/examples/eyelang/output/directional-language.ttl +0 -1
  64. package/examples/eyelang/output/eyeling-ackermann.n3 +0 -12
  65. package/examples/eyelang/output/eyeling-age-threshold.n3 +0 -4
  66. package/examples/eyelang/output/eyeling-alignment-demo.n3 +0 -1
  67. package/examples/eyelang/output/eyeling-allen-interval-calculus-small.n3 +0 -3
  68. package/examples/eyelang/output/eyeling-backward-recursion.n3 +0 -9
  69. package/examples/eyelang/output/eyeling-backward.n3 +0 -1
  70. package/examples/eyelang/output/eyeling-basic-monadic-small.n3 +0 -8
  71. package/examples/eyelang/output/eyeling-bmi.n3 +0 -2
  72. package/examples/eyelang/output/eyeling-cat-koko.n3 +0 -3
  73. package/examples/eyelang/output/eyeling-collatz-small.n3 +0 -3
  74. package/examples/eyelang/output/eyeling-collection.n3 +0 -1
  75. package/examples/eyelang/output/eyeling-complex-arithmetic.n3 +0 -5
  76. package/examples/eyelang/output/eyeling-context-association.n3 +0 -4
  77. package/examples/eyelang/output/eyeling-control-system-small.n3 +0 -4
  78. package/examples/eyelang/output/eyeling-crypto-builtins-extra.n3 +0 -3
  79. package/examples/eyelang/output/eyeling-crypto-builtins.n3 +0 -2
  80. package/examples/eyelang/output/eyeling-deep-taxonomy-10.n3 +0 -32
  81. package/examples/eyelang/output/eyeling-derived-backward-rule-flat.n3 +0 -4
  82. package/examples/eyelang/output/eyeling-derived-rule-flat.n3 +0 -2
  83. package/examples/eyelang/output/eyeling-digital-product-passport-small.n3 +0 -3
  84. package/examples/eyelang/output/eyeling-dijkstra-tiny.n3 +0 -9
  85. package/examples/eyelang/output/eyeling-dog-license.n3 +0 -1
  86. package/examples/eyelang/output/eyeling-drone-corridor-planner-small.n3 +0 -5
  87. package/examples/eyelang/output/eyeling-equals.n3 +0 -1
  88. package/examples/eyelang/output/eyeling-equivalence-classes.n3 +0 -2
  89. package/examples/eyelang/output/eyeling-euler-identity.n3 +0 -3
  90. package/examples/eyelang/output/eyeling-existential-rule.n3 +0 -4
  91. package/examples/eyelang/output/eyeling-expression-eval.n3 +0 -3
  92. package/examples/eyelang/output/eyeling-family-cousins-extended.n3 +0 -6
  93. package/examples/eyelang/output/eyeling-fastpow.n3 +0 -4
  94. package/examples/eyelang/output/eyeling-fibonacci.n3 +0 -6
  95. package/examples/eyelang/output/eyeling-french-cities-reachability.n3 +0 -25
  96. package/examples/eyelang/output/eyeling-goldbach-small.n3 +0 -2
  97. package/examples/eyelang/output/eyeling-good-cobbler.n3 +0 -2
  98. package/examples/eyelang/output/eyeling-list-builtins.n3 +0 -6
  99. package/examples/eyelang/output/eyeling-list-collection-extra.n3 +0 -5
  100. package/examples/eyelang/output/eyeling-math-builtins.n3 +0 -5
  101. package/examples/eyelang/output/eyeling-string-builtins-extra.n3 +0 -3
  102. package/examples/eyelang/output/eyeling-string-builtins.n3 +0 -4
  103. package/examples/eyelang/output/eyeling-time-builtins.n3 +0 -4
  104. package/examples/eyelang/output/eyeling-time-components-extra.n3 +0 -5
  105. package/examples/eyelang/output/eyeling-witch.n3 +0 -2
  106. package/examples/eyelang/output/family-cousins.n3 +0 -8
  107. package/examples/eyelang/output/n3-builtins.n3 +0 -6
  108. package/examples/eyelang/output/socrates.n3 +0 -1
  109. package/examples/eyelang/output/triple-term.n3 +0 -2
  110. package/examples/eyelang/socrates.n3 +0 -11
  111. package/examples/eyelang/triple-term.n3 +0 -9
  112. package/lib/eyelang/builtins/n3.js +0 -483
  113. package/lib/eyelang/rdf.js +0 -747
@@ -20,13 +20,12 @@ For the normative language definition, including lexical syntax, terms, clauses,
20
20
  4. [Writing programs](#writing-programs)
21
21
  5. [Aggregation helpers](#aggregation-helpers)
22
22
  6. [Formula data](#formula-data)
23
- 7. [RDF 1.2 and Notation3 compatibility](#rdf-12-and-notation3-compatibility)
24
- 8. [Example catalog](#example-catalog)
25
- 9. [Golden outputs, tests, and conformance](#golden-outputs-tests-and-conformance)
26
- 10. [Development and release](#development-and-release)
27
- 11. [Relationship to Eyeling](#relationship-to-eyeling)
28
- 12. [Performance notes](#performance-notes)
29
- 13. [Implementation limits](#implementation-limits)
23
+ 7. [Example catalog](#example-catalog)
24
+ 8. [Golden outputs, tests, and conformance](#golden-outputs-tests-and-conformance)
25
+ 9. [Development and release](#development-and-release)
26
+ 10. [Relationship to Eyeling](#relationship-to-eyeling)
27
+ 11. [Performance notes](#performance-notes)
28
+ 12. [Implementation limits](#implementation-limits)
30
29
 
31
30
  ## Quick start
32
31
 
@@ -316,69 +315,9 @@ formula_binary((name(alice, "Alice"), knows(alice, bob)), S, P, O).
316
315
  This can yield `S = alice`, `P = name`, `O = "Alice"` and `S = alice`, `P = knows`, `O = bob`. The utility is useful for quoted formula data, but it does not make those formula members true in the ambient program.
317
316
 
318
317
 
319
- ## RDF 1.2 and Notation3 compatibility
320
-
321
- The core eyelang syntax remains Prolog-like, but `src/rdf.js` adds a compatibility layer for RDF 1.2 Turtle/N-Triples style data and a practical Notation3 rule subset. Use it from the CLI with `--rdf`, `--rdf12`, `--n3`, or `--input-format FORMAT`; file inputs ending in `.ttl`, `.nt`, or `.n3` are recognized when the CLI uses its default `auto` format.
322
-
323
- ```sh
324
- bin/eyelang --rdf data.ttl rules.n3
325
- printf '@prefix : <http://example.com/> .
326
- { ?x :parent ?y . } => { ?x :related ?y . } .
327
- :alice :parent :bob .
328
- ' | bin/eyelang --n3 -
329
- ```
330
-
331
- RDF triples are lowered to ordinary `rdf/3` goals:
332
-
333
- ```prolog
334
- rdf(Subject, Predicate, Object).
335
- ```
336
-
337
- RDF terms are explicit eyelang compound terms:
338
-
339
- ```prolog
340
- iri("http://example.com/alice")
341
- bnode("b0")
342
- literal("Alice", iri("http://www.w3.org/2001/XMLSchema#string"), "", "")
343
- triple(Subject, Predicate, Object)
344
- ```
345
-
346
- The layer supports `PREFIX`/`@prefix`, `BASE`/`@base`, `VERSION`/`@version`, IRIs, prefixed names, blank nodes, strings, numeric and boolean literals, language-tagged and RDF 1.2 directional language-tagged strings, RDF collections, blank-node property lists, RDF 1.2 triple terms `<<( ... )>>`, reified triple sugar `<< ... >>`, annotation blocks `{| ... |}`, N3 rules of the form `{ antecedent } => { consequent } .`, reverse rules of the form `{ consequent } <= { antecedent } .`, and N3 equality `=` as `owl:sameAs`. Reified triples and annotations are expanded through `rdf:reifies`, so this Turtle fragment:
347
-
348
- ```turtle
349
- VERSION "1.2"
350
- PREFIX : <http://example.com/>
351
- :alice :name "Alice" ~ :t {| :statedBy :bob |} .
352
- ```
353
-
354
- is made available as eyelang facts like:
355
-
356
- ```prolog
357
- rdf(iri("http://example.com/alice"), iri("http://example.com/name"), literal("Alice", iri("http://www.w3.org/2001/XMLSchema#string"), "", "")).
358
- rdf(iri("http://example.com/t"), iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies"), triple(iri("http://example.com/alice"), iri("http://example.com/name"), literal("Alice", iri("http://www.w3.org/2001/XMLSchema#string"), "", ""))).
359
- rdf(iri("http://example.com/t"), iri("http://example.com/statedBy"), iri("http://example.com/bob")).
360
- ```
361
-
362
- From JavaScript, use `parseRdfClauses(source, options)` when you want clause objects, or `rdfToEyelang(source, options)` when you want the lowered eyelang source text.
363
-
364
- N3 body triples whose predicates are in the common SWAP namespaces are lowered to eyelang built-ins instead of `rdf/3` goals. The practical bridge covers math comparisons and arithmetic such as `math:sum`, `math:difference`, `math:product`, `math:quotient`, `math:rounded`, and trigonometric functions, with exact BigInt-backed integer paths for large N3 arithmetic examples; string predicates such as `string:contains`, `string:startsWith`, `string:concatenation`, `string:length`, `string:replace`, and `string:scrape`; list predicates such as `list:member`, `list:append`, `list:first`, `list:rest`, `list:length`, `list:reverse`, and `list:sort`; `crypto:sha`, `crypto:md5`, `crypto:sha256`, `crypto:sha512`; simple `time:*` component extraction; and selected `log:*` helpers such as `log:equalTo`, `log:notEqualTo`, `log:uri`, `log:dtlit`, and `log:rawType`. This follows the builtin families used by eyeling while keeping eyelang's execution model small.
365
-
366
- RDF/N3 examples now live directly in [`examples/`](examples/), with golden outputs in [`examples/output/`](examples/output/), matching the existing example layout. They include eyeling-inspired `socrates.n3`, `family-cousins.n3`, and `annotation-rdf12.ttl` examples; focused RDF 1.2 triple-term and directional-language examples; `n3-builtins.n3`; and a larger `eyeling-*.n3` set adapted from the eyeling example directory. The added eyeling-style examples cover backward rules, recursive `<=`, equality, collection/list handling, Ackermann-style hyperoperations, Fibonacci numbers, dog-license, witch, Cat Koko, family/cousin, alignment, BMI, and SWAP math/string/list/crypto/time builtins. Run them with auto format detection or force the reader explicitly:
367
-
368
- ```sh
369
- bin/eyelang examples/socrates.n3
370
- bin/eyelang --rdf12 examples/annotation-rdf12.ttl
371
- bin/eyelang --n3 examples/n3-builtins.n3
372
- bin/eyelang --n3 examples/eyeling-backward-recursion.n3
373
- bin/eyelang --n3 examples/eyeling-ackermann.n3
374
- bin/eyelang --n3 examples/eyeling-fibonacci.n3
375
- ```
376
-
377
- This is a compatibility layer, not a validating W3C conformance parser. It intentionally covers the graph-oriented syntax, common RDF 1.2 constructs, and the N3 Horn-rule/builtin patterns that map cleanly to eyelang; it does not implement RDF/XML, full TriG datasets, SPARQL, scoped N3 formula built-ins such as full `log:semantics`, or every Notation3 construct.
378
-
379
318
  ## Example catalog
380
319
 
381
- The repository includes examples for recursion, graph reachability, finite search, arithmetic, list processing, optimization, policies, puzzles, N3-inspired rule chains, and applied scientific calculations. Bundled examples use relation-style output.
320
+ The repository includes examples for recursion, graph reachability, finite search, arithmetic, list processing, optimization, policies, puzzles, and applied scientific calculations. Bundled examples use relation-style output.
382
321
 
383
322
  | Input | Short description | Output |
384
323
  | --- | --- | --- |
@@ -391,7 +330,6 @@ The repository includes examples for recursion, graph reachability, finite searc
391
330
  | [`ancestor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/ancestor.pl) | Derives ancestors from parent facts. | [`output/ancestor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/ancestor.pl) |
392
331
  | [`animal.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/animal.pl) | Classifies animals from traits. | [`output/animal.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/animal.pl) |
393
332
  | [`annotation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/annotation.pl) | Derives facts from quoted annotation data. | [`output/annotation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/annotation.pl) |
394
- | [`annotation-rdf12.ttl`](https://github.com/eyereasoner/eyelang/blob/main/examples/annotation-rdf12.ttl) | Demonstrates RDF 1.2 annotation syntax lowered through `rdf:reifies`. | [`output/annotation-rdf12.ttl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/annotation-rdf12.ttl) |
395
333
  | [`auroracare.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/auroracare.pl) | Evaluates purpose-based medical data access scenarios. | [`output/auroracare.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/auroracare.pl) |
396
334
  | [`backward.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/backward.pl) | Shows a backward-rule pattern as a goal-directed numeric rule. | [`output/backward.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/backward.pl) |
397
335
  | [`basic-monadic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/basic-monadic.pl) | Runs a monadic benchmark over generated inputs. | [`output/basic-monadic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/basic-monadic.pl) |
@@ -516,21 +454,18 @@ The repository includes examples for recursion, graph reachability, finite searc
516
454
  | [`turing.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/turing.pl) | Simulates a binary-increment Turing machine. | [`output/turing.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/turing.pl) |
517
455
  | [`vector-similarity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/vector-similarity.pl) | Computes dot product, norm, and cosine similarity. | [`output/vector-similarity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/vector-similarity.pl) |
518
456
  | [`vulnerability-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/vulnerability-impact.pl) | Analyzes vulnerable transitive dependencies and urgent patch impact. | [`output/vulnerability-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/vulnerability-impact.pl) |
519
- | [`witch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/witch.pl) | Derives the classic “burn the witch” N3 rule chain. | [`output/witch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/witch.pl) |
457
+ | [`witch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/witch.pl) | Derives the classic “burn the witch” rule chain. | [`output/witch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/witch.pl) |
520
458
  | [`wolf-goat-cabbage.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/wolf-goat-cabbage.pl) | Solves the wolf-goat-cabbage river crossing. | [`output/wolf-goat-cabbage.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/wolf-goat-cabbage.pl) |
521
459
  | [`zebra.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/zebra.pl) | Solves the zebra logic puzzle. | [`output/zebra.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/zebra.pl) |
522
460
 
523
461
 
524
- | [`directional-language.ttl`](https://github.com/eyereasoner/eyelang/blob/main/examples/directional-language.ttl) | Demonstrates RDF 1.2 directional language-tagged strings. | [`output/directional-language.ttl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/directional-language.ttl) |
525
- | [`n3-builtins.n3`](https://github.com/eyereasoner/eyelang/blob/main/examples/n3-builtins.n3) | Uses N3 `<=` plus `math:`, `string:`, and `list:` builtins. | [`output/n3-builtins.n3`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/n3-builtins.n3) |
526
- | [`triple-term.n3`](https://github.com/eyereasoner/eyelang/blob/main/examples/triple-term.n3) | Demonstrates RDF 1.2 triple terms in N3 data and rules. | [`output/triple-term.n3`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/triple-term.n3) |
527
462
 
528
463
  ## Golden outputs, tests, and conformance
529
464
 
530
- Golden answer outputs live in [`examples/output`](examples/output). `npm run test:examples` covers every top-level runnable example with extension `.pl`, `.n3`, `.ttl`, or `.nt`. A curated proof-output suite for `.pl` examples lives in [`examples/proof`](examples/proof). Example tests pin `local_time/1` to `2026-05-30` so date-dependent examples stay deterministic. Regenerate them after an intentional output or explanation change:
465
+ Golden answer outputs live in [`examples/output`](examples/output). `npm run test:examples` covers every top-level runnable `.pl` example. A curated proof-output suite for `.pl` examples lives in [`examples/proof`](examples/proof). Example tests pin `local_time/1` to `2026-05-30` so date-dependent examples stay deterministic. Regenerate them after an intentional output or explanation change:
531
466
 
532
467
  ```sh
533
- for f in examples/*.pl examples/*.n3 examples/*.ttl examples/*.nt; do
468
+ for f in examples/*.pl; do
534
469
  [ -e "$f" ] || continue
535
470
  b=$(basename "$f")
536
471
  EYELANG_LOCAL_TIME=2026-05-30 bin/eyelang "$f" > "examples/output/$b"
@@ -629,4 +564,4 @@ For large programs, keep helper predicates selective, bind arguments early, and
629
564
 
630
565
  ## Implementation limits
631
566
 
632
- eyelang is intentionally smaller than ISO Prolog. It has no operators, cut, modules, dynamic database updates, DCGs, or complete ISO library. Negation is negation-as-failure through `not/1`. Search is goal-directed and expected to be finite for the selected output goals. Output explanations are non-normative proof printouts and do not change answer semantics. The RDF 1.2 / Notation3 reader is an implementation compatibility layer over `rdf/3`, not a normative RDF conformance profile.
567
+ eyelang is intentionally smaller than ISO Prolog. It has no operators, cut, modules, dynamic database updates, DCGs, or complete ISO library. Negation is negation-as-failure through `not/1`. Search is goal-directed and expected to be finite for the selected output goals. Output explanations are non-normative proof printouts and do not change answer semantics.
@@ -470,7 +470,7 @@ An extension built-in SHOULD obey the same surface-language discipline as standa
470
470
  - it SHOULD document its intended modes, especially which arguments must be ground before it runs deterministically;
471
471
  - it MUST NOT change the meaning of ordinary facts, rules, unification, or standard built-ins.
472
472
 
473
- For example, an implementation may include extension modules for Sudoku solving, portfolio selection, number-theory algorithms, graph search, matrix operations, alphametic puzzles, or a non-normative RDF/Notation3 reader that lowers RDF triples to ordinary eyelang predicates such as `rdf/3` and lowers selected Notation3 built-in predicates to extension built-ins such as `n3_math_sum/2` or `n3_string_contains/2`. Those modules may be valuable and may make example programs much faster, but their predicate names, arities, algorithms, syntax accepted by non-eyelang readers, and modes are implementation-defined unless they are separately standardized.
473
+ For example, an implementation may include extension modules for Sudoku solving, portfolio selection, number-theory algorithms, graph search, matrix operations, or alphametic puzzles. Those modules may be valuable and may make example programs much faster, but their predicate names, arities, algorithms, and modes are implementation-defined unless they are separately standardized.
474
474
 
475
475
  An implementation that provides explanation output SHOULD make extension built-ins explainable at least as opaque successful or failed built-in calls, so that proof traces do not incorrectly report "no clauses" for a host-provided relation.
476
476
 
@@ -681,4 +681,3 @@ URL input uses host networking support when available. Hosts SHOULD treat downlo
681
681
 
682
682
  Programs SHOULD be written with finite search in mind. Broad default materialization can be expensive for helper predicates; use `materialize/2` declarations and concise output predicates when needed.
683
683
 
684
- Compatibility readers for external syntaxes such as RDF 1.2 Turtle, N-Triples, or Notation3 SHOULD be treated as front-end translations into eyelang clauses. Such readers may support N3 implication syntaxes such as `=>` and `<=`, empty `true` rule bodies, N3 equality as `owl:sameAs`, and common N3/SWAP built-in namespaces mapped to host extension built-ins, including exact integer arithmetic where the host provides it. Unless a host explicitly claims a separate RDF or N3 conformance profile, such readers are not part of core eyelang conformance and may accept only the subset that maps cleanly to finite Horn-clause reasoning.
package/eyelang.d.ts CHANGED
@@ -6,7 +6,6 @@ export interface EyelangRunOptions {
6
6
  proof?: boolean;
7
7
  why?: boolean;
8
8
  explain?: boolean;
9
- inputFormat?: 'auto' | 'eyelang' | 'rdf' | 'rdf12' | 'turtle' | 'ttl' | 'nt' | 'n3' | string;
10
9
  [key: string]: unknown;
11
10
  }
12
11
 
@@ -32,14 +31,6 @@ export class Program {
32
31
  export function makeProgram(clauses?: unknown[], options?: EyelangRunOptions): Program;
33
32
  export function parseClauses(source: string, options?: EyelangRunOptions): unknown[];
34
33
  export function parseProgramText(source: string, options?: EyelangRunOptions): unknown[];
35
- export function parseRdfClauses(source: string, options?: EyelangRunOptions): unknown[];
36
- export function rdfToEyelang(source: string, options?: EyelangRunOptions): string;
37
- export function clausesToEyelang(clauses: unknown[]): string;
38
- export function rdfIri(value: string): unknown;
39
- export function rdfBlank(value: string): unknown;
40
- export function rdfLiteral(value: string, datatype?: string, language?: string): unknown;
41
- export function rdfTripleTerm(subject: unknown, predicate: unknown, object: unknown): unknown;
42
- export function rdfGoal(subject: unknown, predicate: unknown, object: unknown): unknown;
43
34
 
44
35
  export class Env {
45
36
  constructor(parent?: Env | null);
@@ -79,9 +70,6 @@ declare const eyelang: {
79
70
  makeProgram: typeof makeProgram;
80
71
  parseClauses: typeof parseClauses;
81
72
  parseProgramText: typeof parseProgramText;
82
- parseRdfClauses: typeof parseRdfClauses;
83
- rdfToEyelang: typeof rdfToEyelang;
84
- clausesToEyelang: typeof clausesToEyelang;
85
73
  Solver: typeof Solver;
86
74
  Env: typeof Env;
87
75
  BuiltinRegistry: typeof BuiltinRegistry;
package/index.d.ts CHANGED
@@ -98,10 +98,6 @@ export interface EyelangRunOptions {
98
98
  why?: boolean;
99
99
  explain?: boolean;
100
100
  stats?: boolean;
101
- rdf?: boolean;
102
- rdf12?: boolean;
103
- n3?: boolean;
104
- inputFormat?: 'auto' | 'eyelang' | 'rdf' | 'rdf12' | 'turtle' | 'ttl' | 'nt' | 'n3' | string;
105
101
  args?: string[];
106
102
  maxBuffer?: number;
107
103
  [key: string]: unknown;
package/index.js CHANGED
@@ -27,8 +27,7 @@ function normalizeEyelangSourceForTempFile(source) {
27
27
  typeof source.eyelang === 'string' ? source.eyelang
28
28
  : typeof source.prolog === 'string' ? source.prolog
29
29
  : typeof source.text === 'string' ? source.text
30
- : typeof source.n3 === 'string' ? source.n3
31
- : null;
30
+ : null;
32
31
  if (text !== null) return text;
33
32
  }
34
33
  throw new TypeError('reason({ engine: "eyelang" }, input): each source must be a string or an object with an eyelang/prolog/text field');
@@ -49,9 +48,6 @@ function reasonEyelangSync(opt = {}, input = '') {
49
48
 
50
49
  if (opt.proof || opt.why || opt.explain) args.push('--proof');
51
50
  if (opt.stats) args.push('--stats');
52
- if (opt.rdf || opt.rdf12) args.push('--rdf');
53
- if (opt.n3) args.push('--n3');
54
- if (typeof opt.inputFormat === 'string' && opt.inputFormat) args.push('--input-format', opt.inputFormat);
55
51
  if (Array.isArray(opt.args)) args.push(...opt.args);
56
52
 
57
53
  const maxBuffer = Number.isFinite(opt.maxBuffer) ? opt.maxBuffer : 50 * 1024 * 1024;
@@ -13,7 +13,6 @@ import { searchBuiltins } from './search.js';
13
13
  import { numberTheoryBuiltins } from './number-theory.js';
14
14
  import { matrixBuiltins } from './matrix.js';
15
15
  import { alphameticBuiltins } from './alphametic.js';
16
- import { n3Builtins } from './n3.js';
17
16
 
18
17
  export class BuiltinRegistry {
19
18
  constructor() {
@@ -40,7 +39,7 @@ export class BuiltinRegistry {
40
39
 
41
40
  export function createDefaultRegistry() {
42
41
  const registry = new BuiltinRegistry();
43
- for (const mod of [coreBuiltins, arithmeticBuiltins, stringBuiltins, listBuiltins, aggregationBuiltins, formulaBuiltins, controlBuiltins, sudokuBuiltins, portfolioBuiltins, searchBuiltins, numberTheoryBuiltins, matrixBuiltins, alphameticBuiltins, n3Builtins]) {
42
+ for (const mod of [coreBuiltins, arithmeticBuiltins, stringBuiltins, listBuiltins, aggregationBuiltins, formulaBuiltins, controlBuiltins, sudokuBuiltins, portfolioBuiltins, searchBuiltins, numberTheoryBuiltins, matrixBuiltins, alphameticBuiltins]) {
44
43
  mod.register(registry);
45
44
  }
46
45
  return registry;
@@ -230,9 +230,9 @@ function undirectedGraph(program, predicate) {
230
230
  }
231
231
 
232
232
  function* fixedLengthCycle({ solver, goal, env }) {
233
- // fixed_length_cycle(EdgePred, Length, Relation, Cycle) is useful for RDF-like
234
- // edge(Source, Relation, Target) data. It enumerates closed walks of exactly
235
- // Length steps and returns the relation label and node list.
233
+ // fixed_length_cycle(EdgePred, Length, Relation, Cycle) is useful for
234
+ // labelled edge(Source, Relation, Target) data. It enumerates closed walks
235
+ // of exactly Length steps and returns the relation label and node list.
236
236
  const predicate = atomKey(deref(goal.args[0], env));
237
237
  const length = intTerm(goal.args[1], env);
238
238
  if (!predicate || length == null || length < 0) return;
@@ -18,7 +18,6 @@ export async function main(argv) {
18
18
  proof: false,
19
19
  stats: false,
20
20
  version: false,
21
- inputFormat: 'auto',
22
21
  };
23
22
 
24
23
  let endOptions = false;
@@ -37,14 +36,6 @@ export async function main(argv) {
37
36
  options.proof = true;
38
37
  } else if (!endOptions && (arg === '--stats' || arg === '-s')) {
39
38
  options.stats = true;
40
- } else if (!endOptions && (arg === '--rdf' || arg === '--rdf12')) {
41
- options.inputFormat = 'rdf12';
42
- } else if (!endOptions && arg === '--n3') {
43
- options.inputFormat = 'n3';
44
- } else if (!endOptions && arg === '--input-format') {
45
- const value = argv[++i];
46
- if (!value) throw new Error('--input-format needs a value');
47
- options.inputFormat = value;
48
39
  } else if (!endOptions && arg.startsWith('-') && arg !== '-') {
49
40
  throw new Error(`unknown option: ${arg}`);
50
41
  } else {
@@ -79,7 +70,7 @@ export async function main(argv) {
79
70
  }
80
71
 
81
72
  const engine = await loadEngine();
82
- const program = engine.Program.parseSources(sourceParts, { sourceMetadata: options.proof, markRecursive: options.proof, inputFormat: options.inputFormat });
73
+ const program = engine.Program.parseSources(sourceParts, { sourceMetadata: options.proof, markRecursive: options.proof });
83
74
 
84
75
  await runDefault(engine, program, options);
85
76
  }
@@ -152,9 +143,6 @@ Options:
152
143
  -h, --help Show this help text and exit.
153
144
  -p, --proof Enable proof explanations.
154
145
  -s, --stats Print solver statistics to stderr after execution.
155
- --rdf, --rdf12 Read input as RDF 1.2 Turtle/N-Triples compatibility syntax.
156
- --n3 Read input as Notation3 rule compatibility syntax.
157
- --input-format FORMAT Use eyelang, auto, rdf12, turtle, nt, or n3.
158
146
  -v, --version Show the package version and exit.
159
147
  -- Stop option parsing; following arguments are treated as files.
160
148
  `);
@@ -1,6 +1,6 @@
1
1
  // Small dependency-free hashing helpers shared by Node and browser builds.
2
- // They intentionally avoid node:crypto so src/index.js remains importable by the
3
- // browser playground when the N3 crypto builtins are registered.
2
+ // They intentionally avoid node:crypto so src/index.js remains importable by
3
+ // browser builds that register hashing builtins.
4
4
 
5
5
  const textEncoder = new TextEncoder();
6
6
 
@@ -2,7 +2,6 @@
2
2
  // The CLI imports the same parser, program, solver, and term primitives from here.
3
3
  export { Program, makeProgram } from './program.js';
4
4
  export { parseClauses, parseProgramText } from './parser.js';
5
- export { parseRdfClauses, rdfToEyelang, clausesToEyelang, rdfIri, rdfBlank, rdfLiteral, rdfTripleTerm, rdfGoal } from './rdf.js';
6
5
  export { Solver } from './solver.js';
7
6
  export * from './term.js';
8
7
  export { BuiltinRegistry, createDefaultRegistry, getDefaultRegistry } from './builtins/registry.js';
@@ -2,7 +2,6 @@
2
2
  // Indexes are deliberately conservative: they speed up common scalar arguments but never replace unification as the final check.
3
3
  import { ATOM, COMPOUND, Env, compound, deref, flattenConjunction, isScalar, termToString } from './term.js';
4
4
  import { parseClauses } from './parser.js';
5
- import { filenameLooksRdf, parseRdfClauses } from './rdf.js';
6
5
 
7
6
  export class Program {
8
7
  constructor(clauses = [], options = {}) {
@@ -234,11 +233,5 @@ export function makeProgram(source, options = {}) {
234
233
  }
235
234
 
236
235
  export function parseSourceClauses(source, options = {}) {
237
- const inputFormat = (options.inputFormat ?? options.format ?? 'eyelang').toString().toLowerCase();
238
- const filename = options.filename ?? '<input>';
239
- const autoRdf = inputFormat === 'auto' && filenameLooksRdf(filename);
240
- if (inputFormat === 'rdf' || inputFormat === 'rdf12' || inputFormat === 'n3' || inputFormat === 'turtle' || inputFormat === 'ttl' || inputFormat === 'nt' || autoRdf) {
241
- return parseRdfClauses(source, options);
242
- }
243
236
  return parseClauses(source, options);
244
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.33.2",
3
+ "version": "1.33.4",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [
@@ -54,7 +54,7 @@ export function runExamples(reporter = new TestReporter()) {
54
54
 
55
55
 
56
56
  function exampleIsRunnable(name) {
57
- return name.endsWith('.pl') || name.endsWith('.n3') || name.endsWith('.ttl') || name.endsWith('.nt');
57
+ return name.endsWith('.pl');
58
58
  }
59
59
 
60
60
  function runExample(name) {
@@ -79,7 +79,6 @@ function runProgramExample(programFile, filename, options) {
79
79
  const program = Program.parseSources([{ text, filename }], {
80
80
  sourceMetadata: options.proof,
81
81
  markRecursive: options.proof,
82
- inputFormat: 'auto',
83
82
  });
84
83
  return run(program, options).stdout;
85
84
  } finally {
@@ -30,7 +30,6 @@ import {
30
30
  unify,
31
31
  variantTerms,
32
32
  parseProgramText,
33
- rdfToEyelang,
34
33
  } from '../../lib/eyelang/index.js';
35
34
  import { parseGoalText } from '../../lib/eyelang/parser.js';
36
35
  import { selectClauseCandidates } from '../../lib/eyelang/program.js';
@@ -207,66 +206,6 @@ why(
207
206
  },
208
207
  },
209
208
 
210
- {
211
- name: 'RDF 1.2 Turtle annotations lower to rdf/3 facts',
212
- run: () => {
213
- const source = 'VERSION "1.2"\nPREFIX : <http://example.com/>\nPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n:alice :name "Alice" ~ :t {| :statedBy :bob ; :recorded "2021-07-07"^^xsd:date |} .\n';
214
- const actual = rdfToEyelang(source, { materializeRdf: false });
215
- assertEqual(actual, [
216
- 'rdf(iri("http://example.com/alice"), iri("http://example.com/name"), literal("Alice", iri("http://www.w3.org/2001/XMLSchema#string"), "", "")).\n',
217
- 'rdf(iri("http://example.com/t"), iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies"), triple(iri("http://example.com/alice"), iri("http://example.com/name"), literal("Alice", iri("http://www.w3.org/2001/XMLSchema#string"), "", ""))).\n',
218
- 'rdf(iri("http://example.com/t"), iri("http://example.com/statedBy"), iri("http://example.com/bob")).\n',
219
- 'rdf(iri("http://example.com/t"), iri("http://example.com/recorded"), literal("2021-07-07", iri("http://www.w3.org/2001/XMLSchema#date"), "", "")).\n',
220
- ].join(''), 'rdfToEyelang');
221
- },
222
- },
223
- {
224
- name: 'Notation3 rules materialize derived RDF triples',
225
- run: () => {
226
- const source = '@prefix : <http://example.com/> .\n{ ?x :parent ?y . } => { ?x :related ?y . } .\n:alice :parent :bob .\n';
227
- const actual = run(source, { inputFormat: 'n3' }).stdout;
228
- assertEqual(actual, 'rdf(iri("http://example.com/alice"), iri("http://example.com/related"), iri("http://example.com/bob")).\n', 'stdout');
229
- },
230
- },
231
- {
232
- name: '--rdf reads RDF 1.2 / N3 compatibility input',
233
- run: () => {
234
- const source = '@prefix : <http://example.com/> .\n{ ?x :parent ?y . } => { ?x :related ?y . } .\n:alice :parent :bob .\n';
235
- const result = runCli(['--rdf', '-'], { input: source });
236
- assertEqual(result.status, 0, 'exit status');
237
- assertEqual(result.stdout, 'rdf(iri("http://example.com/alice"), iri("http://example.com/related"), iri("http://example.com/bob")).\n', 'stdout');
238
- assertEqual(result.stderr, '', 'stderr');
239
- },
240
- },
241
-
242
- {
243
- name: 'Notation3 <= rules and builtins materialize derived RDF triples',
244
- run: () => {
245
- const source = '@prefix : <http://example.com/> .\n@prefix math: <http://www.w3.org/2000/10/swap/math#> .\n{ ?x :ok true . } <= { (2 3) math:sum ?n . ?n math:equalTo 5 . ?x :seed true . } .\n:case :seed true .\n';
246
- const actual = run(source, { inputFormat: 'n3' }).stdout;
247
- assertEqual(actual, 'rdf(iri("http://example.com/case"), iri("http://example.com/ok"), literal("true", iri("http://www.w3.org/2001/XMLSchema#boolean"), "", "")).\n', 'stdout');
248
- },
249
- },
250
-
251
- {
252
- name: 'bundled RDF 1.2 / N3 examples match golden output',
253
- run: () => {
254
- const dir = path.join(packageRoot, 'examples', 'eyelang');
255
- const files = fs.readdirSync(dir)
256
- .filter((name) => name.endsWith('.n3') || name.endsWith('.ttl'))
257
- .sort();
258
- assertEqual(files.length > 0, true, 'rdf example files exist');
259
- for (const name of files) {
260
- const result = runCli([path.join('examples', 'eyelang', name)]);
261
- assertEqual(result.status, 0, `${name} exit status`);
262
- assertEqual(result.stderr, '', `${name} stderr`);
263
- const expected = fs.readFileSync(path.join(dir, 'output', name), 'utf8');
264
- assertEqual(result.stdout, expected, `${name} stdout`);
265
- }
266
- },
267
- },
268
-
269
-
270
209
  {
271
210
  name: '--proof enables materialization explanations',
272
211
  run: () => {
package/test/run.js CHANGED
@@ -126,9 +126,26 @@ function addSectionToAggregate(summary) {
126
126
  aggregate.nonconform += failed;
127
127
  }
128
128
 
129
- function scoreLine() {
129
+ function scoreColor(score) {
130
+ if (aggregate.crashed || aggregate.nonconform) return C.r;
131
+ if (aggregate.incomplete || score < 100) return C.y;
132
+ return C.g;
133
+ }
134
+
135
+ function scoreLine(elapsedMs) {
130
136
  const score = aggregate.total === 0 ? 0 : (100 * aggregate.ok) / aggregate.total;
131
- return `TOTAL [COUNT:${aggregate.total}] OK: ⭐${aggregate.ok}⭐ INCOMPLETE: ⭐${aggregate.incomplete}⭐ NONCONFORM: ⭐${aggregate.nonconform}⭐ CRASHED: ⭐${aggregate.crashed}⭐ => SCORE: ⭐⭐⭐${score.toFixed(1)}⭐⭐⭐`;
137
+ const scoreC = scoreColor(score);
138
+ return [
139
+ `${C.dim}TOTAL${C.n}`,
140
+ `${C.dim}[COUNT:${aggregate.total}]${C.n}`,
141
+ `${C.g}OK:${C.n} ${C.y}⭐${aggregate.ok}⭐${C.n}`,
142
+ `${C.r}INCOMPLETE:${C.n} ${C.y}⭐${aggregate.incomplete}⭐${C.n}`,
143
+ `${C.r}NONCONFORM:${C.n} ${C.y}⭐${aggregate.nonconform}⭐${C.n}`,
144
+ `${C.r}CRASHED:${C.n} ${C.y}⭐${aggregate.crashed}⭐${C.n}`,
145
+ '=>',
146
+ `${scoreC}SCORE:${C.n} ${C.y}⭐⭐⭐${score.toFixed(1)}⭐⭐⭐${C.n}`,
147
+ `${C.dim}ELAPSED:${C.n} ${C.y}${formatDuration(elapsedMs)}${C.n}`,
148
+ ].join(' ');
132
149
  }
133
150
 
134
151
  function childEnv() {
@@ -194,6 +211,7 @@ function runSection(label, cmd, args) {
194
211
  }
195
212
 
196
213
  (async function main() {
214
+ const suiteStartedAt = Date.now();
197
215
  let status = 0;
198
216
  for (const [label, cmd, args] of sections) {
199
217
  const sectionStatus = await runSection(label, cmd, args);
@@ -204,7 +222,7 @@ function runSection(label, cmd, args) {
204
222
  }
205
223
 
206
224
  console.log('');
207
- console.log(scoreLine());
225
+ console.log(scoreLine(Date.now() - suiteStartedAt));
208
226
 
209
227
  process.exit(status);
210
228
  })();
@@ -1,12 +0,0 @@
1
- # Inspired by eyereasoner/eyeling examples/annotation.n3.
2
- # Demonstrates RDF 1.2 annotation syntax lowered through rdf:reifies.
3
- VERSION "1.2"
4
- PREFIX : <http://example.org/annotation#>
5
- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
-
7
- :a :name "Alice" ~ :t {| :statedBy :bob ; :recorded "2021-07-07"^^xsd:date |} .
8
-
9
- { ?Statement rdf:reifies <<( ?Person :name ?Name )>> .
10
- ?Statement :statedBy ?Agent . }
11
- =>
12
- { ?Person :nameStatementBy ?Agent . } .
@@ -1,9 +0,0 @@
1
- # RDF 1.2 directional language-tagged string example.
2
- VERSION "1.2"
3
- PREFIX : <http://example.org/lang#>
4
-
5
- :greeting :label "שלום"@he--rtl .
6
-
7
- { ?Thing :label ?Text . }
8
- =>
9
- { ?Thing :hasDirectionalLabel true . } .
@@ -1,41 +0,0 @@
1
- # Adapted from eyeling/examples/ackermann.n3.
2
- # Demonstrates <= rules over RDF lists and exact BigInt-capable math builtins.
3
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
4
- @prefix : <https://eyereasoner.github.io/eyeling/examples/ackermann#>.
5
-
6
- # ackermann(x, y) = hyper(x, y + 3, 2) - 3.
7
- { (?X ?Y) :ackermann ?A } <= {
8
- (?Y 3) math:sum ?B.
9
- (?X ?B 2) :ackermann ?C.
10
- (?C 3) math:difference ?A.
11
- }.
12
-
13
- # Successor, addition, multiplication, and exponentiation levels.
14
- { (0 ?Y ?Z) :ackermann ?A } <= { (?Y 1) math:sum ?A }.
15
- { (1 ?Y ?Z) :ackermann ?A } <= { (?Y ?Z) math:sum ?A }.
16
- { (2 ?Y ?Z) :ackermann ?A } <= { (?Y ?Z) math:product ?A }.
17
- { (3 ?Y ?Z) :ackermann ?A } <= { (?Z ?Y) math:exponentiation ?A }.
18
-
19
- # Tetration and higher hyperoperations.
20
- { (?X 0 ?Z) :ackermann 1 } <= { ?X math:greaterThan 3 }.
21
- { (?X ?Y ?Z) :ackermann ?A } <= {
22
- ?X math:greaterThan 3.
23
- ?Y math:notEqualTo 0.
24
- (?Y 1) math:difference ?B.
25
- (?X ?B ?Z) :ackermann ?C.
26
- (?X 1) math:difference ?D.
27
- (?D ?C ?Z) :ackermann ?A.
28
- }.
29
-
30
- { (0 0) :ackermann ?A } => { :ackermann_0_0 :value ?A }.
31
- { (0 6) :ackermann ?A } => { :ackermann_0_6 :value ?A }.
32
- { (1 2) :ackermann ?A } => { :ackermann_1_2 :value ?A }.
33
- { (1 7) :ackermann ?A } => { :ackermann_1_7 :value ?A }.
34
- { (2 2) :ackermann ?A } => { :ackermann_2_2 :value ?A }.
35
- { (2 9) :ackermann ?A } => { :ackermann_2_9 :value ?A }.
36
- { (3 4) :ackermann ?A } => { :ackermann_3_4 :value ?A }.
37
- { (3 1000) :ackermann ?A } => { :ackermann_3_1000 :value ?A }.
38
- { (4 0) :ackermann ?A } => { :ackermann_4_0 :value ?A }.
39
- { (4 1) :ackermann ?A } => { :ackermann_4_1 :value ?A }.
40
- { (4 2) :ackermann ?A } => { :ackermann_4_2 :value ?A }.
41
- { (5 0) :ackermann ?A } => { :ackermann_5_0 :value ?A }.
@@ -1,12 +0,0 @@
1
- # Adapted from eyeling/examples/age.n3.
2
- # Classifies people against age thresholds using N3 math builtins.
3
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
4
- @prefix : <https://eyereasoner.github.io/eyeling/examples/age#>.
5
-
6
- :alice :age 23.
7
- :bob :age 17.
8
- :carol :age 65.
9
-
10
- { ?P :age ?A. ?A math:notLessThan 18. } => { ?P :adult true. }.
11
- { ?P :age ?A. ?A math:notLessThan 65. } => { ?P :senior true. }.
12
- { ?P :adult true. ?P :senior true. } => { ?P :discount :seniorPass. }.
@@ -1,11 +0,0 @@
1
- # Adapted from eyeling/examples/alignment-demo.n3.
2
- # Simple vocabulary alignment using owl:sameAs and an explicit transfer rule.
3
- @prefix owl: <http://www.w3.org/2002/07/owl#>.
4
- @prefix schema: <https://schema.org/>.
5
- @prefix ex: <https://example.org/ns#>.
6
- @prefix : <https://eyereasoner.github.io/ns#>.
7
-
8
- ex:label = schema:name.
9
- :alice ex:label "Alice".
10
-
11
- { ?p owl:sameAs ?q. ?s ?p ?o. } => { ?s ?q ?o. }.
@@ -1,13 +0,0 @@
1
- # Adapted from eyeling/examples/allen-interval-calculus.n3.
2
- # Classifies a few interval relations with math comparisons.
3
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
4
- @prefix : <https://eyereasoner.github.io/eyeling/examples/allen#>.
5
-
6
- :a :start 1; :end 3.
7
- :b :start 3; :end 5.
8
- :c :start 4; :end 8.
9
- :d :start 1; :end 8.
10
-
11
- { ?X :end ?XE. ?Y :start ?YS. ?XE math:equalTo ?YS. } => { (?X ?Y) :allen :meets. }.
12
- { ?X :start ?XS; :end ?XE. ?Y :start ?YS; :end ?YE. ?XS math:lessThan ?YS. ?XE math:greaterThan ?YS. ?XE math:lessThan ?YE. } => { (?X ?Y) :allen :overlaps. }.
13
- { ?X :start ?XS; :end ?XE. ?Y :start ?YS; :end ?YE. ?XS math:equalTo ?YS. ?XE math:lessThan ?YE. } => { (?X ?Y) :allen :starts. }.
@@ -1,11 +0,0 @@
1
- # Adapted from eyeling/examples/backward-recursion.n3.
2
- # Demonstrates recursive <= rules.
3
- @prefix : <urn:example#>.
4
-
5
- :a :parent :b.
6
- :b :parent :c.
7
- :c :parent :d.
8
-
9
- { ?x :ancestor ?y } <= { ?x :parent ?y }.
10
- { ?x :ancestor ?z } <= { ?x :parent ?y. ?y :ancestor ?z }.
11
- { :a :ancestor ?who } => { :a :reaches ?who }.
@@ -1,10 +0,0 @@
1
- # Adapted from eyeling/examples/backward.n3.
2
- # Backward rule example: <= acts like a :- rule over N3 triples.
3
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
4
- @prefix : <https://eyereasoner.github.io/ns#>.
5
-
6
- # something is more interesting if it is greater
7
- { ?X :moreInterestingThan ?Y. } <= { ?X math:greaterThan ?Y. }.
8
-
9
- # derivation (forward)
10
- { 5 :moreInterestingThan 3. } => { 5 :isIndeedMoreInterestingThan 3. }.
@@ -1,11 +0,0 @@
1
- # Adapted from eyeling/examples/basic-monadic.n3.
2
- # A tiny monadic propagation benchmark.
3
- @prefix : <https://eyereasoner.github.io/eyeling/examples/basic-monadic#>.
4
-
5
- :i0 a :N0.
6
- :i1 a :N0.
7
- :i2 a :N1.
8
-
9
- { ?X a :N0. } => { ?X a :N1. }.
10
- { ?X a :N1. } => { ?X a :N2. }.
11
- { ?X a :N2. } => { ?X :accepted true. }.