Skip to main content

chronicle/
lib.rs

1//! Event-centric narrative knowledge graphs with temporal verification.
2//!
3//! Chronicle loads authored narrative content into a typed, event-centric
4//! knowledge graph, validates it for consistency, and provides a typed query API.
5//!
6//! # Quick Start
7//!
8//! ```no_run
9//! use chronicle::graph::Chronicle;
10//! use chronicle::model::*;
11//!
12//! // Load a world from RON files
13//! let graph = Chronicle::from_directory("world/".as_ref())?;
14//!
15//! // Validate consistency
16//! let report = graph.validate();
17//! for error in &report.errors {
18//!     eprintln!("{error}");
19//! }
20//!
21//! // Typed queries
22//! let kaine = graph.actor("kaine_durgan").unwrap();
23//! let events = kaine.events();
24//! let contacts = kaine.interactions().people();
25//!
26//! // Check if a proposed event is consistent
27//! let proposed = Event {
28//!     id: "new_battle".into(),
29//!     name: "New Battle".into(),
30//!     event_type: EventType::Battle,
31//!     time_span: TimeSpan { start: 25, end: 25 },
32//!     location: Some("silica".into()),
33//!     caused_by: vec![],
34//!     participants: vec![],
35//!     state_changes: vec![],
36//!     description: String::new(),
37//! };
38//! match graph.can_add_event(&proposed) {
39//!     Ok(()) => println!("Event is consistent"),
40//!     Err(errors) => {
41//!         for e in &errors {
42//!             eprintln!("{e}");
43//!         }
44//!     }
45//! }
46//! # Ok::<(), chronicle::error::ChronicleError>(())
47//! ```
48
49#![warn(missing_docs)]
50
51pub mod error;
52pub mod graph;
53pub mod model;
54pub mod query;
55pub mod validation;