rudof_cli 0.3.18

RDF and Knowledge Graphs processing tool
use crate::cli::parser::CommonArgsAll;
use crate::cli::wrappers::{
    DataFormatCli, DataReaderModeCli, RecursionSemanticsCli, ResultShaclValidationFormatCli, ShaclFormatCli,
    ShaclValidationModeCli, ShaclValidationSortByModeCli,
};
use clap::Args;
use rudof_lib::formats::InputSpec;

/// Arguments for the `shacl-validate` command
#[derive(Debug, Clone, Args)]
pub struct ShaclValidateArgs {
    #[clap(value_parser = clap::value_parser!(InputSpec))]
    pub data: Vec<InputSpec>,

    #[arg(
        short = 't',
        long = "data-format",
        value_name = "FORMAT",
        ignore_case = true,
        help= "RDF Data format",
        default_value_t = DataFormatCli::Turtle
    )]
    pub data_format: DataFormatCli,

    #[arg(
        long = "base-data",
        value_name = "IRI",
        help = "Base IRI (used to resolve relative IRIs in RDF data)"
    )]
    pub base_data: Option<String>,

    /// RDF Reader mode
    #[arg(
        long = "reader-mode",
        value_name = "MODE",
        ignore_case = true,
        help = "RDF Reader mode",
        default_value_t = DataReaderModeCli::Strict,
        value_enum
    )]
    pub reader_mode: DataReaderModeCli,

    #[arg(
        short = 's',
        long = "shapes",
        value_name = "INPUT",
        help = "Shapes graph: file, URI or -, if not set, it assumes the shapes come from the data"
    )]
    pub shapes: Option<InputSpec>,

    #[arg(
        short = 'f',
        long = "shapes-format",
        ignore_case = true,
        value_name = "FORMAT",
        help = "Shapes file format",
        default_value_t = ShaclFormatCli::Turtle
    )]
    pub shapes_format: ShaclFormatCli,

    #[arg(
        long = "base-shapes",
        value_name = "IRI",
        help = "Base IRI (used to resolve relative IRIs in Shapes)"
    )]
    pub base_shapes: Option<String>,

    /// Execution mode
    #[arg(
        short = 'm',
        long = "mode",
        value_name = "MODE",
        ignore_case = true,
        help = "Validation mode. `native` usually used with the in-memory store and \
                `sparql` is intended for remote SPARQL endpoints and Qlever.",
        default_value_t = ShaclValidationModeCli::Native,
        value_enum
    )]
    pub mode: ShaclValidationModeCli,

    #[arg(
        short = 'r',
        long = "result-format",
        ignore_case = true,
        value_name = "FORMAT",
        help = "Ouput result format",
        default_value_t = ResultShaclValidationFormatCli::Details
    )]
    pub result_format: ResultShaclValidationFormatCli,

    #[arg(
        long = "sort_by",
        value_name = "SORT_MODE",
        ignore_case = true,
        help = "Sort result by",
        default_value_t = ShaclValidationSortByModeCli::Severity,
        value_enum
    )]
    pub sort_by: ShaclValidationSortByModeCli,

    #[arg(
        long = "no-errors",
        help = "Don't retain violations in the validation report (default: violations are kept)"
    )]
    pub no_errors: bool,

    #[arg(
        long = "with-evidences",
        help = "Also retain evidence for why (node, shape) pairs conform (default: not kept)"
    )]
    pub with_evidences: bool,

    #[arg(
        long = "evidences-shapes-only",
        help = "With --with-evidences: keep only the per-shape summary (e.g. \"conforms to \
                :PersonShape\"), dropping the finer per-constraint-component evidence \
                (default: keep everything). No effect without --with-evidences."
    )]
    pub evidences_shapes_only: bool,

    #[arg(
        long = "recursion-semantics",
        value_name = "MODE",
        ignore_case = true,
        value_enum,
        help = "Whether to accept a shapes graph with a recursive (cyclic) shape reference, and \
                how to resolve it: `cautious` (default) accepts it and assumes a node caught in \
                the cycle does NOT conform unless proven otherwise; `brave` accepts it and \
                assumes such a node DOES conform as long as that's self-consistent; `none` \
                rejects it outright"
    )]
    pub recursion_semantics: Option<RecursionSemanticsCli>,

    #[command(flatten)]
    pub common: CommonArgsAll,
}