#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Path {
Forward(&'static str),
Inverse(&'static str),
Alternative(&'static [AltBranch]),
Chain(&'static [Step]),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Step {
Forward(&'static str),
Inverse(&'static str),
Type,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AltBranch {
Forward(&'static str),
Inverse(&'static str),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NodeKind {
Iri,
Literal,
BlankNode,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Constraint {
MinCount(u32),
MaxCount(u32),
Datatype(&'static str),
NodeKind(NodeKind),
Class(&'static [&'static str]),
In(&'static [&'static str]),
HasValue(&'static str),
MaxLength(u32),
MinLength(u32),
RefClass(&'static [&'static str]),
MinInclusive(f64),
MaxInclusive(f64),
MinExclusive(f64),
MaxExclusive(f64),
LessThan(&'static str),
LessThanOrEquals(&'static str),
NotClass(&'static [&'static str]),
QualifiedIn { allowed: &'static [&'static str], min: u32 },
Length(u32),
}
#[derive(Debug)]
pub struct Check {
pub constraint: Constraint,
pub rule_id: &'static str,
pub name: &'static str,
pub message: &'static str,
pub description: &'static str,
pub severity: &'static str,
}
#[derive(Debug)]
pub struct PropShape {
pub path: Path,
pub checks: &'static [Check],
}
#[derive(Debug)]
pub enum Target {
Class(&'static [&'static str]),
SubjectsOf(&'static str),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LogicOp {
And,
Or,
Xone,
}
#[derive(Debug)]
pub struct Branch {
pub props: &'static [PropShape],
pub negate: bool,
}
#[derive(Debug)]
pub struct Logic {
pub op: LogicOp,
pub branches: &'static [Branch],
pub rule_id: &'static str,
pub name: &'static str,
pub message: &'static str,
pub description: &'static str,
pub severity: &'static str,
}
#[derive(Debug)]
pub struct ShapeDef {
pub targets: &'static [Target],
pub props: &'static [&'static PropShape],
pub closed: Option<&'static ClosedShape>,
pub logic: &'static [Logic],
pub profiles: &'static [&'static str],
pub file: &'static str,
}
#[derive(Debug)]
pub struct ClosedShape {
pub allowed: &'static [&'static str],
pub rule_id: &'static str,
pub name: &'static str,
pub message: &'static str,
pub description: &'static str,
pub severity: &'static str,
}