#graph-database #datalog #relational #transactional #query #algorithm #cozo-db

cozo

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

19 releases

0.7.6 Dec 11, 2023
0.7.5 Sep 16, 2023
0.7.2 Jun 1, 2023
0.5.1 Feb 4, 2023
0.1.6 Nov 9, 2022

#812 in Database interfaces

Download history 448/week @ 2024-08-14 581/week @ 2024-08-21 189/week @ 2024-08-28 136/week @ 2024-09-04 70/week @ 2024-09-11 104/week @ 2024-09-18 81/week @ 2024-09-25 132/week @ 2024-10-02 136/week @ 2024-10-09 307/week @ 2024-10-16 232/week @ 2024-10-23 232/week @ 2024-10-30 240/week @ 2024-11-06 240/week @ 2024-11-13 278/week @ 2024-11-20 207/week @ 2024-11-27

994 downloads per month
Used in ac-qu-ai-nt-core

MPL-2.0 license

6MB
151K SLoC

C++ 86K SLoC // 0.1% comments Rust 61K SLoC // 0.0% comments Python 2K SLoC // 0.1% comments Shell 1K SLoC // 0.2% comments C 742 SLoC // 0.0% comments Pest 253 SLoC // 0.0% comments GNU Style Assembly 135 SLoC // 0.1% comments INI 107 SLoC // 0.1% comments PowerShell 78 SLoC // 0.2% comments Bitbake 41 SLoC // 0.2% comments

Cozo-core

Crates.io

This crate contains the implementation proper of CozoDB.


lib.rs:

This crate provides the core functionalities of CozoDB. It may be used to embed CozoDB in your application.

This doc describes the Rust API. To learn how to use CozoDB to query (CozoScript), see:

Rust API usage:

use cozo::*;

let db = DbInstance::new("mem", "", Default::default()).unwrap();
let script = "?[a] := a in [1, 2, 3]";
let result = db.run_script(script, Default::default(), ScriptMutability::Immutable).unwrap();
println!("{:?}", result);

We created an in-memory database above. There are other persistent options: see DbInstance::new. It is perfectly fine to run multiple storage engines in the same process.

Dependencies

~27–46MB
~703K SLoC