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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use crate::{
Result, Rudof,
api::shex::ShExOperations,
formats::{InputSpec, ShapeMapFormat},
};
/// Builder for `load_shapemap` operation.
///
/// Provides a fluent interface for configuring and executing shape map loading
/// operations with optional parameters.
pub struct LoadShapemapBuilder<'a> {
rudof: &'a mut Rudof,
shapemap: &'a InputSpec,
shapemap_format: Option<&'a ShapeMapFormat>,
base_nodes: Option<&'a str>,
base_shapes: Option<&'a str>,
}
impl<'a> LoadShapemapBuilder<'a> {
/// Creates a new builder instance.
///
/// This is called internally by `Rudof::load_shapemap()` and should not
/// be constructed directly.
pub(crate) fn new(rudof: &'a mut Rudof, shapemap: &'a InputSpec) -> Self {
Self {
rudof,
shapemap,
shapemap_format: None,
base_nodes: None,
base_shapes: None,
}
}
/// Sets the shape map format.
///
/// # Arguments
///
/// * `shapemap_format` - The format to use when loading the shape map
pub fn with_shapemap_format(mut self, shapemap_format: &'a ShapeMapFormat) -> Self {
self.shapemap_format = Some(shapemap_format);
self
}
/// Sets the base IRI for resolving node IRIs.
///
/// # Arguments
///
/// * `base_nodes` - The base IRI for node resolution
pub fn with_base_nodes(mut self, base_nodes: &'a str) -> Self {
self.base_nodes = Some(base_nodes);
self
}
/// Sets the base IRI for resolving shape IRIs.
///
/// # Arguments
///
/// * `base_shapes` - The base IRI for shape resolution
pub fn with_base_shapes(mut self, base_shapes: &'a str) -> Self {
self.base_shapes = Some(base_shapes);
self
}
/// Executes the shape map loading operation with the configured parameters.
pub fn execute(self) -> Result<()> {
<Rudof as ShExOperations>::load_shapemap(
self.rudof,
self.shapemap,
self.shapemap_format,
self.base_nodes,
self.base_shapes,
)
}
}