1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crate::{Result, Rudof, api::shex::ShExOperations};
pub struct CheckShexSchemaBuilder<'a, W: std::io::Write> {
rudof: &'a crate::Rudof,
schema: &'a crate::formats::InputSpec,
schema_format: Option<&'a crate::formats::ShExFormat>,
base_schema: Option<&'a str>,
writer: &'a mut W,
}
impl<'a, W: std::io::Write> CheckShexSchemaBuilder<'a, W> {
/// Creates a new builder instance.
///
/// This is called internally by `Rudof::check_shex_schema()` and should not
/// be constructed directly.
pub(crate) fn new(rudof: &'a crate::Rudof, schema: &'a crate::formats::InputSpec, writer: &'a mut W) -> Self {
Self {
rudof,
schema,
schema_format: None,
base_schema: None,
writer,
}
}
/// Sets the ShEx schema format.
///
/// # Arguments
///
/// * `schema_format` - The format to use when checking the schema
pub fn with_shex_schema_format(mut self, schema_format: &'a crate::formats::ShExFormat) -> Self {
self.schema_format = Some(schema_format);
self
}
/// Sets the base IRI for resolving relative IRIs in the schema.
///
/// # Arguments
///
/// * `base_schema` - The base IRI to use for resolution
pub fn with_base(mut self, base_schema: &'a str) -> Self {
self.base_schema = Some(base_schema);
self
}
/// Executes the schema checking operation with the configured parameters.
pub fn execute(self) -> Result<bool> {
<Rudof as ShExOperations>::check_shex_schema(
self.rudof,
self.schema,
self.schema_format,
self.base_schema,
self.writer,
)
}
}