ggen_cli_lib/cmds/graph/
mod.rs

1use clap::Subcommand;
2use ggen_utils::error::Result;
3
4pub mod diff;
5pub mod export;
6pub mod load;
7pub mod query;
8pub mod snapshot;
9pub mod stats;
10pub mod validate;
11
12#[derive(clap::Args, Debug)]
13pub struct GraphCmd {
14    #[command(subcommand)]
15    pub verb: Verb,
16}
17
18#[derive(Subcommand, Debug)]
19pub enum Verb {
20    /// Execute SPARQL query against RDF graph
21    Query(query::QueryArgs),
22    /// Load RDF data into graph
23    Load(load::LoadArgs),
24    /// Export RDF graph
25    Export(export::ExportArgs),
26    /// Validate graph against SHACL shapes
27    Validate(validate::ValidateArgs),
28    /// Show graph statistics
29    Stats(stats::StatsArgs),
30    /// Compare two RDF graphs and show differences
31    Diff(diff::DiffArgs),
32    /// Manage graph snapshots for delta-driven projection
33    Snapshot(snapshot::SnapshotArgs),
34}
35
36impl GraphCmd {
37    pub async fn run(&self) -> Result<()> {
38        match &self.verb {
39            Verb::Query(args) => query::run(args).await,
40            Verb::Load(args) => load::run(args).await,
41            Verb::Export(args) => export::run(args).await,
42            Verb::Validate(args) => validate::run(args).await,
43            Verb::Stats(args) => stats::run(args).await,
44            Verb::Diff(args) => diff::run(args).await,
45            Verb::Snapshot(args) => snapshot::run(args).await,
46        }
47    }
48}