shacl 0.3.1

A SHACL validator for RDF data, implemented in Rust.
Documentation
//! SHACL IR (Internal Representation)
//! Represents SHACL Internal representation which is used for validation

use crate::ir::error::IRError;
use crate::types::Value;
use prefixmap::IriRef;
use rudof_iri::IriS;
use rudof_rdf::rdf_core::term::Object;

mod component;
pub mod components;
pub mod dg;
pub(crate) mod error;
mod node_shape;
mod property_shape;
mod reifier_info;
mod schema;
mod shape;
mod shape_label_idx;
mod test;

pub use component::IRComponent;
pub use node_shape::IRNodeShape;
pub use property_shape::IRPropertyShape;
pub use reifier_info::ReifierInfo;
pub use schema::IRSchema;
pub use shape::IRShape;
pub use shape_label_idx::ShapeLabelIdx;

fn convert_iri_ref(iri_ref: IriRef) -> Result<IriS, IRError> {
    let iri = iri_ref.get_iri()?;

    Ok(iri.clone())
}

fn convert_value(value: Value) -> Result<Object, IRError> {
    let out = match value {
        Value::Iri(iri_ref) => Object::Iri(convert_iri_ref(iri_ref)?),
        Value::Literal(lit) => Object::literal(lit),
    };

    Ok(out)
}