|
|
@ -5,18 +5,20 @@
|
|
|
|
# `cozo`
|
|
|
|
# `cozo`
|
|
|
|
|
|
|
|
|
|
|
|
A general-purpose, transactional, relational database
|
|
|
|
A general-purpose, transactional, relational database
|
|
|
|
that uses Datalog for query and focuses on graph data and algorithms.
|
|
|
|
that uses Datalog for query, is embeddable, and focuses on graph data and algorithms.
|
|
|
|
|
|
|
|
|
|
|
|
## Features
|
|
|
|
## Features
|
|
|
|
|
|
|
|
|
|
|
|
* Relational database with [Datalog](https://en.wikipedia.org/wiki/Datalog) as the query language
|
|
|
|
* Relational database with [Datalog](https://en.wikipedia.org/wiki/Datalog) as the query language
|
|
|
|
* Recursive queries, especially recursion through (safe) aggregation, capable of expressing complex graph operations and algorithms
|
|
|
|
* Recursive queries, recursion through (safe) aggregations, capable of expressing complex graph operations and
|
|
|
|
* Fixed rules providing efficient whole-graph algorithms which integrate seamlessly with Datalog
|
|
|
|
algorithms
|
|
|
|
* Rich set of built-in functions and aggregations
|
|
|
|
* Fixed rules for efficient whole-graph algorithms which integrate seamlessly with Datalog
|
|
|
|
* Only a single executable, trivial to deploy and run
|
|
|
|
* Rich set of built-in functions and aggregations
|
|
|
|
* [Embeddable](https://cozodb.github.io/current/manual/setup.html#embedding-cozo), can run in the same process as the application
|
|
|
|
* Easy to use from any programming language, or as a standalone program
|
|
|
|
* Easy to use from any programming language
|
|
|
|
* [Embeddable](https://cozodb.github.io/current/manual/setup.html#embedding-cozo), with ready-to-use bindings for
|
|
|
|
* Special support for [Jupyter](https://jupyter.org/) notebooks for integration with the Python DataScience ecosystem
|
|
|
|
Python, NodeJS and Java
|
|
|
|
|
|
|
|
* Single executable, trivial to deploy and run
|
|
|
|
|
|
|
|
* [Jupyter](https://jupyter.org/) notebooks integration, plays well with the DataScience ecosystem
|
|
|
|
* Modern, clean, flexible syntax, informative error messages
|
|
|
|
* Modern, clean, flexible syntax, informative error messages
|
|
|
|
|
|
|
|
|
|
|
|
## Teasers
|
|
|
|
## Teasers
|
|
|
@ -26,6 +28,8 @@ representing a route between those airports.
|
|
|
|
|
|
|
|
|
|
|
|
Find airports reachable by one stop from Frankfurt Airport (code `FRA`):
|
|
|
|
Find airports reachable by one stop from Frankfurt Airport (code `FRA`):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TODO replace with images
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|
?[dst] := *route{src: 'FRA', dst: stop},
|
|
|
|
?[dst] := *route{src: 'FRA', dst: stop},
|
|
|
|
*route{src: stop, dst}
|
|
|
|
*route{src: stop, dst}
|
|
|
@ -58,10 +62,30 @@ starting[airport] := airport = 'FRA'
|
|
|
|
?[src, dst, cost, path] <~ ShortestPathDijkstra(*route[], starting[])
|
|
|
|
?[src, dst, cost, path] <~ ShortestPathDijkstra(*route[], starting[])
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Learning Cozo
|
|
|
|
Nice error messages when things go wrong:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xxx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Getting started
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
First we need to get Cozo installed on the local machine. As Cozo is embeddable,
|
|
|
|
|
|
|
|
there are lots of options for how we run Cozo. Follow one of the following guides that suits you best:
|
|
|
|
|
|
|
|
|
|
|
|
* Start with the [Tutorial](https://nbviewer.org/github/cozodb/cozo/blob/main/docs/tutorial/tutorial.ipynb) to learn the basics;
|
|
|
|
* Embedded in Python with JupyterLab (best interactive experience, recommended if you are comfortable with the Python
|
|
|
|
* Continue with the [Manual](https://cozodb.github.io/current/manual/) to understand the fine points.
|
|
|
|
ecosystem)
|
|
|
|
|
|
|
|
* Embedded in Python
|
|
|
|
|
|
|
|
* Embedded in NodeJS (Javascript)
|
|
|
|
|
|
|
|
* Embedded in Java (or any JVM language)
|
|
|
|
|
|
|
|
* Embedded in Rust
|
|
|
|
|
|
|
|
* Client/server with HTTP API
|
|
|
|
|
|
|
|
* Embedded in C/C++, or any language that has a C FFI
|
|
|
|
|
|
|
|
(Golang, R, Haskell, CommonLisp, Julia, Fortran, C#, Swift, ...)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
After you have it installed, you can start learning CozoScript:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Start with the [Tutorial](https://nbviewer.org/github/cozodb/cozo/blob/main/docs/tutorial/tutorial.ipynb) to learn the
|
|
|
|
|
|
|
|
basics;
|
|
|
|
|
|
|
|
* Continue with the [Manual](https://cozodb.github.io/current/manual/) for the fine points.
|
|
|
|
|
|
|
|
|
|
|
|
## Bug reports, discussions
|
|
|
|
## Bug reports, discussions
|
|
|
|
|
|
|
|
|
|
|
@ -102,7 +126,8 @@ in specific situations:
|
|
|
|
Furthermore, the deterministic evaluation order makes identifying and solving
|
|
|
|
Furthermore, the deterministic evaluation order makes identifying and solving
|
|
|
|
performance problems easier.
|
|
|
|
performance problems easier.
|
|
|
|
* Your data may be simple, even a single table, but it is inherently a graph.
|
|
|
|
* Your data may be simple, even a single table, but it is inherently a graph.
|
|
|
|
* We have seen an example in the [Tutorial](https://nbviewer.org/github/cozodb/cozo/blob/main/docs/tutorial/tutorial.ipynb):
|
|
|
|
* We have seen an example in
|
|
|
|
|
|
|
|
the [Tutorial](https://nbviewer.org/github/cozodb/cozo/blob/main/docs/tutorial/tutorial.ipynb):
|
|
|
|
the air route dataset, where the key relation contains the routes connecting airports.
|
|
|
|
the air route dataset, where the key relation contains the routes connecting airports.
|
|
|
|
* In traditional databases, when you are given a new relation,
|
|
|
|
* In traditional databases, when you are given a new relation,
|
|
|
|
you try to understand it by running aggregations on it to collect statistics:
|
|
|
|
you try to understand it by running aggregations on it to collect statistics:
|
|
|
@ -165,9 +190,11 @@ Further down the road:
|
|
|
|
* More tuning options
|
|
|
|
* More tuning options
|
|
|
|
* Streaming/reactive data
|
|
|
|
* Streaming/reactive data
|
|
|
|
* Extension system
|
|
|
|
* Extension system
|
|
|
|
* The core of Cozo should be kept small at all times. Additional functionalities should be in extensions for the user to choose from.
|
|
|
|
* The core of Cozo should be kept small at all times. Additional functionalities should be in extensions for the
|
|
|
|
|
|
|
|
user to choose from.
|
|
|
|
* What can be extended: datatypes, functions, aggregations, and fixed algorithms.
|
|
|
|
* What can be extended: datatypes, functions, aggregations, and fixed algorithms.
|
|
|
|
* Extensions should be written in a compiled language such as Rust or C++ and compiled into a dynamic library, to be loaded by Cozo at runtime.
|
|
|
|
* Extensions should be written in a compiled language such as Rust or C++ and compiled into a dynamic library, to be
|
|
|
|
|
|
|
|
loaded by Cozo at runtime.
|
|
|
|
* There will probably be a few "official" extension bundles, such as
|
|
|
|
* There will probably be a few "official" extension bundles, such as
|
|
|
|
* arbitrary precision arithmetic
|
|
|
|
* arbitrary precision arithmetic
|
|
|
|
* full-text "indexing" and searching
|
|
|
|
* full-text "indexing" and searching
|
|
|
@ -186,5 +213,6 @@ We manually wrote the C++/Rust bindings for RocksDB with [cxx](https://cxx.rs/).
|
|
|
|
## Licensing
|
|
|
|
## Licensing
|
|
|
|
|
|
|
|
|
|
|
|
The contents of this project are licensed under AGPL-3.0 or later, except:
|
|
|
|
The contents of this project are licensed under AGPL-3.0 or later, except:
|
|
|
|
* Files under `cozorocks/` are licensed under MIT, or Apache-2.0, or BSD-3-Clause;
|
|
|
|
|
|
|
|
|
|
|
|
* Files under `cozorocks/`, `python/`, `nodejs/`, `java/` and `c/` are licensed under MIT, or Apache-2.0, or BSD-3-Clause;
|
|
|
|
* Files under `docs/` are licensed under CC BY-SA 4.0.
|
|
|
|
* Files under `docs/` are licensed under CC BY-SA 4.0.
|