eyeprolog 0.6.0 → 1.0.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.
- package/README.md +5 -18
- package/book-assets/example-landscape.svg +3 -3
- package/book-assets/laboratory-progression.svg +1 -1
- package/book-assets/title-page.svg +62 -212
- package/examples/basic-monadic.pl +1 -1
- package/examples/book/README.md +0 -9
- package/index.d.ts +3 -0
- package/package.json +1 -4
- package/playground.html +0 -16
- package/test/conformance/ISO-MATRIX.md +1 -1
- package/test/conformance/README.md +3 -3
- package/test/run-all.mjs +0 -2
- package/test/run-examples.mjs +0 -11
- package/test/run-regression.mjs +18 -0
- package/the-art-of-eyeprolog.md +57 -213
- package/why-eyeprolog.md +53 -264
- package/book-assets/rdf-adapter-pipeline.svg +0 -14
- package/book-assets/sockets-providers.svg +0 -21
- package/examples/book/chapter-15/01-rdf.pl +0 -3
- package/examples/book/chapter-16/01-socket.pl +0 -9
- package/examples/book/chapter-16/02-socket-2.pl +0 -5
- package/examples/dpv-odrl-purpose-mapping.pl +0 -94
- package/examples/input/dpv-odrl-purpose-mapping-rules.pl +0 -63
- package/examples/input/dpv-odrl-purpose-mapping.ttl +0 -34
- package/examples/input/odrl-dpv-fpv-trust-flow-rules.pl +0 -74
- package/examples/input/odrl-dpv-fpv-trust-flow.ttl +0 -38
- package/examples/input/odrl-dpv-healthcare-risk-ranked-rules.pl +0 -109
- package/examples/input/odrl-dpv-healthcare-risk-ranked.ttl +0 -45
- package/examples/input/odrl-dpv-risk-ranked-rules.pl +0 -121
- package/examples/input/odrl-dpv-risk-ranked.ttl +0 -59
- package/examples/input/odrl-policy-advanced-rules.pl +0 -90
- package/examples/input/odrl-policy-advanced.ttl +0 -26
- package/examples/input/odrl-policy-rules.pl +0 -50
- package/examples/input/odrl-policy.ttl +0 -10
- package/examples/input/rdf12-annotated-claims-rules.pl +0 -96
- package/examples/input/rdf12-annotated-claims.ttl +0 -19
- package/examples/input/rdf12-annotation-rules.pl +0 -23
- package/examples/input/rdf12-annotation.ttl +0 -10
- package/examples/input/rdf12-directional-language-rules.pl +0 -5
- package/examples/input/rdf12-directional-language.ttl +0 -6
- package/examples/input/rdf12-nested-triple-term-rules.pl +0 -13
- package/examples/input/rdf12-nested-triple-term.ttl +0 -7
- package/examples/input/rdf12-trig-graph-join-rules.pl +0 -15
- package/examples/input/rdf12-trig-graph-join.trig +0 -9
- package/examples/input/rdf12-trig-named-graph-rules.pl +0 -8
- package/examples/input/rdf12-trig-named-graph.trig +0 -8
- package/examples/input/rdf12-trig-triple-term-rules.pl +0 -9
- package/examples/input/rdf12-trig-triple-term.trig +0 -7
- package/examples/input/rdf12-triple-term-rules.pl +0 -9
- package/examples/input/rdf12-triple-term.ttl +0 -5
- package/examples/odrl-dpv-fpv-trust-flow.pl +0 -109
- package/examples/odrl-dpv-healthcare-risk-ranked.pl +0 -150
- package/examples/odrl-dpv-risk-ranked.pl +0 -174
- package/examples/odrl-policy-advanced-from-turtle.pl +0 -114
- package/examples/odrl-policy-from-turtle.pl +0 -63
- package/examples/output/dpv-odrl-purpose-mapping.pl +0 -1
- package/examples/output/odrl-dpv-fpv-trust-flow.pl +0 -1
- package/examples/output/odrl-dpv-healthcare-risk-ranked.pl +0 -1
- package/examples/output/odrl-dpv-risk-ranked.pl +0 -1
- package/examples/output/odrl-policy-advanced-from-turtle.pl +0 -1
- package/examples/output/odrl-policy-from-turtle.pl +0 -1
- package/examples/output/rdf12-annotated-claims.pl +0 -1
- package/examples/output/rdf12-annotation.pl +0 -1
- package/examples/output/rdf12-directional-language.pl +0 -2
- package/examples/output/rdf12-nested-triple-term.pl +0 -1
- package/examples/output/rdf12-trig-graph-join.pl +0 -1
- package/examples/output/rdf12-trig-named-graph.pl +0 -3
- package/examples/output/rdf12-trig-triple-term.pl +0 -1
- package/examples/output/rdf12-triple-term.pl +0 -1
- package/examples/output/socket-age.pl +0 -1
- package/examples/output/socket-family.pl +0 -3
- package/examples/proof/dpv-odrl-purpose-mapping.pl +0 -16
- package/examples/proof/odrl-policy-from-turtle.pl +0 -40
- package/examples/proof/rdf12-annotation.pl +0 -28
- package/examples/proof/rdf12-directional-language.pl +0 -32
- package/examples/proof/rdf12-nested-triple-term.pl +0 -16
- package/examples/proof/rdf12-trig-graph-join.pl +0 -20
- package/examples/proof/rdf12-trig-named-graph.pl +0 -52
- package/examples/proof/rdf12-trig-triple-term.pl +0 -16
- package/examples/proof/rdf12-triple-term.pl +0 -16
- package/examples/proof/socket-age.pl +0 -32
- package/examples/proof/socket-family.pl +0 -59
- package/examples/rdf12-annotated-claims.pl +0 -112
- package/examples/rdf12-annotation.pl +0 -33
- package/examples/rdf12-directional-language.pl +0 -13
- package/examples/rdf12-nested-triple-term.pl +0 -20
- package/examples/rdf12-trig-graph-join.pl +0 -23
- package/examples/rdf12-trig-named-graph.pl +0 -16
- package/examples/rdf12-trig-triple-term.pl +0 -16
- package/examples/rdf12-triple-term.pl +0 -16
- package/examples/socket-age.pl +0 -40
- package/examples/socket-family.pl +0 -29
- package/test/run-rdf-tools.mjs +0 -74
- package/tools/README.md +0 -31
- package/tools/pl-to-rdf.mjs +0 -29
- package/tools/rdf-codec.mjs +0 -242
- package/tools/rdf-input.mjs +0 -30
- package/tools/rdf-to-pl.mjs +0 -53
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/eyeprolog)
|
|
4
4
|
[](https://doi.org/10.5281/zenodo.21446308)
|
|
5
5
|
|
|
6
|
-
EyeProlog
|
|
6
|
+
EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.
|
|
7
7
|
|
|
8
8
|
**[Book — *The Art of EyeProlog*](https://eyereasoner.github.io/eyeprolog/the-art-of-eyeprolog)** ·
|
|
9
9
|
**[Why EyeProlog?](https://eyereasoner.github.io/eyeprolog/why-eyeprolog)** ·
|
|
10
10
|
**[Playground](https://eyereasoner.github.io/eyeprolog/playground)**
|
|
11
11
|
|
|
12
12
|
The book is the reference for the language, command line, JavaScript API,
|
|
13
|
-
|
|
13
|
+
examples, proofs, conformance, and implementation.
|
|
14
14
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
@@ -18,9 +18,8 @@ EyeProlog requires Node.js 18 or newer.
|
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
npm install --global eyeprolog
|
|
21
|
-
|
|
22
|
-
eyeprolog --proof
|
|
23
|
-
eyeprolog --goal 'type(socrates, mortal)' examples/socrates.pl
|
|
21
|
+
printf 'human(socrates).\nmortal(X) :- human(X).\n' |
|
|
22
|
+
eyeprolog --proof --goal 'mortal(socrates)' -
|
|
24
23
|
```
|
|
25
24
|
|
|
26
25
|
Programs may declare their default queries with `%% goal:` comments.
|
|
@@ -34,19 +33,7 @@ EyeProlog adds 44 public library predicates to its 127-entry ISO core registry.
|
|
|
34
33
|
`src/eyeprolog-common-library.pl`; both are autoloaded in Node and the
|
|
35
34
|
browser. None requires host support. Other Prolog systems should load only
|
|
36
35
|
`eyeprolog-library.pl`, which avoids redefining their common list predicates.
|
|
37
|
-
Portable text predicates use ISO atoms or character lists
|
|
38
|
-
RDF tools emit lexical values as ISO atoms as well.
|
|
39
|
-
|
|
40
|
-
## RDF 1.2
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
node tools/rdf-to-pl.mjs --rules rules.pl data.ttl -o program.pl
|
|
44
|
-
eyeprolog program.pl > derived.pl
|
|
45
|
-
node tools/pl-to-rdf.mjs derived.pl -o derived.nq
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
See the book for RDF mappings, graphs, triple terms, reifiers, annotations,
|
|
49
|
-
formats, and policy examples.
|
|
36
|
+
Portable text predicates use ISO atoms or character lists.
|
|
50
37
|
|
|
51
38
|
## Development
|
|
52
39
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="500" viewBox="0 0 900 500" role="img" aria-labelledby="title desc">
|
|
2
2
|
<title id="title">The executable example landscape</title>
|
|
3
|
-
<desc id="desc">A map connects a central EyeProlog program to mathematics, search, planning, policy, science, program analysis, symbolic systems,
|
|
3
|
+
<desc id="desc">A map connects a central EyeProlog program to mathematics, search, planning, policy, science, program analysis, and symbolic systems, with paths to answers and proofs.</desc>
|
|
4
4
|
<defs>
|
|
5
5
|
<style>
|
|
6
6
|
.bg{fill:#FFF9E8}.region{stroke:#17324D;stroke-width:2}.core{fill:#17324D;stroke:#102A3A;stroke-width:3}
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
<text class="small" x="145" y="374" text-anchor="middle">integrity · audit</text>
|
|
29
29
|
|
|
30
30
|
<path class="region" fill="#BFEAF1" d="M655 280H865V440H630L600 345Z"/>
|
|
31
|
-
<text class="label" x="755" y="326" text-anchor="middle">SCIENCE &
|
|
31
|
+
<text class="label" x="755" y="326" text-anchor="middle">SCIENCE & MODELS</text>
|
|
32
32
|
<text class="small" x="755" y="353" text-anchor="middle">models · measurements</text>
|
|
33
|
-
<text class="small" x="755" y="374" text-anchor="middle">
|
|
33
|
+
<text class="small" x="755" y="374" text-anchor="middle">equations · evidence</text>
|
|
34
34
|
|
|
35
35
|
<path class="link" d="M270 145L355 205M630 145L545 205M270 355L355 295M630 355L545 295"/>
|
|
36
36
|
<rect class="core" x="335" y="175" width="230" height="150" rx="18"/>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<rect class="stage s4" x="540" y="105" width="160" height="235" rx="16"/>
|
|
34
34
|
<text class="number" x="620" y="143" text-anchor="middle">8–11</text>
|
|
35
35
|
<text class="label" x="620" y="176" text-anchor="middle">DOMAINS</text>
|
|
36
|
-
<text class="small" x="620" y="207" text-anchor="middle">analysis · policy</text><text class="small" x="620" y="229" text-anchor="middle">science ·
|
|
36
|
+
<text class="small" x="620" y="207" text-anchor="middle">analysis · policy</text><text class="small" x="620" y="229" text-anchor="middle">science · models</text>
|
|
37
37
|
<text class="small" x="620" y="290" text-anchor="middle">preserve evidence</text><text class="small" x="620" y="313" text-anchor="middle">and boundaries</text>
|
|
38
38
|
|
|
39
39
|
<rect class="stage s5" x="720" y="85" width="150" height="275" rx="18"/>
|
|
@@ -2,223 +2,73 @@
|
|
|
2
2
|
width="1000" height="1450" viewBox="0 0 1000 1450"
|
|
3
3
|
role="img" aria-labelledby="title desc">
|
|
4
4
|
<title id="title">The Art of EyeProlog</title>
|
|
5
|
-
<desc id="desc">
|
|
5
|
+
<desc id="desc">Minimal book title page with a vector rendering of the EYE logo, the book title, subtitle, and author.</desc>
|
|
6
6
|
|
|
7
7
|
<defs>
|
|
8
|
-
<linearGradient id="
|
|
9
|
-
<stop offset="0
|
|
10
|
-
<stop offset="
|
|
8
|
+
<linearGradient id="eye-spectrum" x1="20" y1="4" x2="48" y2="65" gradientUnits="userSpaceOnUse">
|
|
9
|
+
<stop offset="0" stop-color="#ff2738"/>
|
|
10
|
+
<stop offset="0.28" stop-color="#ff6b25"/>
|
|
11
|
+
<stop offset="0.47" stop-color="#fff23c"/>
|
|
12
|
+
<stop offset="0.69" stop-color="#51e523"/>
|
|
13
|
+
<stop offset="1" stop-color="#38e7a2"/>
|
|
11
14
|
</linearGradient>
|
|
15
|
+
<linearGradient id="eye-ring" x1="12" y1="23" x2="57" y2="48" gradientUnits="userSpaceOnUse">
|
|
16
|
+
<stop offset="0" stop-color="#efff38"/>
|
|
17
|
+
<stop offset="0.45" stop-color="#fff947"/>
|
|
18
|
+
<stop offset="1" stop-color="#bdf02b"/>
|
|
19
|
+
</linearGradient>
|
|
20
|
+
<linearGradient id="eye-center" x1="18" y1="25" x2="53" y2="45" gradientUnits="userSpaceOnUse">
|
|
21
|
+
<stop offset="0" stop-color="#57d9ca"/>
|
|
22
|
+
<stop offset="0.45" stop-color="#22bde7"/>
|
|
23
|
+
<stop offset="1" stop-color="#18b6ec"/>
|
|
24
|
+
</linearGradient>
|
|
25
|
+
<clipPath id="eye-orb-clip">
|
|
26
|
+
<path d="M34 3.5C52 3.5 65.5 17 65.5 34.5S52 65 34 65 3 51.5 3 34.5 16 3.5 34 3.5Z"/>
|
|
27
|
+
</clipPath>
|
|
12
28
|
<style>
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.codesm { fill:#17324D; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:15px; }
|
|
38
|
-
.label { fill:#17324D; font-family: Georgia, 'Times New Roman', serif; font-size:21px; }
|
|
39
|
-
.node { fill:#FFFDF8; stroke:#17324D; stroke-width:3; }
|
|
40
|
-
.rdfnode { fill:#78AFC0; stroke:#008EAA; stroke-width:3; }
|
|
41
|
-
.panel { fill:#FFFDF8; fill-opacity:0.96; stroke-width:3.5; }
|
|
42
|
-
.softbox { fill:#EAF8FA; stroke:#17324D; stroke-width:2.2; }
|
|
29
|
+
.title-small {
|
|
30
|
+
fill: #17324d;
|
|
31
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
32
|
+
font-size: 52px;
|
|
33
|
+
letter-spacing: 8px;
|
|
34
|
+
}
|
|
35
|
+
.title-main {
|
|
36
|
+
fill: #17324d;
|
|
37
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
38
|
+
font-size: 108px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
letter-spacing: -3px;
|
|
41
|
+
}
|
|
42
|
+
.subtitle {
|
|
43
|
+
fill: #3f6371;
|
|
44
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
45
|
+
font-size: 30px;
|
|
46
|
+
}
|
|
47
|
+
.author {
|
|
48
|
+
fill: #17324d;
|
|
49
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
50
|
+
font-size: 28px;
|
|
51
|
+
letter-spacing: 3px;
|
|
52
|
+
}
|
|
43
53
|
</style>
|
|
44
54
|
</defs>
|
|
45
55
|
|
|
46
|
-
<rect width="1000" height="1450"
|
|
47
|
-
|
|
48
|
-
<!--
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</g>
|
|
65
|
-
|
|
66
|
-
<!-- upper labels -->
|
|
67
|
-
<g id="labels">
|
|
68
|
-
<text x="210" y="455" text-anchor="middle" class="section wine">ISO PROLOG</text>
|
|
69
|
-
<text x="210" y="480" text-anchor="middle" class="smallserif wine">(RULES)</text>
|
|
70
|
-
<text x="790" y="455" text-anchor="middle" class="section green">RDF 1.2</text>
|
|
71
|
-
<text x="790" y="480" text-anchor="middle" class="smallserif green">(LINKED DATA)</text>
|
|
72
|
-
</g>
|
|
73
|
-
|
|
74
|
-
<!-- hero diagrams -->
|
|
75
|
-
<g id="prolog-rules">
|
|
76
|
-
<rect x="80" y="510" width="220" height="180" rx="18"
|
|
77
|
-
fill="#FFFDF8" stroke="#C8A100" stroke-width="3"/>
|
|
78
|
-
<text x="100" y="552" class="codesm" style="font-size:14px">path(X, Y) :-</text>
|
|
79
|
-
<text x="122" y="580" class="codesm" style="font-size:14px">edge(X, Y).</text>
|
|
80
|
-
<text x="100" y="615" class="codesm" style="font-size:14px">path(X, Y) :-</text>
|
|
81
|
-
<text x="122" y="643" class="codesm" style="font-size:14px">edge(X, Z),</text>
|
|
82
|
-
<text x="122" y="671" class="codesm" style="font-size:14px">path(Z, Y).</text>
|
|
83
|
-
</g>
|
|
84
|
-
|
|
85
|
-
<g id="rdf-graph">
|
|
86
|
-
<line x1="735" y1="535" x2="805" y2="575" class="green-stroke mid round"/>
|
|
87
|
-
<line x1="805" y1="575" x2="765" y2="640" class="green-stroke mid round"/>
|
|
88
|
-
<line x1="805" y1="575" x2="875" y2="610" class="green-stroke mid round"/>
|
|
89
|
-
<line x1="765" y1="640" x2="835" y2="690" class="green-stroke mid round"/>
|
|
90
|
-
<circle cx="735" cy="535" r="17" class="rdfnode"/>
|
|
91
|
-
<circle cx="805" cy="575" r="17" class="rdfnode"/>
|
|
92
|
-
<circle cx="765" cy="640" r="17" class="rdfnode"/>
|
|
93
|
-
<circle cx="875" cy="610" r="17" class="rdfnode"/>
|
|
94
|
-
<circle cx="835" cy="690" r="17" class="rdfnode"/>
|
|
95
|
-
|
|
96
|
-
<rect x="748" y="500" width="116" height="40" rx="8" fill="#FFF9E8" stroke="#17324D" stroke-width="2"/>
|
|
97
|
-
<text x="806" y="526" text-anchor="middle" class="smallserif navy">ex:Alice</text>
|
|
98
|
-
|
|
99
|
-
<rect x="855" y="558" width="118" height="40" rx="8" fill="#FFF9E8" stroke="#17324D" stroke-width="2"/>
|
|
100
|
-
<text x="914" y="584" text-anchor="middle" class="smallserif navy">ex:knows</text>
|
|
101
|
-
|
|
102
|
-
<rect x="846" y="682" width="106" height="40" rx="8" fill="#FFF9E8" stroke="#17324D" stroke-width="2"/>
|
|
103
|
-
<text x="899" y="708" text-anchor="middle" class="smallserif navy">ex:Bob</text>
|
|
104
|
-
</g>
|
|
105
|
-
|
|
106
|
-
<!-- abstract bridge -->
|
|
107
|
-
<g id="bridge">
|
|
108
|
-
<path d="M320 710 C338 560, 410 500, 500 500 C590 500, 662 560, 680 710"
|
|
109
|
-
fill="none" stroke="#F6D978" stroke-width="62" stroke-linecap="round"/>
|
|
110
|
-
<path d="M320 710 C338 560, 410 500, 500 500 C590 500, 662 560, 680 710"
|
|
111
|
-
class="navy-stroke mid round"/>
|
|
112
|
-
|
|
113
|
-
<path d="M442 488 L558 488 L572 556 L428 556 Z" fill="#FFF4BF" stroke="#17324D" stroke-width="3"/>
|
|
114
|
-
<text x="500" y="523" text-anchor="middle" class="section" style="font-size:14px; letter-spacing:0.5px;"><tspan class="logo-eye">EYE</tspan><tspan class="logo-prolog">PROLOG</tspan></text>
|
|
115
|
-
|
|
116
|
-
<rect x="290" y="690" width="68" height="148" rx="7" fill="#FFF4BF" stroke="#17324D" stroke-width="3"/>
|
|
117
|
-
<rect x="278" y="676" width="92" height="22" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
118
|
-
<rect x="276" y="830" width="96" height="24" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
119
|
-
<line x1="306" y1="708" x2="306" y2="824" class="gold-stroke thin"/>
|
|
120
|
-
<line x1="342" y1="708" x2="342" y2="824" class="gold-stroke thin"/>
|
|
121
|
-
|
|
122
|
-
<rect x="642" y="690" width="68" height="148" rx="7" fill="#FFF4BF" stroke="#17324D" stroke-width="3"/>
|
|
123
|
-
<rect x="630" y="676" width="92" height="22" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
124
|
-
<rect x="628" y="830" width="96" height="24" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
125
|
-
<line x1="658" y1="708" x2="658" y2="824" class="gold-stroke thin"/>
|
|
126
|
-
<line x1="694" y1="708" x2="694" y2="824" class="gold-stroke thin"/>
|
|
127
|
-
</g>
|
|
128
|
-
|
|
129
|
-
<!-- proof tree -->
|
|
130
|
-
<g id="proof-tree">
|
|
131
|
-
<circle cx="500" cy="590" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
132
|
-
<circle cx="455" cy="660" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
133
|
-
<circle cx="545" cy="660" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
134
|
-
<circle cx="420" cy="730" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
135
|
-
<circle cx="500" cy="730" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
136
|
-
<circle cx="580" cy="730" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
137
|
-
<path d="M500 608 L455 642 M500 608 L545 642 M455 678 L420 712 M455 678 L500 712 M545 678 L580 712"
|
|
138
|
-
class="green-stroke mid round"/>
|
|
139
|
-
<line x1="500" y1="752" x2="500" y2="790" class="green-stroke mid round" stroke-dasharray="4 8"/>
|
|
140
|
-
<path d="M491 785 L500 796 L509 785" class="green-stroke mid round"/>
|
|
141
|
-
<circle cx="500" cy="824" r="29" fill="#008EAA" stroke="#17324D" stroke-width="3"/>
|
|
142
|
-
<path d="M486 825 L497 836 L516 810" fill="none" stroke="#FFFDF8" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
143
|
-
</g>
|
|
144
|
-
|
|
145
|
-
<line x1="70" y1="875" x2="930" y2="875" class="gold-stroke thin"/>
|
|
146
|
-
<circle cx="500" cy="875" r="6" class="gold"/>
|
|
147
|
-
|
|
148
|
-
<!-- panels -->
|
|
149
|
-
<g id="panel1">
|
|
150
|
-
<rect x="45" y="925" width="280" height="360" rx="28" class="panel" stroke="#C8A100"/>
|
|
151
|
-
<circle cx="185" cy="925" r="38" fill="#FFFDF8" stroke="#C8A100" stroke-width="3"/>
|
|
152
|
-
<text x="185" y="936" text-anchor="middle" class="code wine" style="font-size:27px">:-</text>
|
|
153
|
-
<text x="185" y="990" text-anchor="middle" class="paneltitle wine" style="font-size:20px">1. ISO PROLOG RULES</text>
|
|
154
|
-
|
|
155
|
-
<text x="75" y="1050" class="codesm">path(X, Y) :-</text>
|
|
156
|
-
<text x="100" y="1080" class="codesm">edge(X, Y).</text>
|
|
157
|
-
|
|
158
|
-
<text x="75" y="1130" class="codesm">path(X, Y) :-</text>
|
|
159
|
-
<text x="100" y="1160" class="codesm">edge(X, Z),</text>
|
|
160
|
-
<text x="100" y="1190" class="codesm">path(Z, Y).</text>
|
|
161
|
-
|
|
162
|
-
<line x1="75" y1="1220" x2="295" y2="1220" class="wine-stroke thin"/>
|
|
163
|
-
<text x="185" y="1250" text-anchor="middle" class="smallserif wine" style="font-size:16px">clauses · unification · recursion</text>
|
|
164
|
-
</g>
|
|
165
|
-
|
|
166
|
-
<g id="panel2">
|
|
167
|
-
<rect x="340" y="925" width="320" height="360" rx="28" class="panel" stroke="#008EAA"/>
|
|
168
|
-
<circle cx="500" cy="925" r="38" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
169
|
-
<circle cx="484" cy="925" r="6" class="rdfnode"/>
|
|
170
|
-
<circle cx="516" cy="908" r="6" class="rdfnode"/>
|
|
171
|
-
<circle cx="520" cy="942" r="6" class="rdfnode"/>
|
|
172
|
-
<path d="M490 922 L510 911 M490 928 L514 939 M516 914 L519 936" class="green-stroke thin round"/>
|
|
173
|
-
<text x="500" y="990" text-anchor="middle" class="paneltitle green">2. RDF 1.2 DATASET</text>
|
|
174
|
-
|
|
175
|
-
<circle cx="405" cy="1060" r="18" class="rdfnode"/>
|
|
176
|
-
<circle cx="500" cy="1060" r="18" class="rdfnode"/>
|
|
177
|
-
<circle cx="595" cy="1060" r="18" class="rdfnode"/>
|
|
178
|
-
<line x1="423" y1="1060" x2="482" y2="1060" class="green-stroke mid round"/>
|
|
179
|
-
<line x1="518" y1="1060" x2="577" y2="1060" class="green-stroke mid round"/>
|
|
180
|
-
|
|
181
|
-
<rect x="375" y="1110" width="250" height="38" rx="8" fill="#EAF8FA" stroke="#008EAA" stroke-width="2"/>
|
|
182
|
-
<text x="500" y="1135" text-anchor="middle" class="codesm">ex:alice ex:knows ex:bob</text>
|
|
183
|
-
|
|
184
|
-
<rect x="375" y="1160" width="250" height="54" rx="8" fill="#EAF8FA" stroke="#008EAA" stroke-width="2"/>
|
|
185
|
-
<text x="500" y="1183" text-anchor="middle" class="codesm" style="font-size:13px">named graphs · literals</text>
|
|
186
|
-
<text x="500" y="1202" text-anchor="middle" class="codesm" style="font-size:13px">triple terms</text>
|
|
187
|
-
|
|
188
|
-
<text x="500" y="1250" text-anchor="middle" class="smallserif green" style="font-size:16px">linked data remains RDF</text>
|
|
189
|
-
</g>
|
|
190
|
-
|
|
191
|
-
<g id="panel3">
|
|
192
|
-
<rect x="675" y="925" width="280" height="360" rx="28" class="panel" stroke="#17324D"/>
|
|
193
|
-
<circle cx="815" cy="925" r="38" fill="#FFFDF8" stroke="#17324D" stroke-width="3"/>
|
|
194
|
-
<rect x="807" y="903" width="16" height="12" rx="2" fill="#FFFDF8" stroke="#17324D" stroke-width="2"/>
|
|
195
|
-
<rect x="790" y="934" width="16" height="12" rx="2" fill="#FFFDF8" stroke="#17324D" stroke-width="2"/>
|
|
196
|
-
<rect x="824" y="934" width="16" height="12" rx="2" fill="#FFFDF8" stroke="#17324D" stroke-width="2"/>
|
|
197
|
-
<path d="M815 915 V926 M798 926 H832 M798 926 V934 M832 926 V934" class="navy-stroke thin round"/>
|
|
198
|
-
<text x="815" y="990" text-anchor="middle" class="paneltitle navy">3. ANSWERS & PROOFS</text>
|
|
199
|
-
|
|
200
|
-
<rect x="758" y="1038" width="114" height="38" rx="8" class="softbox"/>
|
|
201
|
-
<text x="815" y="1062" text-anchor="middle" class="codesm">path(a, X)</text>
|
|
202
|
-
|
|
203
|
-
<rect x="700" y="1122" width="104" height="38" rx="8" class="softbox"/>
|
|
204
|
-
<rect x="826" y="1122" width="104" height="38" rx="8" class="softbox"/>
|
|
205
|
-
<text x="752" y="1146" text-anchor="middle" class="codesm">edge(a,b)</text>
|
|
206
|
-
<text x="878" y="1146" text-anchor="middle" class="codesm">path(b,X)</text>
|
|
207
|
-
|
|
208
|
-
<rect x="824" y="1206" width="106" height="38" rx="8" class="softbox"/>
|
|
209
|
-
<text x="877" y="1230" text-anchor="middle" class="codesm">edge(b,c)</text>
|
|
210
|
-
|
|
211
|
-
<path d="M815 1076 L752 1122 M815 1076 L878 1122 M878 1160 L877 1206" class="navy-stroke mid round"/>
|
|
212
|
-
<text x="877" y="1268" text-anchor="middle" class="codesm" style="font-size:22px">…</text>
|
|
213
|
-
</g>
|
|
214
|
-
|
|
215
|
-
<!-- footer -->
|
|
216
|
-
<g id="footer">
|
|
217
|
-
<line x1="145" y1="1350" x2="285" y2="1350" class="gold-stroke thin round"/>
|
|
218
|
-
<circle cx="310" cy="1350" r="4" class="gold"/>
|
|
219
|
-
<text x="500" y="1360" text-anchor="middle" class="subtitle" style="font-size:20px; font-style:italic;">ISO Prolog rules over RDF linked data</text>
|
|
220
|
-
<circle cx="690" cy="1350" r="4" class="gold"/>
|
|
221
|
-
<line x1="715" y1="1350" x2="855" y2="1350" class="gold-stroke thin round"/>
|
|
222
|
-
<path d="M500 1390 L510 1400 L500 1410 L490 1400 Z" class="green"/>
|
|
223
|
-
</g>
|
|
56
|
+
<rect width="1000" height="1450" fill="#fffdf8"/>
|
|
57
|
+
|
|
58
|
+
<!-- Native SVG rendering of the original EYE rainbow mark. -->
|
|
59
|
+
<svg x="340" y="180" width="320" height="320" viewBox="0 0 68 68"
|
|
60
|
+
role="img" aria-label="EYE logo">
|
|
61
|
+
<g clip-path="url(#eye-orb-clip)">
|
|
62
|
+
<rect width="68" height="68" fill="url(#eye-spectrum)"/>
|
|
63
|
+
<ellipse cx="34" cy="35" rx="30" ry="14.5"
|
|
64
|
+
transform="rotate(11 34 35)" fill="url(#eye-ring)"/>
|
|
65
|
+
<ellipse cx="34" cy="35" rx="22.5" ry="9.2"
|
|
66
|
+
transform="rotate(11 34 35)" fill="url(#eye-center)"/>
|
|
67
|
+
</g>
|
|
68
|
+
</svg>
|
|
69
|
+
|
|
70
|
+
<text x="500" y="625" text-anchor="middle" class="title-small">THE ART OF</text>
|
|
71
|
+
<text x="500" y="755" text-anchor="middle" class="title-main">EyeProlog</text>
|
|
72
|
+
<text x="500" y="830" text-anchor="middle" class="subtitle">ISO Prolog with inspectable proofs</text>
|
|
73
|
+
<text x="500" y="1260" text-anchor="middle" class="author">JOS DE ROO</text>
|
|
224
74
|
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
% Basic Monadic Benchmark port from EYE reasoning/basic-monadic.
|
|
2
2
|
%
|
|
3
|
-
% This example
|
|
3
|
+
% This example adapts ten small monadic reasoning cases.
|
|
4
4
|
% from EYE and the EYE selected-goal shape:
|
|
5
5
|
% D0 R D1, D1 R D2, ..., D9 R D0 -> R cycle (D0 ... D9 D0).
|
|
6
6
|
%
|
package/examples/book/README.md
CHANGED
|
@@ -85,15 +85,6 @@ npm run generate
|
|
|
85
85
|
|
|
86
86
|
- [01-heating.pl](chapter-14/01-heating.pl)
|
|
87
87
|
|
|
88
|
-
## Chapter 15: RDF 1.2 as the interoperable data boundary
|
|
89
|
-
|
|
90
|
-
- [01-rdf.pl](chapter-15/01-rdf.pl)
|
|
91
|
-
|
|
92
|
-
## Chapter 16: Embedding EyeProlog
|
|
93
|
-
|
|
94
|
-
- [01-socket.pl](chapter-16/01-socket.pl) — Sockets: naming the knowledge boundary
|
|
95
|
-
- [02-socket-2.pl](chapter-16/02-socket-2.pl)
|
|
96
|
-
|
|
97
88
|
## Chapter 17: Logic and control
|
|
98
89
|
|
|
99
90
|
- [01-path.pl](chapter-17/01-path.pl)
|
package/index.d.ts
CHANGED
|
@@ -220,6 +220,8 @@ declare const eyeprolog: {
|
|
|
220
220
|
Solver: typeof Solver;
|
|
221
221
|
BuiltinRegistry: typeof BuiltinRegistry;
|
|
222
222
|
PrologError: typeof PrologError;
|
|
223
|
+
HaltSignal: typeof HaltSignal;
|
|
224
|
+
StreamManager: typeof StreamManager;
|
|
223
225
|
variable: typeof variable;
|
|
224
226
|
atom: typeof atom;
|
|
225
227
|
stringTerm: typeof stringTerm;
|
|
@@ -252,6 +254,7 @@ declare const eyeprolog: {
|
|
|
252
254
|
compareNumberText: typeof compareNumberText;
|
|
253
255
|
makeProgram: typeof makeProgram;
|
|
254
256
|
parseClauses: typeof parseClauses;
|
|
257
|
+
parseGoalText: typeof parseGoalText;
|
|
255
258
|
parseProgramText: typeof parseProgramText;
|
|
256
259
|
createDefaultRegistry: typeof createDefaultRegistry;
|
|
257
260
|
createEyePrologRegistry: typeof createEyePrologRegistry;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "1.0.0",
|
|
7
7
|
"description": "EyeProlog turns facts and rules into answers and proofs.",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./index.js",
|
|
@@ -54,8 +54,5 @@
|
|
|
54
54
|
"test:playground": "node test/run-playground.mjs",
|
|
55
55
|
"preversion": "npm test && node test/run-conformance-report.mjs conformance-report.md",
|
|
56
56
|
"postversion": "git push origin HEAD --follow-tags"
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"rdf-parse": "^5.0.0"
|
|
60
57
|
}
|
|
61
58
|
}
|
package/playground.html
CHANGED
|
@@ -494,7 +494,6 @@
|
|
|
494
494
|
"dining-philosophers",
|
|
495
495
|
"dog",
|
|
496
496
|
"donald-gerald-robert",
|
|
497
|
-
"dpv-odrl-purpose-mapping",
|
|
498
497
|
"drone-corridor-planner",
|
|
499
498
|
"easter-computus",
|
|
500
499
|
"electrical-rc-filter",
|
|
@@ -573,11 +572,6 @@
|
|
|
573
572
|
"newton-raphson",
|
|
574
573
|
"nixon-diamond",
|
|
575
574
|
"observability-log-correlation",
|
|
576
|
-
"odrl-dpv-fpv-trust-flow",
|
|
577
|
-
"odrl-dpv-healthcare-risk-ranked",
|
|
578
|
-
"odrl-dpv-risk-ranked",
|
|
579
|
-
"odrl-policy-advanced-from-turtle",
|
|
580
|
-
"odrl-policy-from-turtle",
|
|
581
575
|
"orbital-transfer-design",
|
|
582
576
|
"partial-evaluator",
|
|
583
577
|
"path-discovery",
|
|
@@ -594,14 +588,6 @@
|
|
|
594
588
|
"quadratic-formula",
|
|
595
589
|
"quine-mccluskey",
|
|
596
590
|
"radioactive-decay",
|
|
597
|
-
"rdf12-annotation",
|
|
598
|
-
"rdf12-annotated-claims",
|
|
599
|
-
"rdf12-directional-language",
|
|
600
|
-
"rdf12-nested-triple-term",
|
|
601
|
-
"rdf12-trig-graph-join",
|
|
602
|
-
"rdf12-trig-named-graph",
|
|
603
|
-
"rdf12-trig-triple-term",
|
|
604
|
-
"rdf12-triple-term",
|
|
605
591
|
"register-allocation",
|
|
606
592
|
"relational-cube-lookup",
|
|
607
593
|
"reusable-builtins",
|
|
@@ -614,8 +600,6 @@
|
|
|
614
600
|
"shoelace-polygon-area",
|
|
615
601
|
"sieve",
|
|
616
602
|
"skolem-functions",
|
|
617
|
-
"socket-age",
|
|
618
|
-
"socket-family",
|
|
619
603
|
"socrates",
|
|
620
604
|
"spacecraft-battery-diagnosis",
|
|
621
605
|
"stable-marriage",
|
|
@@ -34,4 +34,4 @@ use Unicode scalar values.
|
|
|
34
34
|
|
|
35
35
|
This is an executable conformance matrix, not a certification issued by an
|
|
36
36
|
independent standards body. Release gating runs the ISO cases together with the
|
|
37
|
-
full regression, API, documentation, example,
|
|
37
|
+
full regression, API, documentation, example, and browser suites.
|
|
@@ -45,8 +45,8 @@ Case names may be nested in category directories such as `arithmetic/`, `strings
|
|
|
45
45
|
|
|
46
46
|
## Running the suite
|
|
47
47
|
|
|
48
|
-
Run all tests, including conformance, regression, documentation sync, API,
|
|
49
|
-
|
|
48
|
+
Run all tests, including conformance, regression, documentation sync, API,
|
|
49
|
+
examples, and book examples:
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
52
|
npm test
|
|
@@ -95,7 +95,7 @@ are recorded in [THIRD_PARTY.md](THIRD_PARTY.md).
|
|
|
95
95
|
The corpus has 304 cases in `iso/` and 710 file-based conformance cases in
|
|
96
96
|
total. The generated `conformance-report.md` is the authoritative source for
|
|
97
97
|
current category totals. Together with regression, documentation-sync, API,
|
|
98
|
-
|
|
98
|
+
example, and book-example checks, `npm test` is the release gate.
|
|
99
99
|
|
|
100
100
|
## Updating expected output
|
|
101
101
|
|
package/test/run-all.mjs
CHANGED
|
@@ -8,7 +8,6 @@ import { runRegression } from './run-regression.mjs';
|
|
|
8
8
|
import { runPlayground } from './run-playground.mjs';
|
|
9
9
|
import { runExamples } from './run-examples.mjs';
|
|
10
10
|
import { runBookExamples } from './run-book-examples.mjs';
|
|
11
|
-
import { runRdfTools } from './run-rdf-tools.mjs';
|
|
12
11
|
|
|
13
12
|
const reporter = new TestReporter();
|
|
14
13
|
|
|
@@ -16,7 +15,6 @@ try {
|
|
|
16
15
|
runConformance(reporter);
|
|
17
16
|
runRegression(reporter);
|
|
18
17
|
await runPlayground(reporter);
|
|
19
|
-
await runRdfTools(reporter);
|
|
20
18
|
runExamples(reporter);
|
|
21
19
|
runBookExamples(reporter);
|
|
22
20
|
reporter.totalLine();
|
package/test/run-examples.mjs
CHANGED
|
@@ -42,8 +42,6 @@ export const proofExamples = [
|
|
|
42
42
|
'list-collection.pl',
|
|
43
43
|
'proof-contrapositive.pl',
|
|
44
44
|
'reusable-builtins.pl',
|
|
45
|
-
'socket-age.pl',
|
|
46
|
-
'socket-family.pl',
|
|
47
45
|
'socrates.pl',
|
|
48
46
|
'spacecraft-battery-diagnosis.pl',
|
|
49
47
|
'term-tools.pl',
|
|
@@ -55,7 +53,6 @@ export const proofExamples = [
|
|
|
55
53
|
'clinical-trial-screening.pl',
|
|
56
54
|
'composition-of-injective-functions-is-injective.pl',
|
|
57
55
|
'diamond-property.pl',
|
|
58
|
-
'dpv-odrl-purpose-mapping.pl',
|
|
59
56
|
'epidemic-policy.pl',
|
|
60
57
|
'equivalence-classes-overlap-implies-same-class.pl',
|
|
61
58
|
'expression-eval.pl',
|
|
@@ -71,16 +68,8 @@ export const proofExamples = [
|
|
|
71
68
|
'security-incident-correlation.pl',
|
|
72
69
|
'symbolic-derivative.pl',
|
|
73
70
|
'trust-flow-provenance-threshold.pl',
|
|
74
|
-
'rdf12-annotation.pl',
|
|
75
|
-
'rdf12-triple-term.pl',
|
|
76
|
-
'rdf12-nested-triple-term.pl',
|
|
77
|
-
'rdf12-trig-triple-term.pl',
|
|
78
71
|
'weighted-interval-scheduling.pl',
|
|
79
|
-
'rdf12-trig-graph-join.pl',
|
|
80
|
-
'rdf12-directional-language.pl',
|
|
81
|
-
'odrl-policy-from-turtle.pl',
|
|
82
72
|
'integrity-check.pl',
|
|
83
|
-
'rdf12-trig-named-graph.pl',
|
|
84
73
|
'prime-range.pl',
|
|
85
74
|
'd3-group.pl',
|
|
86
75
|
'iso-operators.pl',
|
package/test/run-regression.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import os from 'node:os';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { spawnSync } from 'node:child_process';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import publicDefaultApi from '../index.js';
|
|
11
12
|
import * as publicApi from '../src/index.js';
|
|
12
13
|
import {
|
|
13
14
|
run as runEyeProlog,
|
|
@@ -700,6 +701,10 @@ function apiCases() {
|
|
|
700
701
|
name: 'public type declarations match runtime exports',
|
|
701
702
|
run: () => assertArrayEqual(declaredValueExportNames(), runtimeExportNames(), 'public value exports'),
|
|
702
703
|
},
|
|
704
|
+
{
|
|
705
|
+
name: 'default export type declarations match runtime exports',
|
|
706
|
+
run: () => assertArrayEqual(declaredDefaultExportNames(), runtimeDefaultExportNames(), 'default export values'),
|
|
707
|
+
},
|
|
703
708
|
{
|
|
704
709
|
name: 'run queries through public API without proof by default',
|
|
705
710
|
run: () => {
|
|
@@ -1888,6 +1893,10 @@ function runtimeExportNames() {
|
|
|
1888
1893
|
return Object.keys(publicApi).sort();
|
|
1889
1894
|
}
|
|
1890
1895
|
|
|
1896
|
+
function runtimeDefaultExportNames() {
|
|
1897
|
+
return Object.keys(publicDefaultApi).sort();
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1891
1900
|
function declaredValueExportNames() {
|
|
1892
1901
|
const dts = fs.readFileSync(path.join(packageRoot, 'index.d.ts'), 'utf8');
|
|
1893
1902
|
return [...dts.matchAll(/^export\s+(?:declare\s+)?(?:class|function|const)\s+([A-Za-z_][A-Za-z0-9_]*)/gm)]
|
|
@@ -1896,6 +1905,15 @@ function declaredValueExportNames() {
|
|
|
1896
1905
|
.sort();
|
|
1897
1906
|
}
|
|
1898
1907
|
|
|
1908
|
+
function declaredDefaultExportNames() {
|
|
1909
|
+
const dts = fs.readFileSync(path.join(packageRoot, 'index.d.ts'), 'utf8');
|
|
1910
|
+
const declaration = dts.match(/declare const eyeprolog: \{([\s\S]*?)\n\};/);
|
|
1911
|
+
if (declaration == null) throw new Error('default export declaration not found');
|
|
1912
|
+
return [...declaration[1].matchAll(/^\s+([A-Za-z_][A-Za-z0-9_]*): typeof /gm)]
|
|
1913
|
+
.map((match) => match[1])
|
|
1914
|
+
.sort();
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1899
1917
|
function missingDocumentedPackageScripts() {
|
|
1900
1918
|
const docs = documentationFiles();
|
|
1901
1919
|
const missing = [];
|