Skip to main content

Crate fabula

Crate fabula 

Source
Expand description

§Fabula

Incremental pattern matching over temporal graphs.

Fabula finds patterns in graphs where edges have validity intervals. You define patterns (“find a character whose loyalty dropped after an institutional failure, with no trust recovery in between”), register them with the engine, and it tracks partial matches incrementally as new edges arrive.

§Crate Structure

  • fabula (this crate) — core library with zero dependencies. Pattern types, the DataSource trait, Allen interval algebra, the SiftEngine.
  • fabula-memoryMemGraph, a simple in-memory DataSource for testing.
  • fabula-petgraphDataSource adapter wrapping petgraph::StableGraph.
  • fabula-grafeoDataSource adapter for the Grafeo graph database.

§Quick Start

use fabula::prelude::*;

// Define a pattern: two betrayals by the same character
let pattern = PatternBuilder::<String, String>::new("double_betrayal")
    .stage("e1", |s| s
        .edge("e1", "eventType".to_string(), "betray".to_string())
        .edge_bind("e1", "actor".to_string(), "char"))
    .stage("e2", |s| s
        .edge("e2", "eventType".to_string(), "betray".to_string())
        .edge_bind("e2", "actor".to_string(), "char"))
    .build();

assert_eq!(pattern.stages.len(), 2);
assert_eq!(pattern.name, "double_betrayal");

For full evaluation examples, see fabula-memory which provides MemGraph.

Modules§

builder
Ergonomic builder API for constructing patterns.
compose
Pattern composition operators — build complex patterns from simpler ones.
datasource
The DataSource trait — how fabula queries a temporal graph.
engine
The sift engine — pattern registration, batch evaluation, incremental matching, and gap analysis.
interval
Allen’s interval algebra over generic time types.
pattern
Pattern types — the compiled representation of a sifting query.
prelude
Convenience re-exports for common usage.
scoring
Statistical surprise scoring for pattern matches.