Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
readme: put a runnable example where the case histories were
FABIOTESS3b0f0819753c
diff --git a/README.md b/README.mdindex 9364bf87..21ad5148 100644--- a/README.md+++ b/README.md@@ -64,10 +64,63 @@ flowchart LRC -->|forged| X["refused, exit 1"]```-The discipline is not free and it has earned its keep: in one week against this engine it caught five-description-logic false cleans, a rule that could conclude a triple no serialiser can write, and two-independently verified kernels disagreeing on the same certificates. Every one had passed every test-that existed before. [What the rules are, and what each has caught](docs/decisions/).+## Run it on your own ontology++Those fixtures ship with the repository. Here is the same thing starting from a file you wrote.+[Install](#install) is below; this takes about a minute.++```bash+mkdir /tmp/oo-demo && cd /tmp/oo-demo+cat > coffee.ttl <<'EOF'+@prefix ex: <http://example.org/> .+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .++ex:Espresso rdfs:subClassOf ex:Coffee .+ex:Coffee rdfs:subClassOf ex:Drink .+ex:myCup a ex:Espresso .+EOF++export OPEN_ONTOLOGIES_STORAGE_MODE=persistent # in-memory by default, see below+open-ontologies --data-dir /tmp/oo-demo/store load coffee.ttl+open-ontologies --data-dir /tmp/oo-demo/store reason --profile rdfs --certificate ./cert+```++Three triples in, three out: the cup is a Coffee, the cup is a Drink, and Espresso is a subclass of+Drink. Any RDFS reasoner does that much. The difference is the directory it just wrote.++```bash+lake exe oo-cert /tmp/oo-demo/cert/asserted.tsv /tmp/oo-demo/cert/derivations.tsv+{"ok":true,"asserted":3,"derivations":3,"theorem":"OOCert.certificate_sound"}+```++Now lie to it. Leave the premises alone and forge one conclusion, claiming the cup is a Beer:++```bash+cp -r /tmp/oo-demo/cert /tmp/oo-demo/forged+sed -i '' 's|example.org/Drink>\t<http://example.org/myCup>|example.org/Beer>\t<http://example.org/myCup>|' \+ /tmp/oo-demo/forged/derivations.tsv # GNU sed: drop the '' after -i+lake exe oo-cert /tmp/oo-demo/forged/asserted.tsv /tmp/oo-demo/forged/derivations.tsv+```++```json+{"ok":false,"asserted":3,"derivations":3,"first_rejected":2,"rule":"rdfs9",+ "conclusion":"<http://example.org/myCup> <...#type> <http://example.org/Beer>",+ "premises":["<http://example.org/myCup> <...#type> <http://example.org/Coffee>",+ "<http://example.org/Coffee> <...#subClassOf> <http://example.org/Drink>"]}+```++Exit 1, the offending line numbered, the rule named, and the premises shown so you can see for+yourself that they do not support it. Showing a green result would prove nothing, since anything can+print `ok`. The point is that it goes red.++Two defaults that will bite you otherwise. Storage is in-memory unless+`OPEN_ONTOLOGIES_STORAGE_MODE=persistent` is set, so `load` followed by `reason` starts from an empty+store and cheerfully certifies nothing; the tool warns, and the warning is easy to skim past. And+`--data-dir` is a flag rather than an environment variable, so a demo without it writes into+`~/.open-ontologies` beside real work.++The discipline behind all of this is not free and it has earned its keep:+[what the rules are, and what each has caught](docs/decisions/).## What is actually proved@@ -207,69 +260,6 @@ Intel macOS, native Windows and the rest: [docs/quickstart.md](docs/quickstart.mhang while it waits for a client. That is expected. From a terminal, use the CLI subcommandsinstead, such as `open-ontologies validate <file.ttl>`.-## Sixty seconds--Six lines of Turtle, three inferences, and a checker that will not take the engine's word for them.--```bash-mkdir /tmp/oo-demo && cd /tmp/oo-demo-cat > coffee.ttl <<'EOF'-@prefix ex: <http://example.org/> .-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .--ex:Espresso rdfs:subClassOf ex:Coffee .-ex:Coffee rdfs:subClassOf ex:Drink .-ex:myCup a ex:Espresso .-EOF--export OPEN_ONTOLOGIES_STORAGE_MODE=persistent-open-ontologies --data-dir /tmp/oo-demo/store load coffee.ttl-open-ontologies --data-dir /tmp/oo-demo/store reason --profile rdfs --certificate ./cert --pretty-```--Three triples in, three out: the cup is a Coffee, the cup is a Drink, and Espresso is a subclass of-Drink. Any RDFS reasoner does that much. The difference is the directory it just wrote.--```bash-cd <the open-ontologies source tree>/lean && lake build # once-lake exe oo-cert /tmp/oo-demo/cert/asserted.tsv /tmp/oo-demo/cert/derivations.tsv-```--```json-{"ok":true,"asserted":3,"derivations":3,"theorem":"OOCert.certificate_sound"}-```--That is not the engine reporting on itself. It is a separate checker, written in Lean 4, whose-soundness is a machine-checked theorem, reading the certificate and agreeing that every step follows.-Exit code 0.--Now lie to it. Leave the premises alone and forge one conclusion, claiming the cup is a Beer:--```bash-cp -r /tmp/oo-demo/cert /tmp/oo-demo/forged-sed -i '' 's|example.org/Drink>\t<http://example.org/myCup>|example.org/Beer>\t<http://example.org/myCup>|' \- /tmp/oo-demo/forged/derivations.tsv # GNU sed: drop the '' after -i-lake exe oo-cert /tmp/oo-demo/forged/asserted.tsv /tmp/oo-demo/forged/derivations.tsv-```--```json-{"ok":false,"asserted":3,"derivations":3,"first_rejected":2,"rule":"rdfs9",- "conclusion":"<http://example.org/myCup> <...#type> <http://example.org/Beer>",- "premises":["<http://example.org/myCup> <...#type> <http://example.org/Coffee>",- "<http://example.org/Coffee> <...#subClassOf> <http://example.org/Drink>"]}-```--Exit code 1, the offending line numbered, the rule named, and the premises shown so you can see for-yourself that they do not support it.--That is the whole idea. A fast engine you do not have to trust proposes; a small checker you can-read disposes. Everything else in this repository is that pattern applied to more logics.--The example depends on a couple of defaults that will bite you otherwise. Storage is in-memory-unless you say otherwise, so without `OPEN_ONTOLOGIES_STORAGE_MODE=persistent` the `reason` call-starts from an empty store and cheerfully certifies nothing; the tool warns, and the warning is easy-to skim past. `--data-dir` is also a flag rather than an environment variable, so a demo that omits-it writes into `~/.open-ontologies` alongside real work.## Connect it to Claude