GitXplorerGitXplorer
r

datafrog

public
804 stars
45 forks
8 issues

Commits

List of commits on branch master.
Verified
07bf407c740db506a56bcb4af3eb474eb83ca815

Merge pull request #50 from ecstatic-morse/var-helpers

nnikomatsakis committed 3 years ago
Unverified
f03e231209929a46211fdc3f9582470acc20f466

Add some helper methods

eecstatic-morse committed 3 years ago
Verified
a0e9666289fe7690a1b3c1cf670a1e1fc499b98f

Merge pull request #49 from ecstatic-morse/intradoc-links

llqd committed 3 years ago
Unverified
b03f92d90550d312ad3b0c2aa21379277e5a4b32

Fix intra-doc links

eecstatic-morse committed 3 years ago
Unverified
fbcc77a6dbacdc67f5c9f9208835571b1e7296b8

Remove more unnecessary bounds

eecstatic-morse committed 3 years ago
Unverified
2aa3b2f3e425ce92a95ecc03178e3b5ba5c800ab

Remove `Ord` bounds on types

eecstatic-morse committed 3 years ago

README

The README file for this repository.

datafrog

Datafrog is a lightweight Datalog engine intended to be embedded in other Rust programs.

Datafrog has no runtime, and relies on you to build and repeatedly apply the update rules. It tries to help you do this correctly. As an example, here is how you might write a reachability query using Datafrog (minus the part where we populate the nodes and edges initial relations).

extern crate datafrog;
use datafrog::Iteration;

fn main() {
    // Prepare initial values, ..
    let nodes: Vec<(u32,u32)> = vec![
        // ..
    ];
    let edges: Vec<(u32,u32)> = vec![
        // ..
    ];

    // Create a new iteration context, ..
    let mut iteration = Iteration::new();

    // .. some variables, ..
    let nodes_var = iteration.variable::<(u32,u32)>("nodes");
    let edges_var = iteration.variable::<(u32,u32)>("edges");

    // .. load them with some initial values, ..
    nodes_var.insert(nodes.into());
    edges_var.insert(edges.into());

    // .. and then start iterating rules!
    while iteration.changed() {
        // nodes(a,c)  <-  nodes(a,b), edges(b,c)
        nodes_var.from_join(&nodes_var, &edges_var, |_b, &a, &c| (c,a));
    }

    // extract the final results.
    let reachable: Vec<(u32,u32)> = nodes_var.complete();
}

If you'd like to read more about how it works, check out this blog post.

Authorship

Datafrog was initially developed by Frank McSherry and was later transferred to the rust-lang-nursery organization. Thanks Frank!