OntoLogic
Write your domain once as first-order logic. Lint it, prove it consistent, and compile it into OWL, SHACL, typed code, API contracts, graph schemas and diagrams.
What it does
Write .logic
A concise Lisp-style DSL for concepts, relations, typed properties and quantified axioms, with modular imports and namespaces.
Lint
Symbol resolution, circular inheritance, duplicate definitions and contradiction detection before anything runs.
Solve
Consistency checks, subsumption proofs, empty-concept detection and counterexamples via real solvers.
Emit and visualize
One model, many targets: schemas, code, API contracts, graph databases and architecture diagrams.
The language
A trimmed excerpt from examples/domain_mining.logic.
(def-concept HeavyMachinery MiningEquipment)
(def-concept GasSensor Sensor)
(def-concept SafetyAlert InformationContentEntity)
(def-property methane_level GasSensor Integer)
; High methane implies an evacuation alert exists
(forall (s)
(implies (and (GasSensor s) (gt methane_level 5))
(exists (a) (SafetyAlert a))))Emit targets
One model compiles to all of these. Pick any with -t.
Solver backends
Z3
SMT-LIB2 consistency and satisfiability checking.
CVC5
Alternative SMT backend, same model, same flags.
Vampire
First-order ATP over TPTP FOF problems.
Native
Built-in solver with no external dependency. Auto-discovery picks what is installed.
Tooling
REPL
Incremental evaluation with :load, :solve, :prove, :emit.
LSP
Diagnostics, completion, hover, go-to-definition and rename.
VS Code
Syntax highlighting, snippets and solver commands.
Domain gallery
Dozens of worked ontologies across industry sectors.
Quickstart
# Interactive REPL
stack exec ontologic-exe -- --repl
# Lint a model
stack exec ontologic-exe -- -i examples/smart_factory.logic -t lint
# Check consistency with an SMT solver (z3, cvc5, vampire, native)
stack exec ontologic-exe -- -i examples/smart_factory.logic -t solve --prover z3
# Emit artifacts
stack exec ontologic-exe -- -i examples/smart_factory.logic -t ts -o ./generated/ts
stack exec ontologic-exe -- -i examples/smart_factory.logic -t openapi -o ./generated/openapi
stack exec ontologic-exe -- -i examples/smart_grid_relational.logic -t d2 -o ./generated/diagrams --render
# Language server for editors
stack exec ontologic-lsp