Skip to main content

shacl_ir/components/
less_than_or_equals.rs

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