owl2shacl 0.2.0

A CLI tool that tries to convert simple OWL ontologies into SHACL shapes. OWL ontologies define logical relationships. SHACL shapes define a data scheme, and allow to validate data against them. Strictly speaking, as these are different things, such a conversion is thus illegal/wrong in the ideological/theoretical sense. Thus this tool is not generally applicable, but only under the circumstance, that the OWL ontology is actually written as a data specification - if it is understood as a kind of distributed database schema, rather then for logical inference. Not only that, but it also has to conform to certain, very narrow rules, and only a few basic properties are translated into SHACL; the rest is ignored.
// SPDX-FileCopyrightText: 2023 - 2024 Robin Vobruba <hoijui.quaero@gmail.com>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

mod cli;
mod config;
mod convert;
mod vocab;

use cli_utils::{logging, BoxResult};

use git_version::git_version;
use tracing::metadata::LevelFilter;

// This tests rust code in the README with doc-tests.
// Though, It will not appear in the generated documentation.
#[doc = include_str!("../README.md")]
#[cfg(doctest)]
pub struct ReadmeDoctests;

pub const VERSION: &str = git_version!(cargo_prefix = "", fallback = "unknown");

fn main() -> BoxResult<()> {
    let log_reload_handle = logging::setup(clap::crate_name!())?;

    let cli_args = cli::parse()?;

    if cli_args.verbose {
        logging::set_log_level_tracing(&log_reload_handle, LevelFilter::DEBUG)?;
    } else if cli_args.quiet {
        logging::set_log_level_tracing(&log_reload_handle, LevelFilter::WARN)?;
    } else {
        logging::set_log_level_tracing(&log_reload_handle, LevelFilter::INFO)?;
    }

    convert::convert(&cli_args.config)
}