SolomonDB: Gremlin-compatible Graph Database - Weekly Update

Introduction

SolomonDB is a side project that I am working on. It is a distributed graph database that supports multiple storage layers and Gremlin graph query language. The current status of the repo is that it is framed up with a good structure already.

Current status

let command = db.traverse().add_v("person").property_many(vec![
    ("birthday".to_string(), "1/11/2001"),
    ("github".to_string(), "chungquantin"),
    ("name".to_string(), "Tin Chung"),
]);

let result = db.execute(command).await.unwrap();

Current CHANGELOG update

Apply some techniques to serialize Rust struct data into bytes data. Derived from my experience with Solana development, I learnt the approach Solana codebase uses to for byte serialization and deserialization. This can be briefly described with a work Discriminator .

Detailed explanation is here: November - Akashic records: The Solomon book

CONTRIBUTION

Hey guys, I'm new to Rust community, just got my account created a few minutes before posting this update. I'm willing to make new friends. Love to have more Rust enthusiast to work on side projects.

November Wrap Up

  • Start this project in the beginning of November.
  • Commits every single day: ~90 commits in total
  • Get first start on Github from stranger

Current Progress

Supporting basic Gremlin steps to

  • Add Vertex
  • Add Vertex Property
  • Traverse Vertex

Below is the piece of code that you can do know with SolomonDB to create a new vertex. Note: This does not require the installation of Apache Tinkerpop or Gremlin Server. This operates on top of an embedded database RocksDB. There will be more and more underlying databases supported in the future.

let vertices = db
			.traverse()
			.v(1)
			.add_v("person")
			.add_v("coder")
			.property("github", "chungquantin")
			.exec()
			.to_list()
			.await
			.unwrap();

SolomonDB Documentation Page

If the announcement thread is not enough, I also update daily on the documentation site of SolomonDB. This is built and deployed using Rust mdbook and Github Pages
The link to the documentation page: Introduction - Akashic records: The Solomon book

New Gremlin query supported (27th November 2022)

Property of vertex is supported in SolomonDB now. Check the commit to have a detailed look on the code changes:

The example code for querying the properties of a vertex is below

// Print all properties of a specific vertex
let result = db.traverse().v(vertex.id()).properties(()).exec().to_list().await.unwrap();

// Print specific property from a specific vertex
let result = db.traverse().v(vertex.id()).properties("github").exec().to_list().await.unwrap();

What is a "Vertex Property"?

Vertex Property and Property are two different object type in Property Graph Model (based on the design of Apache TinkerPop. A VertexProperty is similar to a Property in that it denotes a key/value pair associated with an Vertex, however it is different in the sense that it also represents an entity that it is an Element that can have properties of its own.

TinkerPop introduces the concept of a VertexProperty. All the properties of a Vertex are a VertexProperty. A VertexProperty implements Property and as such, it has a key/value pair. However, VertexProperty also implements Element and thus, can have a collection of key/value pairs. Moreover, while an Edge can only have one property of key "name" (for example), a Vertex can have multiple "name" properties. With the inclusion of vertex properties, two features are introduced which ultimately advance the graph modelers toolkit:

New Gremlin step supported "Has Step" (29th November 2022)

It is possible to filter vertices, edges, and vertex properties based on their properties using has() -step (filter ). There are numerous variations on has() The current update add a handler for has_label() first which mean now we can traverse and filter vertex by its label.

let vertices = db
	.traverse()
	.v(1)
	.add_v("person")
	.add_v("person")
	.add_v("coder")
	.property("github", "chungquantin")
	.has_label("person")
	.exec()
	.to_list()
	.await
	.unwrap();

assert_eq!(vertices.len(), 2);

The code example above create three new vertices with label: person, person and code. When traversing by using terminator method to_list() and filter with has_label("person"), we get two vertices as there are two vertices labeled "person".

"hasLabel", "hasKey", "hasId" supported (30th November 2022)

Never get rest, more and more Gremlin steps are supported by SolomonDB. This update will provide ability to filter in a more versatile way and close to the original design of GQL (Gremlin Query Language).

let t1 = db
	.traverse()
	.v(1)
	.add_v("person")
	.property("github", "tin-snowflake")
	.property("name", "Tin Chung")
	.property("age", 21)
	.add_v("coder")
	.property("github", "chungquantin")
	.property("age", 30);

// Finding all vertices that has property "github" and label "person" 
let t2 = t1.clone().has_key("github").has_label("person").exec().to_list().await.unwrap();
// => Result 1 vertex
assert_eq!(t2.len(), 1);
// Finding all vertices that has property "github"
let t3 = t1.clone().has_key("github").exec().to_list().await.unwrap();
// => Result 2 vertices
assert_eq!(t3.len(), 2);
// Finding all vertices that has does not have property "name"
let t4 = t1.clone().has_not("name").exec().next().await.unwrap();
// => Result 2 vertices
assert_eq!(t4.unwrap().label(), "coder");

Weekly update is live (#4): Week 4: Purson - Akashic records: The Solomon book

This includes the implementation of Gremlin and SolomonDB processor to handle Gremlin step.

SolomonDB is published!

SolomonDB is published and be a part of Rust ecosystem: https://crates.io/crates/solomondb
You can install SolomonDB to your Rust project buy adding this to dependency list

[dependencies]
solomondb = "0.0.1-beta.1"

Or install SolomonDB using cargo

cargo add solomondb

A more detailed version of installation and getting started guide will be written soon.

Add Redb database engine

SolomonDB now supports both RocksDB and Redb. Using SolomonDB, you can interact with these embedded storage using Gremlin query language.

A source code of SolomonDB is reused to build a tool supports embedded database management called EDMA: Release: EDMA v0.1.0 - An embedded database management tool

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.