Skip to main content

oxibrain_cli/cmd/
timeline.rs

1use oxibrain::{Brain, BrainConfig};
2use std::path::Path;
3
4pub async fn run(dir: &Path, entity_id: &str, space: &str) -> anyhow::Result<()> {
5    let brain = Brain::open(BrainConfig::at(dir)).await?;
6    let space_id = brain.ensure_space(space).await?;
7    let entries = brain.timeline(&space_id, entity_id, None, None).await?;
8    println!("timeline for entity {entity_id}: {} entries", entries.len());
9    for e in &entries {
10        println!(
11            "  [{}] {}/{} = {} from={} to={} (recorded {})",
12            e.status,
13            e.predicate,
14            e.object_repr,
15            e.statement_id,
16            e.valid_from.millis(),
17            e.valid_to.millis(),
18            e.recorded_at.millis(),
19        );
20    }
21    Ok(())
22}