shapes_converter/shacl_to_shex/
shacl2shex_error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use shacl_ast::node_shape::NodeShape;
use srdf::literal::Literal;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Shacl2ShExError {
    #[error("Shacl2ShEx error: Feature not implemented: {msg}")]
    NotImplemented { msg: String },

    #[error("Shacl2ShEx error: Feature not implemented: {literal}")]
    RDFNode2LabelLiteral { literal: Literal },

    #[error("Not expected node shape: {node_shape:?}")]
    NotExpectedNodeShape { node_shape: Box<NodeShape> },

    #[error("Unexpected blank node in target class declaration: {bnode:?}")]
    UnexpectedBlankNodeForTargetClass { bnode: String },

    #[error("Unexpected literal in target class declaration: {literal:?}")]
    UnexpectedLiteralForTargetClass { literal: Literal },
}

impl Shacl2ShExError {
    pub fn not_implemented(msg: &str) -> Shacl2ShExError {
        Shacl2ShExError::NotImplemented {
            msg: msg.to_string(),
        }
    }
}