shacl_ir/components/unique_lang.rs
1use std::fmt::Display;
2
3/// The property sh:uniqueLang can be set to true to specify that no pair of
4/// value nodes may use the same language tag.
5///
6/// https://www.w3.org/TR/shacl/#UniqueLangConstraintComponent
7#[derive(Debug, Clone)]
8pub struct UniqueLang {
9 unique_lang: bool,
10}
11
12impl UniqueLang {
13 pub fn new(unique_lang: bool) -> Self {
14 UniqueLang { unique_lang }
15 }
16
17 pub fn unique_lang(&self) -> bool {
18 self.unique_lang
19 }
20}
21
22impl Display for UniqueLang {
23 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24 write!(f, "UniqueLang: {}", self.unique_lang())
25 }
26}