GitHub Workflow Status Crates.io GitHub

cozo

A general-purpose, transactional, relational database that uses Datalog for query and focuses on graph data and algorithms.

Features

Teasers

Here *route is a relation with two columns src and dst, representing a route between those airports.

Find airports reachable by one stop from Frankfurt Airport (code FRA):

js ?[dst] := *route{src: 'FRA', dst: stop}, *route{src: stop, dst}

Find airports reachable from Frankfurt with any number of stops with code starting with the letter A:

js reachable[dst] := *route{src: 'FRA', dst} reachable[dst] := reachable[src], *route{src, dst} ?[airport] := reachable[airport], starts_with(airport, 'A')

Compute the shortest path between Frankfurt and all airports in the world:

js shortest_paths[dst, shortest(path)] := *route{src: 'FRA', dst}, path = ['FRA', dst] shortest_paths[dst, shortest(path)] := shortest_paths[stop, prev_path], *route{src: stop, dst}, path = append(prev_path, dst) ?[dst, path] := shortest_paths[dst, path]

Compute the shortest path again, but with built-in algorithm:

js starting[airport] := airport = 'FRA' ?[src, dst, cost, path] <~ ShortestPathDijkstra(*route[], starting[])

Learning Cozo

Bug reports, discussions

If you encounter a bug, first search for past issues to see if it has already been reported. If not, open a new issue. Please provide sufficient information so that we can diagnose the problem faster.

Other discussions about Cozo should be in GitHub discussions.

Use cases

As Cozo is a general-purpose database, it can be used in situations where traditional databases such as PostgreSQL and SQLite are used. However, Cozo is designed to overcome several shortcomings of traditional databases, and hence fares especially well in specific situations:

Status of the project

Cozo is very young and not production-ready yet, but we encourage you to try it out for your use case. Any feedback is welcome.

Versions before 1.0 do not promise syntax/API stability or storage compatibility. We promise that when you try to open database files created with an incompatible version, Cozo will at least refuse to start instead of silently corrupting your data.

Plans for development

In the near term, before we reach version 1.0:

Further down the road:

Ideas and discussions are welcome.

Storage engine

Cozo is written in Rust, with RocksDB as the storage engine (this may change in the future). We manually wrote the C++/Rust bindings for RocksDB with cxx.

Licensing

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 docs/ are licensed under CC BY-SA 4.0.