A domain description and mapping engine.
This repo is a workspace with multiple inter-dependent crates.
A domain description and mapping language.
The name is a silly spin on ALGOL (for algorithms!), this is a language for ontologies.
See documentation.
High level data flow:
- Create compiler. The compiler is single threaded.
- Feed domain source code into the compiler.
- The compiler finally produces a shared, immutable and thread safe ontology.
- Execute code by creating a virtual machine which holds a reference to the ontology.
Any number of virtual machines may be created and executed in parallel, because of the immutable ontology.
The domain engine encapsulates the ONTOL virtual machine, and provides a high level interface for interacting with the ontology.
The domain service encapsulates the domain engine, turning it into an internet service.
graph TD
ontol-core-->ontol-macros
ontol-runtime-->ontol-core
ontol-compiler-->ontol-core
ontol-compiler-->ontol-runtime
ontol-compiler-->ontol-parser
ontol-compiler-->ontol-macros
ontol-compiler-->ontol-hir
ontol-hir-->ontol-runtime
ontol-syntax-->ontol-parser
ontol-lsp-->ontol-compiler
ontol-lsp-->ontol-parser
ontol-faker-->ontol-runtime
domain-engine-core-->ontol-runtime
domain-engine-httpjson-->domain-engine-core
domain-engine-graphql-->domain-engine-core
domain-engine-arrow-->domain-engine-core
domain-engine-datafusion-->domain-engine-arrow
domain-engine-datafusion-->domain-engine-core
domain-engine-store-inmemory-->domain-engine-core
domain-engine-store-pg-->domain-engine-core
ontool-->ontol-compiler
ontool-->ontol-parser
ontool-->ontol-lsp
ontool-->domain-engine-core
ontool-->domain-engine-graphql
ontool-->domain-engine-store-inmemory
The compiler goes through a number of transformation steps before producing executable code:
ontol-parser
: Parse ONTOL source code.lowering
: Lower these statements into various hashmaps for representing relationships andPattern
which are the thingsmap
statements consist of.type_check
: Type check the expressions and output typedontol-hir
.repr_check
: Check that every entity consists only of concrete types.hir_unify
: Unify map arms to produceontol-hir
functions.codegen
: Turnontol-hir
functions intoontol-vm
stack machine assembly-like language.
The following command compiles a domain into an ontology and also specifies that it represents the data store:
just ontool
cd examples
ontool compile demo.on --data-store demo -o ontology
To start a dev server, run ontool serve demo.on --data-store demo
Every feature must be properly tested and every encountered bug must have a regression test.
Every ONTOL language feature must have a test in
ontol/ontol-compiler/tests/compiler-integration
.
Tests must use the ontol_macros::test
attribute for proper tracing.
- Run all the tests with
cargo test
. - Run a specific test with
cargo test {test_name}
. - To enable traces, use
RUST_LOG=debug cargo test {test_name}
. - Rust captures all console output for successful tests. To show traces for
successful tests, use
-- --nocapture
after the test command.
cargo install just
# compile and install ontool
just ontool
# compile and install ontol-lsp
just lsp
code --install-extension ontol/ontol-language/ontol-vscode/ontol.vsix
Documentation can be built using mdbook
:
cd docs
# serve documentation with hot reloading
mdbook serve
# build HTML documentation
mdbook build
domain-engine is licensed under the GNU Affero General Public License v3.0 (AGPLv3) license. Contact us for commercial licensing options.