diff --git a/docs/src/cli_usage/convert.md b/docs/src/cli_usage/convert.md index 32f74d47..55486334 100644 --- a/docs/src/cli_usage/convert.md +++ b/docs/src/cli_usage/convert.md @@ -115,14 +115,29 @@ TBD ### From SHACL to ShEx -A possible conversion among RDF data modelling technologies includes the conversion from a simple SHACL shapes graph to ShEx schemas. -For users to do so, one can use the instructions below. +It is possible to convert between a subset of SHACL shapes to ShEx schemas. +As an example, the following command: ```sh rudof convert -m shacl -x shex -s simple_shacl.ttl -f turtle -o simple.shex ``` -> The converter only works for a subset of SHACL. We should still document what are the features supported and the features that are not yet supported but this is still work in progress. +> The converter only works for a subset of SHACL. This is a work-in-progress feature and [the following issue](https://github.com/rudof-project/rudof/issues/127) is expected to document the subset of SHACL supported. + +### Specifying base IRI to handle relative IRIs + +If the RDF data contains relative IRIs, it is necessary to resolve them by specifying a base IRI. It can be done by providing a base declaration in the `rdf_data` entry of the configuration file. For example, assuming the configuration file contains `examples/config/data_config.yaml` + +```yaml +rdf_data: + base: http://example.org/ +``` + +it is possible to specify the conversion as: + +```sh +rudof convert -m shacl -x shex -s simple_shacl.ttl -f turtle -o simple.shex -c examples/config/data_config.yml +``` ## From ShEx diff --git a/examples/config/data_config.yml b/examples/config/data_config.yml new file mode 100644 index 00000000..6fe7e167 --- /dev/null +++ b/examples/config/data_config.yml @@ -0,0 +1,2 @@ +rdf_data: + base: http://example.org/ \ No newline at end of file diff --git a/examples/config/shacl_config.yml b/examples/config/shacl_config.yml new file mode 100644 index 00000000..6fe7e167 --- /dev/null +++ b/examples/config/shacl_config.yml @@ -0,0 +1,2 @@ +rdf_data: + base: http://example.org/ \ No newline at end of file diff --git a/rudof_cli/src/main.rs b/rudof_cli/src/main.rs index d4d7234e..92709b83 100755 --- a/rudof_cli/src/main.rs +++ b/rudof_cli/src/main.rs @@ -1335,7 +1335,7 @@ where fn run_data( data: &Vec, data_format: &DataFormat, - _debug: u8, + debug: u8, output: &Option, result_format: &DataFormat, force_overwrite: bool, @@ -1344,6 +1344,9 @@ fn run_data( ) -> Result<()> { let (mut writer, _color) = get_writer(output, force_overwrite)?; let mut rudof = Rudof::new(config); + if debug > 0 { + println!("Config: {config:?}") + } get_data_rudof(&mut rudof, data, data_format, &None, reader_mode, config)?; let format: RDFFormat = RDFFormat::from(*result_format); rudof.get_rdf_data().serialize(&format, &mut writer)?;