relic
relic is an embeddable Datalog engine written in C. It supports dependency analysis, graph queries and reasoning over tables.
Try in your browser Quickstart Language tutorial
Installation
Homebrew
With Homebrew installed:
brew install stass/tap/relic
Build from source
Download and unpack a source tarball from
GitHub Releases.
With a C11 compiler, make and a POSIX shell, run these commands
inside the unpacked directory:
./configure --prefix="$HOME/.local"
make
make check
make install
export PATH="$HOME/.local/bin:$PATH"
This installs under your home directory without root access. See the quickstart for building from a Git checkout.
What depends on the database?
Save this as impact.dl. The rules derive direct and indirect dependencies.
depends(web, api).
depends(api, database).
depends(worker, api).
affected(App, Changed) :- depends(App, Changed).
affected(App, Changed) :-
depends(App, Middle), affected(Middle, Changed).
affected(App, database)?
$ relic -s impact.dl
api
web
worker
:- means “if”. Uppercase names are variables. A query ends in
?. These rules also handle cycles.
Command-line interface
Import CSV or TSV. Print text, CSV, TSV or JSON. Run a file, ask a query from the command line, or explore in the REPL.
C library
Load rules, add facts, and stream or collect
answers through librelic.
Evaluation
Indexed joins, semi-naive evaluation and query-directed planning keep work focused. Large evaluation rounds can use multiple cores.
Documentation
- Quickstart
- Install relic and run a query.
- Language tutorial
- Facts, joins, recursion, negation and aggregates.
- Performance
- Explore benchmark results and the techniques behind the engine.
- C API overview
- Embed the engine with explicit ownership and error handling.
- More examples
- Dependency planning, family trees, graph queries and table processing.