Skip to main content

shacl_ir/components/
less_than.rs

1use iri_s::IriS;
2use std::fmt::Display;
3
4/// sh:lessThan specifies the condition that each value node is smaller than all
5/// the objects of the triples that have the focus node as subject and the
6/// value of sh:lessThan as predicate.
7///
8/// https://www.w3.org/TR/shacl/#LessThanConstraintComponent
9#[derive(Debug, Clone)]
10pub struct LessThan {
11    iri: IriS,
12}
13
14impl LessThan {
15    pub fn new(iri: IriS) -> Self {
16        LessThan { iri }
17    }
18
19    pub fn iri(&self) -> &IriS {
20        &self.iri
21    }
22}
23
24impl Display for LessThan {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        write!(f, "LessThan: {}", self.iri())
27    }
28}