Skip to main content

shacl_ir/components/
closed.rs

1use iri_s::IriS;
2
3/// Closed Constraint Component.
4///
5/// The RDF data model offers a huge amount of flexibility. Any node can in
6/// principle have values for any property. However, in some cases it makes
7/// sense to specify conditions on which properties can be applied to nodes.
8/// The SHACL Core language includes a property called sh:closed that can be
9/// used to specify the condition that each value node has values only for
10/// those properties that have been explicitly enumerated via the property
11/// shapes specified for the shape via sh:property.
12///
13/// https://www.w3.org/TR/shacl/#ClosedConstraintComponent
14#[derive(Debug, Clone)]
15pub struct Closed {
16    is_closed: bool,
17    ignored_properties: Vec<IriS>,
18}
19
20impl Closed {
21    pub fn new(is_closed: bool, ignored_properties: Vec<IriS>) -> Self {
22        Closed {
23            is_closed,
24            ignored_properties,
25        }
26    }
27
28    pub fn is_closed(&self) -> bool {
29        self.is_closed
30    }
31
32    pub fn ignored_properties(&self) -> &Vec<IriS> {
33        &self.ignored_properties
34    }
35}