Skip to content

Commit

Permalink
Added some explanation to convert.md
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Dec 28, 2024
1 parent cd72642 commit 2327449
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
21 changes: 18 additions & 3 deletions docs/src/cli_usage/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions examples/config/data_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rdf_data:
base: http://example.org/
2 changes: 2 additions & 0 deletions examples/config/shacl_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rdf_data:
base: http://example.org/
5 changes: 4 additions & 1 deletion rudof_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ where
fn run_data(
data: &Vec<InputSpec>,
data_format: &DataFormat,
_debug: u8,
debug: u8,
output: &Option<PathBuf>,
result_format: &DataFormat,
force_overwrite: bool,
Expand All @@ -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)?;
Expand Down

0 comments on commit 2327449

Please sign in to comment.