#atomic #lib #cli #server #fetch

atomic_lib

Library for creating, storing, querying, validating and converting Atomic Data

11 releases (breaking)

new 0.13.0 Sep 24, 2020
0.11.0 Sep 10, 2020

#93 in Concurrency

Download history 7/week @ 2020-08-02 59/week @ 2020-08-09 47/week @ 2020-08-16 13/week @ 2020-08-23 18/week @ 2020-08-30 70/week @ 2020-09-06 17/week @ 2020-09-13 28/week @ 2020-09-20

77 downloads per month
Used in 2 crates

MIT license

78KB
1.5K SLoC

atomic-lib

crates.io Released API docs [![Discord chat][discord-badge]][discord-url] MIT licensed

Status: pre-alpha

Rust library for using Atomic Data.

Docs

The atomic CLI and atomic-server applications both use this atomic-lib library.

  • In-memory store for getting / setting data (Store)
  • On disk ACID compliant store / database (Db, uses Sled)
  • Path traversal
  • Parse and serialize AD3
  • JSON + JSON-LD Serialization
  • Convert to Rust native types
  • Resolve / parse mappings (bookmarks)
  • Validate Atomic Graphs
  • Mutations (linked-delta's)
  • RDF (turtle / N-Triples) Serialization
  • Strategy for extending datatypes (Currently uses an enum)
  • TPF queries
  • Performant TPF queries from Db (create index)
  • Async resource fetching (faster)
  • Store - server write interaction (update resource, send deltas to server)

Usage

# Add it to your project
cargo add atomic_lib
use atomic_lib;

fn main() {
  // Let's parse this AD3 string
  let string = String::from(r#"["_:test","https://atomicdata.dev/properties/shortname","Test"]"#);
  // Start with initializing our store
  let mut store = atomic_lib::store::Store::init();
  // Run parse...
  store.parse_ad3(&string).unwrap();
  // Get our resource...
  let my_resource = store.get(&"_:test".into()).unwrap();
  // Get our value by filtering on our property...
  let my_value = my_resource.get("https://atomicdata.dev/properties/shortname").unwrap();
  println!("My value: {}", my_value);
  assert!(my_value == "Test")
}

Optional features

Some features of this library are optional, to minimize bundle size and compile times.

db

The db features adds persistence, which means that you can store stuff on an HDD / SSD. It uses [Sled], a performant, embedded key-value store.

rdf

If you need RDF serialization options (Turtle / N-Triples), use this feature.

Dependencies

~3.5–5.5MB
~140K SLoC