This repo contains an RDF data shapes library implemented in Rust. The implementation supports ShEx, SHACL, DCTap and conversions between different RDF data modeling formalisms.
The code can be used as a Rust library but it also contains a binary called rudof
which can be used as an RDF playground.
We provide binaries for Linux, Windows, Mac and Docker (see releases), as well as Python bindings.
You can download a binary from the latest release page. There you will also find the compiled packages for the installation on your system using a package manager.
Download the binary from [https://github.com/rudof-project/rudof/releases] and install the .deb
package running the following commands after replacing X.X.X by the latest version:
wget https://github.com/rudof-project/rudof/releases/download/vX.X.X/rudof_vX.X.X_amd64.deb
sudo dpkg -i rudof_vX.X.X_amd64.deb
The binary can be downloaded from [https://github.com/rudof-project/rudof/releases]
The binary is available at: [https://github.com/rudof-project/rudof/releases] so you can download the corresponding binary to your machine.
The usual way to run/install a binary in Mac is to download it in a folder, add that folder to your PATH and activating the binary using:
chmod +x <binary_file>
After that, the processor may complain the first time about security and you have to agree to use it. Once you agree, it should work.
The folder examples
contains several example files with ShEx schemas and RDF data.
rudof validate --data examples/user.ttl --schema examples/user.shex --shapemap examples/user.sm
We maintain a Wiki page with some common Usage scenarios and How-to guides.
It is possible to change the debug level information with:
export RUST_LOG=value
where value
can be debug
to show more verbose information or info
to show basic information.
RDF Data shapes implementation in Rust
Usage: rudof [OPTIONS] [COMMAND]
Commands:
shapemap Information about ShEx shapemaps
shex Information about ShEx schemas
validate RDF Validation using ShEx or SHACL
shex-validate RDF Validation using ShEx schemas
shacl-validate RDF Validation using SHACL shapes
data Information about RDF data
node Information about RDF nodes which are part of RDF Graphs
shacl Information about SHACL shapes
dctap Information and processing of DCTAP files
convert Conversion between different Data modeling technologies
help Print this message or the help of the given subcommand(s)
Options:
-d, --debug...
-h, --help Print help (see more with '--help')
-V, --version Print version
$ rudof shex --help
Information about ShEx schemas
Usage: rudof shex [OPTIONS] --schema <Schema file name>
Options:
-s, --schema <Schema file name>
-f, --format <Schema format>
[default: shexc] [possible values: internal, shexc, shexj, turtle, ntriples, rdfxml, trig, n3, nquads]
-r, --result-format <Result schema format>
[default: shexj] [possible values: internal, shexc, shexj, turtle, ntriples, rdfxml, trig, n3, nquads]
-t, --show elapsed time
--statistics
-o, --output-file <Output file name, default = terminal>
-h, --help
Print help
$ rudof data --help
Information about RDF data
Usage: rudof data [OPTIONS] --data <RDF data path>
Options:
-d, --data <RDF data path>
-t, --data-format <RDF Data format>
[default: turtle] [possible values: turtle, ntriples, rdfxml, trig, n3, nquads]
-o, --output-file <Output file name, default = terminal>
-h, --help
Print help
This command can be useful to obtain the neighbourhood of a node.
$ rudof node --help
Information about RDF nodes which are part of RDF Graphs
Usage: rudof node [OPTIONS] --node <NODE>
Options:
-n, --node <NODE>
-d, --data <RDF data path>
-t, --data-format <RDF Data format>
[default: turtle] [possible values: turtle, ntriples, rdfxml, trig, n3, nquads]
-e, --endpoint <Endpoint with RDF data>
-m, --show-node-mode <Show Node Mode>
[default: outgoing] [possible values: outgoing, incoming, both]
--show hyperlinks
-p, --predicates <PREDICATES>
-o, --output-file <Output file name, default = terminal>
-h, --help
Print help
For example, the following command shows the neighbourhood of node wd:Q80
in the Wikidata endpoint.
rudof node -e wikidata -n wd:Q80
$ rudof validate --help
RDF Validation using ShEx or SHACL
Usage: rudof validate [OPTIONS] --schema <Schema file name>
Options:
-M, --mode <Validation mode>
[default: shex] [possible values: shex, shacl]
-s, --schema <Schema file name>
-f, --schema-format <Schema format>
[default: shexc] [possible values: internal, shexc, shexj, turtle, ntriples, rdfxml, trig, n3, nquads]
-m, --shapemap <ShapeMap file name>
--shapemap-format <ShapeMap format>
[default: compact] [possible values: compact, internal]
-n, --node <NODE>
-l, --shape-label <shape label (default = START)>
-d, --data <RDF data path>
-t, --data-format <RDF Data format>
[default: turtle] [possible values: turtle, ntriples, rdfxml, trig, n3, nquads]
-e, --endpoint <Endpoint with RDF data>
--max-steps <max steps to run>
[default: 100]
-o, --output-file <Output file name, default = terminal>
-h, --help
Print help
Example: Assuming there a ShEx file in examples/user.shex
and an RDF turtle file in examples/user.ttl
we can ask to validate node :a
with shape label :User
using:
rudof validate -s examples/user.shex -d examples/user.ttl -n :a -l :User
If there is a shapemap in examples/user.sm
, we can validate using:
rudof validate -s examples/user.shex -d examples/user.ttl -m examples/user.sm
rudof shacl-validate --shapes examples/simple_shacl.ttl examples/simple.ttl
$ rudof convert --help
Conversion between different Data modeling technologies
Usage: rudof convert [OPTIONS] --input-mode <Input mode> --source-file <Source file name> --export-mode <Result mode>
Options:
-m, --input-mode <Input mode>
[possible values: shex, dctap]
-s, --source-file <Source file name>
-f, --format <Input file format>
[default: shexc] [possible values: csv, shexc, shexj, turtle]
-r, --result-format <Result format>
[default: default] [possible values: default, internal, json, shexc, shexj, turtle, plantuml, html, svg, png]
-o, --output-file <Output file name, default = terminal>
-t, --target-folder <Target folder>
-l, --shape-label <shape label (default = START)>
-x, --export-mode <Result mode>
[possible values: sparql, shex, uml, html]
-h, --help
Print help
The repo is divided in the following modules:
cargo workspaces publish
The project is using cargo workspaces wihch can be installed with:
cargo install cargo-workspaces
In order to test all the sub-projects
cargo test --all
Testing one specific subproject:
cargo test -p shex_validation
The ShEx testsuite is included in a git submodule. In order to obtain it, it is necessary to do:
git submodule update --init --recursive
cargo run -p shex_testsuite
Usage: shex_testsuite [OPTIONS]
Options:
-m, --manifest <Manifest FILE (.jsonld)>
Name of Manifest file [default: shex_testsuite/shexTest/validation/manifest.jsonld]
-c, --config <Config file>
[default: shex_testsuite/config.yml]
-x, --run_mode <MANIFEST_RUN_MODE>
[default: collect-errors] [possible values: collect-errors, fail-first-error]
-f, --manifest_mode <MANIFEST_MODE>
[possible values: schemas, validation, negative-syntax, negative-structure]
-p, --print_result_mode <PRINT_RESULT_MODE>
[default: basic] [possible values: basic, failed, passed, not-implemented, all]
-e, --entry <Entry names>
-t, --trait <Trait names>
-h, --help
Print help
-V, --version
Print version
cargo run -p shex_testsuite -- -m shex_testsuite/shexTest/validation/manifest.jsonld validation
cargo run -p shex_testsuite -- -m shex_testsuite/shexTest/schemas/manifest.jsonld -f schemas -p failed
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.