eyemind 0.7.1 → 0.7.2
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/LOGICAL-ENGLISH.md +16 -1
- package/README.md +29 -25
- package/SPEC.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +7 -11
- package/src/formats.js +11 -11
- package/src/{entailment.js → owl2rl.js} +6 -7
- package/src/version.js +1 -1
package/LOGICAL-ENGLISH.md
CHANGED
|
@@ -173,7 +173,22 @@ derived conclusions, following LS's default; given facts alone are not printed.
|
|
|
173
173
|
`It is impossible that` compiles to an LS contradiction with the stated body.
|
|
174
174
|
`Contradiction.` is an unconditional contradiction, also used to serialize a
|
|
175
175
|
run's `'false'` conclusion. Contradictions halt reasoning with exit code 65;
|
|
176
|
-
they do not produce the continuing RDF conflict reports of `--
|
|
176
|
+
they do not produce the continuing RDF conflict reports of `--owl2rl`.
|
|
177
|
+
|
|
178
|
+
## Examples combining features
|
|
179
|
+
|
|
180
|
+
These programs use the grammar above without additional syntax:
|
|
181
|
+
|
|
182
|
+
| Example | What it demonstrates |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| [Shortest paths](https://eyereasoner.github.io/eyemind/examples/deck/shortest-path-le) | Bounded recursive histories, exact costs and minimum selection by absence, retaining ties. |
|
|
185
|
+
| [River crossing](https://eyereasoner.github.io/eyemind/examples/deck/river-crossing-le) | Compound states, repeated-variable matching, safety constraints and complete plans within a bound. |
|
|
186
|
+
| [Pell equations](https://eyereasoner.github.io/eyemind/examples/deck/pell-equation-le) | Recursive arithmetic beyond binary64 integer precision and exact polynomial checks. |
|
|
187
|
+
| [Course certificates](https://eyereasoner.github.io/eyemind/examples/deck/course-certificates-le) | Recursive requirements, absence of a counterexample, shared existential witnesses and witnesses containing earlier witnesses. |
|
|
188
|
+
| [Symbolic differentiation](https://eyereasoner.github.io/eyemind/examples/deck/symbolic-derivative-le) | Structural recursion over expression trees, constructed derivatives and evaluation at separate points. |
|
|
189
|
+
|
|
190
|
+
Their decks state the modeled assumptions and what the checked proofs establish.
|
|
191
|
+
Bounds and finite expression domains are explicit in the programs.
|
|
177
192
|
|
|
178
193
|
## ODRL snapshots
|
|
179
194
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ eyemind is a dependency-free reasoner for **Logic Script (LS)**, a rule language
|
|
|
7
7
|
|
|
8
8
|
[Playground](https://eyereasoner.github.io/eyemind/playground/) · [Specification](https://eyereasoner.github.io/eyemind/SPEC) · [Conformance](https://eyereasoner.github.io/eyemind/conformance/) · [Examples](https://eyereasoner.github.io/eyemind/examples/)
|
|
9
9
|
|
|
10
|
-
The playground runs programs in your browser; the specification defines the language, its canonical text, the proof format and how a proof is checked. The examples are
|
|
10
|
+
The playground runs programs in your browser; the specification defines the language, its canonical text, the proof format and how a proof is checked. The examples are 147 runnable programs, each with a card deck and saved conclusions, proofs and check reports. The conformance suite has 1246 cases that test language and proof behavior through a command adapter, together with implementation interface checks; run it [in your browser](https://eyereasoner.github.io/eyemind/playground/conformance).
|
|
11
11
|
|
|
12
12
|
## Contents
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ The playground runs programs in your browser; the specification defines the lang
|
|
|
23
23
|
- [Notation3](#notation3)
|
|
24
24
|
- [RDF Messages](#rdf-messages)
|
|
25
25
|
- [SPARQL 1.2 RL](#sparql-12-rl)
|
|
26
|
-
- [
|
|
26
|
+
- [OWL 2 RL](#owl-2-rl)
|
|
27
27
|
- [ODRL snapshots](#odrl-snapshots)
|
|
28
28
|
- [How eyemind reasons](#how-eyemind-reasons)
|
|
29
29
|
- [Proofs, and what checking one means](#proofs-and-what-checking-one-means)
|
|
@@ -219,6 +219,12 @@ The playground loads LE examples and downloads conclusions as `output.le`.
|
|
|
219
219
|
Try [Socrates](https://eyereasoner.github.io/eyemind/examples/deck/socrates-le),
|
|
220
220
|
[exact squares](https://eyereasoner.github.io/eyemind/examples/deck/squares-le)
|
|
221
221
|
and [record creation](https://eyereasoner.github.io/eyemind/examples/deck/records-le).
|
|
222
|
+
For examples combining more features, try
|
|
223
|
+
[shortest paths](https://eyereasoner.github.io/eyemind/examples/deck/shortest-path-le),
|
|
224
|
+
[river-crossing plans](https://eyereasoner.github.io/eyemind/examples/deck/river-crossing-le),
|
|
225
|
+
[large Pell solutions](https://eyereasoner.github.io/eyemind/examples/deck/pell-equation-le),
|
|
226
|
+
[symbolic differentiation](https://eyereasoner.github.io/eyemind/examples/deck/symbolic-derivative-le),
|
|
227
|
+
or [course certificates](https://eyereasoner.github.io/eyemind/examples/deck/course-certificates-le).
|
|
222
228
|
The [handicap-card LE snapshot](https://eyereasoner.github.io/eyemind/examples/deck/handicap-card-le)
|
|
223
229
|
explicitly selects the shared ODRL evaluator with `Use ODRL snapshot logic with
|
|
224
230
|
namespace ...`. It expresses the Turtle example's policies and SOTW as English
|
|
@@ -432,20 +438,20 @@ SRL programs for deployment dependencies, route distances, ancestry, inventory,
|
|
|
432
438
|
invoices, provenance and Unicode strings. Each has saved Turtle output, a
|
|
433
439
|
proof, a check report and a deck, and runs in the playground.
|
|
434
440
|
|
|
435
|
-
###
|
|
441
|
+
### OWL 2 RL
|
|
436
442
|
|
|
437
|
-
`--
|
|
443
|
+
`--owl2rl` adds inference rules, including RDFS, to RDF inputs. The files still
|
|
438
444
|
use their usual RDF extensions; standard input is Turtle. A graph's use of
|
|
439
|
-
RDFS or OWL vocabulary alone does not enable
|
|
440
|
-
has
|
|
445
|
+
RDFS or OWL vocabulary alone does not enable the extension. The playground
|
|
446
|
+
has the same switch and preserves it in saved sessions and shared links.
|
|
441
447
|
|
|
442
448
|
```sh
|
|
443
|
-
eyemind --
|
|
444
|
-
eyemind --
|
|
445
|
-
eyemind --
|
|
449
|
+
eyemind --owl2rl examples/people-owl2rl.ttl
|
|
450
|
+
eyemind --owl2rl examples/family-owl2rl.ttl > /tmp/family-report.ttl
|
|
451
|
+
eyemind --owl2rl --program examples/family-owl2rl.ttl > /tmp/family.js
|
|
446
452
|
eyemind --to turtle /tmp/family.js
|
|
447
|
-
eyemind --
|
|
448
|
-
eyemind --
|
|
453
|
+
eyemind --owl2rl --proof examples/family-owl2rl.ttl > /tmp/family-proof.js
|
|
454
|
+
eyemind --owl2rl --check-proof /tmp/family-proof.js examples/family-owl2rl.ttl
|
|
449
455
|
```
|
|
450
456
|
|
|
451
457
|
The generated `.js` contains the data, inference rules and reporting rules;
|
|
@@ -456,10 +462,10 @@ need `--to trig` or `--to n-quads` to retain their graph names.
|
|
|
456
462
|
|
|
457
463
|
The implemented rules are:
|
|
458
464
|
|
|
459
|
-
|
|
|
465
|
+
| Rule family | Coverage |
|
|
460
466
|
| --- | --- |
|
|
461
|
-
|
|
|
462
|
-
|
|
|
467
|
+
| RDFS | Class and property hierarchy transitivity, type and property propagation, domain and range inference and inheritance, resource/class/property typing, reflexive hierarchies, container membership and datatype-to-literal subclassing. |
|
|
468
|
+
| OWL | Equality and substitution; equivalent classes and properties; inverse, symmetric, transitive, functional and inverse-functional properties; property chains and keys; intersections, unions, enumerations, value restrictions and maximum cardinalities 0 and 1; class/property disjointness, AllDifferent, negative property assertions and schema propagation. |
|
|
463
469
|
|
|
464
470
|
The OWL rules implement the non-datatype rule families of
|
|
465
471
|
[OWL 2 RL/RDF tables 4–7 and 9](https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs),
|
|
@@ -468,9 +474,8 @@ They operate on the terms present in each graph. RDFS axiomatic triples,
|
|
|
468
474
|
datatype value-space reasoning (OWL table 8), ontology imports and OWL
|
|
469
475
|
constructs outside these rule families are not implemented. Literal equality
|
|
470
476
|
uses the RDF-to-LS representation, without general datatype normalization.
|
|
471
|
-
|
|
472
|
-
for arbitrary RDFS or OWL ontologies.
|
|
473
|
-
enabling both adds the rules once. They take RDF inputs and cannot be combined
|
|
477
|
+
This switch does not validate profile membership or certify completeness
|
|
478
|
+
for arbitrary RDFS or OWL ontologies. It takes RDF inputs and cannot be combined
|
|
474
479
|
with `--odrl` or `--stream-messages`.
|
|
475
480
|
|
|
476
481
|
OWL contradictions appear as RDF records of type `ent:Conflict`, where
|
|
@@ -483,8 +488,8 @@ conflict set only means these rules detected none; it is not a full consistency
|
|
|
483
488
|
guarantee. RDFS domain and range infer types rather than checking required
|
|
484
489
|
fields, and missing facts alone do not establish a conflict.
|
|
485
490
|
|
|
486
|
-
Try the [people directory](https://eyereasoner.github.io/eyemind/examples/deck/people-
|
|
487
|
-
and [family ontology](https://eyereasoner.github.io/eyemind/examples/deck/family-
|
|
491
|
+
Try the [people directory](https://eyereasoner.github.io/eyemind/examples/deck/people-owl2rl)
|
|
492
|
+
and [family ontology](https://eyereasoner.github.io/eyemind/examples/deck/family-owl2rl).
|
|
488
493
|
|
|
489
494
|
### ODRL snapshots
|
|
490
495
|
|
|
@@ -724,13 +729,12 @@ eyemind [OPTION ...] [FILE ...]
|
|
|
724
729
|
| `--unused` | List the clauses that make no difference to the conclusions. |
|
|
725
730
|
| `--stream-messages` | Read an RDF Message Log and run the rules independently per message; Node reads files, stdin and HTTP(S) incrementally. |
|
|
726
731
|
| `--stats` | Print reasoning statistics as JSON to standard error. |
|
|
727
|
-
| `--max-depth N`, `--max-iterations N`, `--max-inferences N` | Bound backward depth (1000000), forward rounds per stratum (1000) and goals started (1000000); a compiled N3, SRL, ODRL, RDFS or OWL
|
|
728
|
-
| `--to FORMAT` | Write the conclusions as `turtle`, `trig`, `n-triples`, `n-quads`, `n3`, `le` or `eyemind`; by default LE for LE, N3 for N3, Turtle for SRL, ODRL, RDFS and OWL
|
|
732
|
+
| `--max-depth N`, `--max-iterations N`, `--max-inferences N` | Bound backward depth (1000000), forward rounds per stratum (1000) and goals started (1000000); a compiled N3, SRL, ODRL, RDFS or OWL 2 RL program has 1000000, 100000 and 1000000000. |
|
|
733
|
+
| `--to FORMAT` | Write the conclusions as `turtle`, `trig`, `n-triples`, `n-quads`, `n3`, `le` or `eyemind`; by default LE for LE, N3 for N3, Turtle for SRL, ODRL, RDFS and OWL 2 RL, eyemind otherwise. |
|
|
729
734
|
| `--all` | With RDF or N3 output, write the given data too. |
|
|
730
735
|
| `--program` | Print the program the inputs compile to. |
|
|
731
736
|
| `--odrl` | Add the ODRL snapshot profile's validation and evaluation LS to one Turtle input. |
|
|
732
|
-
| `--
|
|
733
|
-
| `--owl-rl` | Add the documented OWL-RL inference rules and RDF conflict reports to RDF inputs; includes `--rdfs`. |
|
|
737
|
+
| `--owl2rl` | Add the documented OWL 2 RL inference rules, including RDFS, and RDF conflict reports to RDF inputs. |
|
|
734
738
|
| `--base IRI` | Resolve relative IRIs of the inputs against `IRI` instead of each file's location. |
|
|
735
739
|
| `-v`, `--version`, `-h`, `--help` | Print the version or the usage. |
|
|
736
740
|
|
|
@@ -740,7 +744,7 @@ each goal as a data document, with an array denoting conjunction. With
|
|
|
740
744
|
`--check-proof`, supply the original goals the proof answers.
|
|
741
745
|
An option that takes a value requires it immediately afterward; another
|
|
742
746
|
option, including a short alias such as `-v`, is reported as a missing value.
|
|
743
|
-
With `--goal`, answers default to eyemind terms even for LE, N3, SRL, ODRL, RDFS and OWL
|
|
747
|
+
With `--goal`, answers default to eyemind terms even for LE, N3, SRL, ODRL, RDFS and OWL 2 RL inputs;
|
|
744
748
|
use `--to` to request another output format.
|
|
745
749
|
|
|
746
750
|
With `--prove-and-check`, reasoning bounds and `--stats` apply to proof
|
|
@@ -769,7 +773,7 @@ They are outside the language and proof specification.
|
|
|
769
773
|
|
|
770
774
|
The JavaScript implementation defaults to a depth limit of 1000000, an
|
|
771
775
|
inference limit of 1000000 and a limit of 1000 forward rounds per stratum.
|
|
772
|
-
Compiled N3, SRL, ODRL
|
|
776
|
+
Compiled N3, SRL, ODRL and OWL 2 RL programs use 1000000, 1000000000 and 100000 respectively.
|
|
773
777
|
Each supplied bound must be a positive integer no greater than
|
|
774
778
|
9007199254740991.
|
|
775
779
|
|
package/SPEC.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyemind",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "A dependency-free Logic Script (LS) reasoner with forward and backward reasoning, checkable proofs, and RDF 1.2, Notation3 (N3) and SPARQL 1.2 RL (SRL) interoperability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/cli.js
CHANGED
|
@@ -25,12 +25,11 @@ all compiled to LS.
|
|
|
25
25
|
--max-inferences N Bound reasoning work (default 1000000)
|
|
26
26
|
--to FORMAT Write the conclusions as turtle, trig, n-triples,
|
|
27
27
|
n-quads, n3, le or eyemind (default: le for LE, n3 for N3, turtle
|
|
28
|
-
for SRL, ODRL
|
|
28
|
+
for SRL, ODRL or OWL 2 RL, eyemind otherwise or with --goal)
|
|
29
29
|
--all With RDF or N3 output, write the given data too
|
|
30
30
|
--program Print the program the inputs compile to
|
|
31
31
|
--odrl Add ODRL validation and evaluation to one Turtle snapshot
|
|
32
|
-
--
|
|
33
|
-
--owl-rl Add OWL-RL inference and conflict rules to RDF inputs
|
|
32
|
+
--owl2rl Add OWL 2 RL inference, including RDFS, and conflict rules
|
|
34
33
|
--base IRI Resolve relative IRIs of the inputs against IRI
|
|
35
34
|
--stream-messages Run the rules independently for each RDF Message
|
|
36
35
|
-v, --version Print the version
|
|
@@ -70,8 +69,7 @@ export function main(argv, io) {
|
|
|
70
69
|
let base = null;
|
|
71
70
|
let streamMessages = false;
|
|
72
71
|
let odrl = false;
|
|
73
|
-
let
|
|
74
|
-
let owlRl = false;
|
|
72
|
+
let owl2rl = false;
|
|
75
73
|
const filePositions = new Set();
|
|
76
74
|
for (let i = 0; i < argv.length; i++) {
|
|
77
75
|
const arg = ALIASES.get(argv[i]) ?? argv[i];
|
|
@@ -99,10 +97,8 @@ export function main(argv, io) {
|
|
|
99
97
|
printProgram = true;
|
|
100
98
|
} else if (arg === '--odrl') {
|
|
101
99
|
odrl = true;
|
|
102
|
-
} else if (arg === '--
|
|
103
|
-
|
|
104
|
-
} else if (arg === '--owl-rl') {
|
|
105
|
-
owlRl = true;
|
|
100
|
+
} else if (arg === '--owl2rl') {
|
|
101
|
+
owl2rl = true;
|
|
106
102
|
} else if (arg === '--stream-messages') {
|
|
107
103
|
streamMessages = true;
|
|
108
104
|
} else if (arg === '--check-proof' || arg === '--goal' || arg === '--to' || arg === '--base' || Object.hasOwn(LIMITS, arg)) {
|
|
@@ -151,7 +147,7 @@ export function main(argv, io) {
|
|
|
151
147
|
if (files.filter((file) => file === '-').length > 1) throw new UsageError('stdin can only be read once');
|
|
152
148
|
if (streamMessages) {
|
|
153
149
|
if (odrl) throw new UsageError('--odrl cannot be combined with --stream-messages');
|
|
154
|
-
if (
|
|
150
|
+
if (owl2rl) throw new UsageError('--owl2rl cannot be combined with --stream-messages');
|
|
155
151
|
if (proofFile !== null || options.proof || proveAndCheck || printProgram || unused) {
|
|
156
152
|
throw new UsageError('--stream-messages cannot be combined with --proof, --check-proof, --prove-and-check, --program or --unused; replay the whole log to prove its conclusions');
|
|
157
153
|
}
|
|
@@ -192,7 +188,7 @@ export function main(argv, io) {
|
|
|
192
188
|
}
|
|
193
189
|
const document = proofFile === null ? null : readSource(proofFile, io);
|
|
194
190
|
const loaded = loadInputs(files.map((file) => [readSource(file, io), file === '-' ? '<stdin>' : file]), io,
|
|
195
|
-
{ base, messageInputs: io.messageInputs, odrl,
|
|
191
|
+
{ base, messageInputs: io.messageInputs, odrl, owl2rl,
|
|
196
192
|
srlContext: document !== null && files.some((file) => inputKind(file) === 'srl') ? srlContextFromProof(document) : null });
|
|
197
193
|
const program = loaded.program;
|
|
198
194
|
if (printProgram) {
|
package/src/formats.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
//
|
|
15
15
|
// The odrl option adds the snapshot profile's validation and evaluation LS
|
|
16
16
|
// to one Turtle input. Its vocabulary alone never enables the evaluator.
|
|
17
|
-
//
|
|
17
|
+
// owl2rl adds OWL 2 RL rules, including RDFS, to RDF inputs.
|
|
18
18
|
//
|
|
19
19
|
// The compiled program is ordinary LS: proofs, checking and --unused
|
|
20
20
|
// apply to it. SRL execution functions capture a context that a saved proof
|
|
@@ -26,7 +26,7 @@ import { DEFAULT_GRAPH, parseRdf, rdfDocument, rdfFormat, writeRdf } from './rdf
|
|
|
26
26
|
import { resultToN3, compileSources } from './n3.js';
|
|
27
27
|
import { compileSrl, srlAnswers, srlQuads } from './srl.js';
|
|
28
28
|
import { compileOdrl } from './odrl.js';
|
|
29
|
-
import {
|
|
29
|
+
import { compileOwl2rl } from './owl2rl.js';
|
|
30
30
|
import { compileLe, writeLe } from './le.js';
|
|
31
31
|
import { write } from './writer.js';
|
|
32
32
|
import { isRdfMessageLog, parseRdfMessages } from './messages.js';
|
|
@@ -50,7 +50,7 @@ export function rdfMessageFormat(name) {
|
|
|
50
50
|
// Load inputs, given as [text, name] pairs, as one program. io may supply
|
|
51
51
|
// readFile, for the documents N3 and IMPORTS name, and fileIri(name), the
|
|
52
52
|
// base IRI of a file. Returns { kind, program, text, prefixes, compiled }:
|
|
53
|
-
// kind is 'js', 'n3', 'srl', 'le', 'odrl'
|
|
53
|
+
// kind is 'js', 'n3', 'srl', 'le', 'odrl' or 'owl2rl', text the compiled program,
|
|
54
54
|
// and compiled what writing the conclusions needs.
|
|
55
55
|
export function loadInputs(inputs, io = null, options = {}) {
|
|
56
56
|
try {
|
|
@@ -62,7 +62,7 @@ export function loadInputs(inputs, io = null, options = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
function load(inputs, io, { base = null, messageInputs = null, srlContext = null, odrl = false,
|
|
65
|
+
function load(inputs, io, { base = null, messageInputs = null, srlContext = null, odrl = false, owl2rl = false }) {
|
|
66
66
|
const kinds = inputs.map(([text, name]) => messageInputs?.has(name) ||
|
|
67
67
|
(inputKind(name) === 'n3' && isRdfMessageLog(text)) ? 'rdf' : inputKind(name));
|
|
68
68
|
const baseOf = (name) => base ?? io?.fileIri?.(name) ?? null;
|
|
@@ -72,24 +72,24 @@ function load(inputs, io, { base = null, messageInputs = null, srlContext = null
|
|
|
72
72
|
});
|
|
73
73
|
// These rule sets are added only when requested, never from vocabulary.
|
|
74
74
|
if (kinds.includes('le')) {
|
|
75
|
-
if (kinds.some((kind) => kind !== 'le') || odrl ||
|
|
75
|
+
if (kinds.some((kind) => kind !== 'le') || odrl || owl2rl) {
|
|
76
76
|
throw new EyemindError('a Logical English run takes .le files without RDF logic switches or other input formats');
|
|
77
77
|
}
|
|
78
78
|
return compileLe(inputs);
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
if (
|
|
80
|
+
if (owl2rl && odrl) throw new EyemindError('--odrl cannot be combined with --owl2rl');
|
|
81
|
+
if (owl2rl) {
|
|
82
82
|
if (inputs.some(([, name], k) => kinds[k] !== 'rdf' && name !== '<stdin>')) {
|
|
83
|
-
throw new EyemindError('--
|
|
83
|
+
throw new EyemindError('--owl2rl takes RDF inputs; standard input is Turtle');
|
|
84
84
|
}
|
|
85
85
|
const prefixes = {}, quads = [];
|
|
86
86
|
inputs.forEach(([text, name], k) => {
|
|
87
87
|
const parsed = name === '<stdin>' ? parseRdf(text, { format: 'turtle', base: baseOf(name), scope: scopeOf(inputs, name, k) }) : rdf(text, name, k);
|
|
88
|
-
if (parsed.triples) throw new EyemindError('--
|
|
88
|
+
if (parsed.triples) throw new EyemindError('--owl2rl takes RDF graphs, not RDF Message Logs');
|
|
89
89
|
Object.assign(prefixes, parsed.prefixes);
|
|
90
90
|
quads.push(...parsed.quads);
|
|
91
91
|
});
|
|
92
|
-
return
|
|
92
|
+
return compileOwl2rl({ quads, prefixes }, { source: inputs.map(([, n]) => n).join(', ') });
|
|
93
93
|
}
|
|
94
94
|
if (odrl) {
|
|
95
95
|
if (inputs.length !== 1) throw new EyemindError('--odrl takes one Turtle snapshot containing policies, requests and SOTW');
|
|
@@ -155,7 +155,7 @@ function importResolver(io) {
|
|
|
155
155
|
|
|
156
156
|
// Default output: LE for LE, N3 for N3, Turtle for SRL and the RDF logic
|
|
157
157
|
// extensions, and eyemind's own text for an LS program.
|
|
158
|
-
export const defaultFormat = (kind) => ({ le: 'le', n3: 'n3', srl: 'turtle', odrl: 'turtle',
|
|
158
|
+
export const defaultFormat = (kind) => ({ le: 'le', n3: 'n3', srl: 'turtle', odrl: 'turtle', owl2rl: 'turtle' })[kind] ?? 'eyemind';
|
|
159
159
|
|
|
160
160
|
// The conclusions of a run in an output format; null for eyemind's own text.
|
|
161
161
|
// all also writes given RDF or N3 data. Rejects conclusions the format cannot represent.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// OWL 2 RL inference, including RDFS, compiled to standalone Logic Script.
|
|
2
2
|
// Rule names follow W3C OWL 2 RL/RDF tables 4–7 and 9:
|
|
3
3
|
// https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs
|
|
4
4
|
import { loadText } from './lang.js';
|
|
@@ -6,14 +6,13 @@ import { rdfDocument } from './rdf.js';
|
|
|
6
6
|
|
|
7
7
|
export const ENTAILMENT = 'https://eyereasoner.github.io/eyemind/entailment#';
|
|
8
8
|
|
|
9
|
-
export function
|
|
10
|
-
const
|
|
11
|
-
const text = `// Generated by eyemind from ${String(source).replace(/[\r\n\u2028\u2029]/g, ' ')}, with --${kind}.\n` +
|
|
9
|
+
export function compileOwl2rl({ quads, prefixes }, { source = '<input>' } = {}) {
|
|
10
|
+
const text = `// Generated by eyemind from ${String(source).replace(/[\r\n\u2028\u2029]/g, ' ')}, with --owl2rl.\n` +
|
|
12
11
|
'// rdf(S, P, O, G) is the working graph; result_rdf contains new RDF conclusions.\n' +
|
|
13
12
|
`facts_from({ text: ${JSON.stringify(rdfDocument(quads))} })\n` +
|
|
14
13
|
`facts_from({ text: ${JSON.stringify(rdfDocument(quads, 'ent_base'))} })\n` +
|
|
15
|
-
COMMON + RDFS +
|
|
16
|
-
return { kind, text, program: loadText(text, source), prefixes: { ...prefixes, ent: ENTAILMENT }, compiled: null };
|
|
14
|
+
COMMON + RDFS + OWL + OUTPUT;
|
|
15
|
+
return { kind: 'owl2rl', text, program: loadText(text, source), prefixes: { ...prefixes, ent: ENTAILMENT }, compiled: null };
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
const COMMON = String.raw`
|
|
@@ -28,7 +27,7 @@ implied_by(ent_resource(triple(A, B, C)), 'true');
|
|
|
28
27
|
implies(rdf(S, P, O, G), ent_graph(G));
|
|
29
28
|
implies(rdf(S, P, O, G), [ent_node(S, G), ent_node(P, G), ent_node(O, G)]);
|
|
30
29
|
|
|
31
|
-
// RDFS class/property propagation
|
|
30
|
+
// RDFS class/property propagation.
|
|
32
31
|
implies([t(P, s('domain'), C), t(X, P, Y)], t(X, r('type'), C));
|
|
33
32
|
implies([t(P, s('range'), C), t(X, P, Y)], t(Y, r('type'), C));
|
|
34
33
|
implies([t(C, s('subClassOf'), D), t(X, r('type'), C)], t(X, r('type'), D));
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// The release this checkout is; ./release keeps it in step with package.json.
|
|
2
|
-
export const VERSION = '0.7.
|
|
2
|
+
export const VERSION = '0.7.2';
|