Skip to main content

shacl_ir/components/
has_value.rs

1use rudof_rdf::rdf_core::term::Object;
2use std::fmt::Display;
3
4/// sh:hasValue specifies the condition that at least one value node is equal to
5///  the given RDF term.
6///
7/// https://www.w3.org/TR/shacl/#HasValueConstraintComponent
8#[derive(Debug, Clone)]
9pub struct HasValue {
10    value: Object,
11}
12
13impl HasValue {
14    pub fn new(value: Object) -> Self {
15        HasValue { value }
16    }
17
18    pub fn value(&self) -> &Object {
19        &self.value
20    }
21}
22
23impl Display for HasValue {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        write!(f, "HasValue: {}", self.value())
26    }
27}