#![warn(missing_docs)]
mod construct;
mod detect;
mod rules;
pub mod scanner;
use ontologos_core::Ontology;
use serde::{Deserialize, Serialize};
use thiserror::Error;
pub use construct::OwlConstruct;
pub use detect::detect_profile;
pub use rules::{el_classification_forbidden_in, el_diagnostics, el_forbidden_in, satisfies_el};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("profile detection failed: {0}")]
Message(String),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum OwlProfile {
El,
Rl,
Ql,
Dl,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProfileDiagnostic {
pub construct: String,
pub message: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProfileReport {
pub detected: Option<OwlProfile>,
pub diagnostics: Vec<ProfileDiagnostic>,
}
#[must_use]
pub fn profile_from_ontology(ontology: &Ontology) -> Option<OwlProfile> {
detect_profile(ontology).ok().and_then(|r| r.detected)
}