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
75
76
77
78
79
80
81
82
use crate::{
Result,
api::conversion::implementations::show_schema_conversion,
formats::{
ConversionFormat, ConversionMode, DataReaderMode, InputSpec, ResultConversionFormat, ResultConversionMode,
},
};
use std::io;
/// Conversion operations
pub trait ConversionOperations {
/// Converts a schema from one format to another.
///
/// # Arguments
///
/// * `schema` - Input specification defining the schema source
/// * `base` - Optional base IRI for resolving relative IRIs (uses default if None)
/// * `reader_mode` - Optional parsing mode used to read the schema (uses default if None)
/// * `input_mode` - The conversion mode for interpreting the input schema
/// * `output_mode` - The conversion mode for generating the output schema
/// * `input_format` - Format of the input schema
/// * `output_format` - Format of the output schema
/// * `shape` - Optional shape identifier to focus the conversion on a specific shape
/// * `show_time` - Whether to include timing information in the conversion output (false by default)
/// * `templates_folder` - Optional path to a folder containing templates for conversion (if applicable)
/// * `output_folder` - Optional path to a folder where output files should be written
/// * `writer` - The destination to write the converted schema to
///
/// # Errors
///
/// Returns an error if the schema cannot be loaded, converted, or serialized.
#[allow(clippy::too_many_arguments)]
fn show_schema_conversion<W: io::Write>(
&mut self,
schema: &InputSpec,
base: Option<&str>,
reader_mode: Option<&DataReaderMode>,
input_mode: &ConversionMode,
output_mode: &ResultConversionMode,
input_format: &ConversionFormat,
output_format: &ResultConversionFormat,
shape: Option<&str>,
show_time: Option<bool>,
templates_folder: Option<&std::path::Path>,
output_folder: Option<&std::path::Path>,
writer: &mut W,
) -> Result<()>;
}
impl ConversionOperations for crate::Rudof {
fn show_schema_conversion<W: io::Write>(
&mut self,
schema: &InputSpec,
base: Option<&str>,
reader_mode: Option<&DataReaderMode>,
input_mode: &ConversionMode,
output_mode: &ResultConversionMode,
input_format: &ConversionFormat,
output_format: &ResultConversionFormat,
shape: Option<&str>,
show_time: Option<bool>,
templates_folder: Option<&std::path::Path>,
output_folder: Option<&std::path::Path>,
writer: &mut W,
) -> Result<()> {
show_schema_conversion(
self,
schema,
base,
reader_mode,
input_mode,
output_mode,
input_format,
output_format,
shape,
show_time,
templates_folder,
output_folder,
writer,
)
}
}