### Download Example Files
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/convert.md
Download necessary example files from the rudof GitHub repository to follow along with the conversion examples.
```shell
curl -o book.csv https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/dctap/book.csv
```
```shell
curl -o simple_shacl.ttl https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple_shacl.ttl
```
```shell
curl -o simple.shex https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple.shex
```
--------------------------------
### Install Rudof CLI (Ubuntu)
Source: https://context7.com/rudof-project/rudof/llms.txt
Installs the Rudof CLI binary on Ubuntu by downloading and installing a .deb package. Verify the installation using `rudof --version`.
```sh
wget https://github.com/rudof-project/rudof/releases/download/v0.2.18/rudof_v0.2.18_amd64.deb
sudo dpkg -i rudof_v0.2.18_amd64.deb
```
```sh
rudof --version
```
--------------------------------
### Copy Configuration Files
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
Commands to copy example configuration files to your working directory. Choose either the simple or comprehensive example.
```bash
# Copy the simple ready-to-use config
cp data_generator/examples/simple_config.toml my_config.toml
```
```bash
# Or copy the comprehensive example
cp data_generator/examples/config.toml my_config.toml
```
--------------------------------
### Download Example RDF File
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/node.md
Use curl to download the example RDF file for testing.
```sh
curl -o simple.ttl https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple.ttl
```
--------------------------------
### Install pyrudof
Source: https://github.com/rudof-project/rudof/wiki/(Python)-Invoking-rudof-from-Python
Install the pyrudof library using pip. This is the first step before using any of its functionalities.
```sh
pip install pyrudof
```
--------------------------------
### Common Use Case: Creating Documentation Examples
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Generate small, consistent examples for documentation by specifying a low entity count and a fixed seed.
```sh
rudof generate -s schema.shex -n 3 --seed 999 -o example.ttl
```
--------------------------------
### Check Rudof Installation
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/general/getting-started.md
Run this command to verify that Rudof has been installed successfully. It should execute without any errors.
```sh
rudof --version
```
--------------------------------
### Run Skipped Examples
Source: https://github.com/rudof-project/rudof/blob/master/python/README.md
Execute examples that are marked with `skip_test = true` in the manifest. This requires setting an environment variable.
```sh
# Linux/macOS
RUN_SKIPPED_EXAMPLES=1 python -m unittest test_examples -v
# Windows PowerShell
$env:RUN_SKIPPED_EXAMPLES="1"; python -m unittest test_examples -v
```
--------------------------------
### Build Release Wheel and Install
Source: https://github.com/rudof-project/rudof/blob/master/python/README.md
Build a release wheel for pyrudof and install it. This is an alternative to editable installs when preparing a release.
```sh
maturin build --release
pip install --force-reinstall target/wheels/pyrudof-*.whl
```
--------------------------------
### Install libssl-dev
Source: https://github.com/rudof-project/rudof/wiki/Publishing-new-versions
Installs the libssl-dev library required for building.
```bash
sudo apt install libssl-dev
```
--------------------------------
### Basic Configuration File Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
A TOML configuration file for advanced generation settings, demonstrating basic structure.
```toml
# Basic Configuration File
# Create a file called `generator_config.toml`:
```toml
```
--------------------------------
### Example Manifest Configuration (TOML)
Source: https://github.com/rudof-project/rudof/blob/master/python/README.md
Use this TOML structure to register new runnable examples. Specify the source file, title, description, category, and optionally referenced files, expected output, or test skipping.
```toml
[[example]]
key = "my_example"
source_file = "shex/my_example.py"
title = "My Example"
description = "What this example demonstrates"
category = "shex" # rdf | sparql | shex | shacl | dctap | endpoint | generate | utility
files = { data = "person.ttl" } # optional referenced files
expected_output = ["Alice"] # optional substrings (can be empty list)
# skip_test = true # optional (network/special runtime)
```
--------------------------------
### Example 1: Simple User Directory Generation
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Generate a simple user directory with 20 entities from a ShEx schema.
```sh
rudof generate -s users.shex -n 20 -o users.ttl
```
--------------------------------
### Install Pre-commit Hooks
Source: https://github.com/rudof-project/rudof/blob/master/README.md
Install the pre-commit tool and its hooks for local development to ensure code formatting and linting before commits.
```sh
# Installs pre-commit it self
pip install pre-commit
# Installs the pre-commit hooks defined in .pre-commit-config.yaml
pre-commit install
```
--------------------------------
### Check Java Installation
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/convert.md
Verify if Java 8 or higher is installed on your system, which is a prerequisite for PlantUML.
```shell
java --version
```
--------------------------------
### Download ShEx Schema
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/shex.md
Download the example `user.shex` schema file from GitHub.
```bash
curl -o user.shex https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/user.shex
```
--------------------------------
### Combined MCP Server Configuration Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/mcp.md
An example demonstrating how to combine multiple configuration options for the MCP server, including transport, bind address, port, route name, and allowed networks.
```sh
rudof mcp --transport streamable-http --bind 0.0.0.0 --port 8080 --route rdf --allowed-network 127.0.0.1 --allowed-network 192.168.1.0/24
```
--------------------------------
### Run a Single Example Test
Source: https://github.com/rudof-project/rudof/blob/master/python/README.md
Execute a single, specific example test case. Useful for debugging a particular test.
```sh
python -m unittest test_examples.TestShexExamples.test_shex_validate_inline -v
```
--------------------------------
### Rudof ShEx Configuration File Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/shex.md
Example TOML configuration file for ShEx settings, including options for showing extended shapes, imported schemas, and default schema format.
```toml
[shex]
show_extends = true
show_imports = true
shex_format = shexc
```
--------------------------------
### Download and Install rudof on Linux
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/general/installation.md
Download the pre-compiled binary for Linux and make it executable. Remember to replace 'vX.X.X' with the actual version number.
```sh
curl -o rudof https://github.com/rudof-project/rudof/releases/download/vX.X.X/rudof_vX.X.X_x86_64_linux_gnu
chmod +x rudof
```
--------------------------------
### Download and Install Debian Package
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/general/installation.md
Download the rudof Debian package and install it using dpkg. Replace 'vX.X.X' with the desired version.
```sh
curl -o rudof.deb https://github.com/rudof-project/rudof/releases/download/vX.X.X/rudof_vX.X.X_amd64.deb
sudo dpkg -i rudof.deb
```
--------------------------------
### Verify PGSchema Installation
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/docs/book/getting-started.html
Run this command in your terminal to verify that the PGSchema installation was successful and the tool is accessible.
```bash
pgschemapc --version
```
--------------------------------
### Install LLVM and Clang Libraries on Linux
Source: https://github.com/rudof-project/rudof/wiki/Compiling-the-project
Install the LLVM development library and Clang for SHACL validator dependencies on Linux systems.
```sh
apt install llvm-dev libclang-dev clang
```
--------------------------------
### Build PyRudof from Source
Source: https://github.com/rudof-project/rudof/blob/master/python/README.md
Build and install pyrudof from source. Requires a Rust toolchain and Python. Includes steps for cloning the repository, setting up a virtual environment, and installing dependencies.
```sh
# Clone the repository
git clone https://github.com/rudof-project/rudof.git
cd rudof/python
# Optional but recommended: virtual environment
python -m venv .venv
# Linux/macOS:
source .venv/bin/activate
# Windows PowerShell:
# .\.venv\Scripts\Activate.ps1
# Build and install editable package
pip install maturin
pip install -e .
```
--------------------------------
### Download Configuration File
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/convert.md
Download an example TOML configuration file for the DCTAP to ShEx conversion.
```shell
curl -o config.toml https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/dctap/book_converter_config.toml
```
--------------------------------
### Example 2: Course Enrollment System Generation
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Generate data for a course enrollment system with 50 entities from a SHACL schema in Turtle format.
```sh
rudof generate -s courses.ttl -n 50 -o enrollment_data.ttl
```
--------------------------------
### Download Example Files for Rudof
Source: https://context7.com/rudof-project/rudof/llms.txt
Use curl to download various example files required for Rudof operations, including CSV, TTL, Shex, and TOML configuration files.
```bash
curl -o book.csv https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/dctap/book.csv
```
```bash
curl -o simple_shacl.ttl https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple_shacl.ttl
```
```bash
curl -o simple.shex https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple.shex
```
```bash
curl -o config.toml https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/dctap/book_converter_config.toml
```
--------------------------------
### Example 3: Large Dataset Generation with Configuration
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Generate a large dataset of 5000 entities using a specific TOML configuration file.
```sh
rudof generate -s courses.ttl -c large_config.toml
```
--------------------------------
### Example Stats File
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
An example of the JSON stats file generated when `write_stats` is enabled, showing total triples, generation time, and shape counts.
```json
{
"total_triples": 245,
"generation_time": "89ms",
"shape_counts": {
"http://example.org/Person": 10,
"http://example.org/Course": 8
}
}
```
--------------------------------
### Download SHACL Example File
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/shacl.md
Use curl to download a sample SHACL shapes graph file from a URL.
```sh
curl -o simple_shacl.ttl https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple_shacl.ttl
```
--------------------------------
### Start MCP Server with Streamable HTTP Transport
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/mcp.md
Use this command to start the MCP server using the `streamable-http` transport protocol. This is an alternative to the default `stdio` transport.
```sh
rudof mcp --transport streamable-http
```
--------------------------------
### Build and Install Debian Package with cargo-deb
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/general/installation.md
Use cargo deb to build a Debian package and then install it using dpkg. Replace 'X.X.X' with the project version.
```sh
cargo deb
sudo dpkg -i target/debian/rudof_X.X.X_amd64.deb
```
--------------------------------
### Quick Start: Generate Data from SHACL Schema
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Generate 20 entities from a SHACL schema and save to data.ttl.
```sh
rudof generate -s examples/simple_shacl.ttl -n 20 -o data.ttl
```
--------------------------------
### DCTAP TOML Configuration Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/dctap.md
An example of a TOML configuration file for `rudof dctap`. This file customizes CSV parsing options like delimiter and picklist delimiter, and configures experimental property placeholders.
```toml
[dctap]
delimiter = ","
picklist_delimiter = " "
[property_placeholders.x.Stem]
stem = "pending"
[empty_property_placeholder.Stem]
stem = "empty"
```
--------------------------------
### Quick Start: Generate Data from ShEx Schema
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Generate 10 entities from a ShEx schema, automatically detecting the format and saving to data.ttl.
```sh
rudof generate -s examples/user.shex -o data.ttl
```
--------------------------------
### Get Rudof Version
Source: https://github.com/rudof-project/rudof/blob/master/python/docs/examples.md
Retrieve and print the current version of the Rudof library. This is a simple utility to check the installed version.
```python
from pyrudof import Rudof, RudofConfig
rudof = Rudof(RudofConfig())
print(f"Version: {rudof.get_version()}")
```
--------------------------------
### Install Cargo Workspaces
Source: https://github.com/rudof-project/rudof/blob/master/README.md
Install the 'cargo-workspaces' utility, which is used for managing and publishing Cargo workspaces. This command requires Cargo to be installed.
```sh
cargo install cargo-workspaces
```
--------------------------------
### Display Help Information
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
Show all available command-line options and their descriptions by using the --help flag.
```bash
data_generator --help
```
--------------------------------
### Using TOML and JSON Configuration Files
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
Examples of using configuration files in both TOML and JSON formats with different schema types (SHACL and ShEx). Demonstrates overriding configuration with command-line arguments.
```bash
# Use TOML configuration with any schema format
data_generator --config config.toml --schema schema_file
```
```bash
# Use JSON configuration with SHACL schema
data_generator --config config.json --schema schema.ttl
```
```bash
# Use JSON configuration with ShEx schema
data_generator --config config.json --schema schema.shex
```
```bash
# Override config with command line (works with both formats)
data_generator --config config.toml --schema schema_file --entities 5000 --output-file override.ttl
```
--------------------------------
### Install Cargo Deb Tool
Source: https://github.com/rudof-project/rudof/blob/master/README.md
Installs the cargo-deb tool, which is used to create .deb packages for Rust projects. This is a one-time installation.
```sh
cargo install cargo-deb
```
--------------------------------
### Initialize Theme and Sidebar
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/docs/book/pg.html
Sets up the initial theme and sidebar visibility based on local storage and system preferences.
```javascript
var path_to_root = ""; var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; try { var theme = localStorage.getItem('mdbook-theme'); var sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } var theme; try { theme = localStorage.getItem('mdbook-theme'); } catch (e) { } if (theme === null || theme === undefined) { theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } var html = document.querySelector('html'); html.classList.remove('light', 'dark') html.classList.add(theme); var body = document.querySelector('body'); body.classList.remove('no-js') body.classList.add('js'); var body = document.querySelector('body'); var sidebar = null; var sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch (e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; body.classList.remove('sidebar-visible'); body.classList.add("sidebar-" + sidebar);
```
--------------------------------
### Run Paper Examples Validation
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/README.md
Executes validation for examples from the associated paper by replacing `[EXAMPLE_NAME]` with the specific example identifier. This command is useful for testing and demonstrating the tool's functionality with predefined datasets.
```sh
pgschemapc validate --graph examples/[EXAMPLE_NAME].pg --schema examples/[EXAMPLE_NAME].pgs --map examples/[EXAMPLE_NAME].map
```
--------------------------------
### Conforming RDF Data Example
Source: https://github.com/rudof-project/rudof/wiki/(SHACL)-Validating-RDF-data-using-SHACL
An example of an RDF graph that conforms to the :UserShape SHACL shape.
```turtle
:alice a :User;
schema:name "Alice" ;
schema:gender schema:Female ;
schema:knows :bob .
:bob a :User;
schema:gender schema:Male ;
schema:name "Robert";
schema:birthDate "1980-03-10"^^xsd:date .
:carol a :User;
schema:name "Carol" ;
schema:gender schema:Female ;
foaf:name "Carol" .
```
--------------------------------
### Show Help Options
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
Displays all available command-line options for the data generator.
```bash
cargo run -p data_generator -- --help
```
--------------------------------
### Start rudof MCP server
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/mcp.md
Use this command to start the MCP server. By default, it uses the stdio transport.
```sh
rudof mcp
```
--------------------------------
### Create and Initialize PrefixMap
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/internals/crates/prefixmap.md
Demonstrates creating a new `PrefixMap` and initializing one from a `HashMap`. Ensure `HashMap` is imported if used.
```rust
use prefixmap::PrefixMap;
use std::collections::HashMap;
let mut prefix_map = PrefixMap::new();
let other_map = PrefixMap::from_hashmap(
HashMap::from([
("", "https://example.org/"),
("schema", "https://schema.org/")
])
)?;
```
--------------------------------
### Beginner Tip: Fixed Seeds for Reproducibility
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/generate.md
Use the `--seed` option to ensure the same data is generated every time, which is helpful for learning and debugging.
```sh
rudof generate -s my_schema.shex -n 100 --seed 42 -o test_data.ttl
```
--------------------------------
### Download rudof Binary for Windows
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/general/installation.md
Download the pre-compiled Windows binary. Replace 'vX.X.X' with the specific version you need.
```sh
curl -o rudof.exe https://github.com/rudof-project/rudof/releases/download/vX.X.X/rudof_vX.X.X_x86_64_windows_msvc.exe
```
--------------------------------
### Non-Stratified ShEx Schema Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/shex.md
An example of a ShEx schema that violates the stratified negation requirement, which can lead to errors during validation.
```shex
prefix :
:S {
:p NOT @:S +
}
```
--------------------------------
### Print pyrudof Module Info
Source: https://github.com/rudof-project/rudof/blob/master/python/docs/examples.md
Prints the file path of the installed pyrudof module. This can be useful for debugging or verifying the installation location.
```python
import pyrudof
print(pyrudof.__file__)
```
--------------------------------
### Rudof Facade API in Rust
Source: https://context7.com/rudof-project/rudof/llms.txt
Demonstrates initializing the Rudof facade, loading RDF data, performing ShEx and SHACL validations, running SPARQL queries, generating synthetic data, loading DCTAP schemas, and resetting the library's state. Ensure necessary imports are present.
```rust
use rudof_lib::{Rudof, RudofConfig};
use rudof_lib::formats::{
InputSpec, DataFormat, DataReaderMode, ShExFormat, ShapeMapFormat,
ShaclFormat, ShaclValidationSortByMode, ResultQueryFormat, QueryType,
DCTapFormat, GenerationSchemaFormat,
};
use std::str::FromStr;
// --- Initialize ---
let mut rudof = Rudof::new(RudofConfig::default());
// --- Load RDF data ---
let rdf_input = vec![InputSpec::from_str(
"prefix ex: . ex:alice a ex:Person ; ex:age 30 ."
).unwrap()];
rudof.load_data()
.with_data(&rdf_input)
.with_data_format(&DataFormat::Turtle)
.with_reader_mode(&DataReaderMode::Lax)
.execute().unwrap();
// --- ShEx validation ---
let schema_input = InputSpec::from_str(
"PREFIX xsd:
{ xsd:string ; xsd:integer }"
).unwrap();
rudof.load_shex_schema(&schema_input)
.with_shex_schema_format(&ShExFormat::ShExC)
.execute().unwrap();
rudof.validate_shex().execute().unwrap();
rudof.serialize_shex_validation_results(&mut std::io::stdout())
.execute().unwrap();
// --- SHACL validation ---
let shacl_input = InputSpec::from_str(
"prefix ex: . prefix sh: .
ex:PersonShape a sh:NodeShape ; sh:targetClass ex:Person ;
sh:property [ sh:path ex:name ; sh:datatype xsd:string ; sh:minCount 1 ] ."
).unwrap();
rudof.load_data()
.with_data(&[shacl_input])
.with_data_format(&DataFormat::Turtle)
.execute().unwrap();
rudof.load_shacl_shapes().execute().unwrap();
rudof.validate_shacl().execute().unwrap();
rudof.serialize_shacl_validation_results(&mut std::io::stdout())
.with_shacl_validation_sort_order_mode(&ShaclValidationSortByMode::Node)
.execute().unwrap();
// --- SPARQL query ---
let query_input = InputSpec::from_str(
"prefix schema: select ?s ?n where { ?s schema:name ?n }"
).unwrap();
rudof.load_query(&query_input)
.with_query_type(&QueryType::Select)
.execute().unwrap();
rudof.run_query().execute();
rudof.serialize_query_result(&mut std::io::stdout())
.with_result_query_format(&ResultQueryFormat::Csv)
.execute().unwrap();
// --- Generate synthetic data (async) ---
let gen_schema = InputSpec::from_str(
"prefix : :User { :name . }"
).unwrap();
rudof.generate_data(&gen_schema, &GenerationSchemaFormat::ShEx, 10)
.with_output(&mut std::io::stdout())
.with_parallel(4)
.with_seed(42)
.execute()
.await.unwrap();
// --- DCTAP loading ---
let dctap_input = InputSpec::from_str(
"shapeID,propertyID,mandatory\n:Person,schema:name,true"
).unwrap();
rudof.load_dctap(&dctap_input)
.with_dctap_format(&DCTapFormat::Csv)
.execute().unwrap();
rudof.serialize_dctap(&mut std::io::stdout()).execute().unwrap();
// --- Reset state ---
rudof.reset_shex().execute();
rudof.reset_shacl().execute();
rudof.reset_data().execute();
```
--------------------------------
### Install Rudof Debian Package
Source: https://github.com/rudof-project/rudof/blob/master/README.md
Installs the Rudof .deb package on Ubuntu systems. Replace X.X.X with the latest version number.
```sh
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
```
--------------------------------
### ShEx Schema Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/shex.md
An example of a ShEx schema defining a User shape with name, recursive knows relationship, and an optional status.
```shex
prefix :
prefix xsd:
prefix schema:
start = @:User
:User {
schema:name xsd:string ;
schema:knows @:User * ;
:status [ :Active :Waiting ] ? ;
}
```
--------------------------------
### Build Documentation Locally (Shell)
Source: https://github.com/rudof-project/rudof/blob/master/python/README.md
Commands to build the project documentation locally using Sphinx. Navigate to the docs directory and run the generation scripts, then serve the HTML output.
```sh
cd python/docs
python generate_examples_doc.py --update
python generate_examples_doc.py --check
python -m sphinx -b html . _build/html
```
--------------------------------
### Non-conforming RDF Data Example
Source: https://github.com/rudof-project/rudof/wiki/(SHACL)-Validating-RDF-data-using-SHACL
An example of an RDF graph that does not conform to the :UserShape SHACL shape, illustrating various validation failures.
```turtle
:dave a :User ;
schema:name "Dave";
schema:gender :Unknown ;
schema:birthDate 1980 ;
schema:knows :grace .
:emily a :User ;
schema:name "Emily", "Emilee";
schema:gender schema:Female .
:frank a :User ;
foaf:name "Frank" ;
schema:gender schema:Male .
_:x a :User;
schema:name "Unknown" ;
schema:gender schema:Male ;
schema:knows _:x .
```
--------------------------------
### Install Rudof .deb Package
Source: https://github.com/rudof-project/rudof/blob/master/README.md
Installs the generated Rudof .deb package on a Debian-based system. Replace the version number with the actual version.
```sh
sudo dpkg -i target/debian/rudof_0.0.11-1_amd64.deb
```
--------------------------------
### Turtle Data Example
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/shex.md
Example RDF data in Turtle format used for ShEx validation. Includes valid and potentially invalid entries.
```turtle
prefix :
prefix schema:
:a schema:name "Alice" ;
:status :Active ;
schema:knows :a, :b .
:b schema:name "Bob" ;
:status :Waiting ;
schema:knows :c .
:c schema:name "Carol" .
:d schema:name 23 . # Should fail
:e schema:name "Emily" ; # Should fail
schema:knows :d .
```
--------------------------------
### Navigate to Module Directory
Source: https://github.com/rudof-project/rudof/wiki/Run-the-benchmarks
Change the current directory to the specific module you want to benchmark. This is a prerequisite for running benchmarks.
```shell
cd shex_compact
```
--------------------------------
### PG-Schema_PC Command Line Help
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/README.md
Displays the available commands and options for the `pgschemapc` executable. Use this to understand the tool's capabilities.
```sh
pgschemapc --help
```
--------------------------------
### Rudof Compare CLI Help
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/compare.md
Displays the available options and usage for the rudof compare command. Use this to understand the parameters for schema comparison.
```bash
$ rudof compare --help
```
--------------------------------
### Example Property Graph Schema
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/docs/book/pgs.html
This is an example of a property graph schema definition using the pgs syntax. It demonstrates creating node types with properties and inheritance.
```sql
CREATE NODE TYPE ( PersonType : Person {
name: STRING,
OPTIONAL age: INTEGER
}) ;
CREATE NODE TYPE ( StudentType : Person & Student {
name: STRING,
OPTIONAL age: INTEGER
}) ;
CREATE NODE TYPE ( CourseType: Course {
name: STRING
})
```
--------------------------------
### Example Type Map Association
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/docs/book/map.html
This is an example of a type map association used for validation. It associates nodes with specific type names from the property graph schema.
```plaintext
n1:PersonType,
n2:StudentType,
n3:CourseType
```
--------------------------------
### Initialize and Run ShEx Test Suite
Source: https://github.com/rudof-project/rudof/blob/master/README.md
Initialize the git submodule for the ShEx test suite and run the default test suite.
```sh
git submodule update --init --recursive
cargo run -p shex_testsuite
```
--------------------------------
### Execute Data Generation with run_with_format and run
Source: https://github.com/rudof-project/rudof/blob/master/python/docs/examples.md
Shows how to initiate data generation using the DataGenerator. The `run_with_format` method allows specifying the schema format explicitly, while `run` infers it. Ensure schema files are accessible.
```python
from pathlib import Path
from tempfile import TemporaryDirectory
from pyrudof import DataGenerator, GeneratorConfig, OutputFormat, SchemaFormat
with TemporaryDirectory() as tmpdir:
tmp_path = Path(tmpdir)
out_with_format = tmp_path / "run_with_format.ttl"
config1 = GeneratorConfig()
config1.set_entity_count(1)
config1.set_output_path(str(out_with_format))
config1.set_output_format(OutputFormat.Turtle)
generator1 = DataGenerator(config1)
generator1.run_with_format("../../examples/simple.shex", SchemaFormat.ShEx)
out_auto = tmp_path / "run_auto.ttl"
config2 = GeneratorConfig()
config2.set_entity_count(1)
config2.set_output_path(str(out_auto))
config2.set_output_format(OutputFormat.Turtle)
generator2 = DataGenerator(config2)
generator2.run("../../examples/simple.shex")
```
--------------------------------
### Initialize Theme from Local Storage or System Preference
Source: https://github.com/rudof-project/rudof/blob/master/pgschema/docs/book/pg.html
Applies the theme (light or dark) to the HTML element based on local storage settings or the system's color scheme preference.
```javascript
window.playground_copyable = true; (function () { var theme = localStorage.getItem('mdbook-theme'); var html = document.querySelector('html'); if (theme) { html.setAttribute('data-theme', theme); html.setAttribute('data-color-scheme', theme); html.className = theme; } else { var systemPreference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; html.setAttribute('data-theme', systemPreference); html.setAttribute('data-color-scheme', systemPreference); html.className = systemPreference; } })();
```
--------------------------------
### Quick Run with Cargo
Source: https://github.com/rudof-project/rudof/wiki/Compiling-the-project
Execute the Rudof project for quick testing with specified options.
```sh
cargo run -- [options]
```
--------------------------------
### Example Statistics Output
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
This JSON object displays example statistics generated by Rudof when `write_stats` is enabled. It includes metrics like total triples, generation time, shape counts, and conformance data.
```json
{
"total_triples": 15248,
"generation_time": "497ms",
"shape_counts": {
"http://example.org/Person": 334,
"http://example.org/Organization": 333,
"http://example.org/Course": 333
},
"conformance_metrics": {
"total_generated_triples": 15248,
"valid_triples": 14991,
"triple_validity_percentage": 98.31,
"original_schema_constraints": 42,
"represented_constraints_in_unified": 38,
"shape_translation_loss_percentage": 9.52
}
}
```
--------------------------------
### Start rudof as an MCP Server
Source: https://context7.com/rudof-project/rudof/llms.txt
Starts rudof as a Model Context Protocol (MCP) server. Supports `stdio` (default) and `streamable-http` transports. For `streamable-http`, you can specify custom ports, routes, and network binding options.
```sh
# Start MCP server (stdio transport — default for AI assistant integration)
rudof mcp
```
```sh
# Start with streamable-http transport (port 8000 by default)
rudof mcp --transport streamable-http
```
```sh
# Custom port and route
rudof mcp --transport streamable-http --port 9000 --route rdfserver
```
```sh
# Bind to all interfaces with network restriction
rudof mcp --transport streamable-http --bind 0.0.0.0 --port 8080 \
--allowed-network 127.0.0.1 --allowed-network 192.168.1.0/24
```
--------------------------------
### Get Node Information from URL
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/cli_usage/node.md
Process RDF data directly from a dereferentiable URL.
```sh
rudof node -n :a https://raw.githubusercontent.com/rudof-project/rudof/refs/heads/master/examples/simple.ttl
```
--------------------------------
### List and Focus SPARQL Endpoints
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/internals/crates/rudof_lib.md
Demonstrates how to list registered SPARQL endpoints and focus on a specific endpoint for data loading. Requires `Rudof` and `RudofConfig` initialization.
```rust
use rudof_lib::{Rudof, RudofConfig};
let mut rudof = Rudof::new(RudofConfig::default());
// Lists the registered SPARQL endpoints
let endpoints = rudof.list_endpoints().execute();
for (name, url) in endpoints {
println!("{}, {}", name, url);
}
// Focus SPARQL endpoint
let endpoint = "http://example.org/sparql";
rudof.load_data()
.with_endpoint(&endpoint)
.execute()
.unwrap();
```
--------------------------------
### Sample Generated Output from ShEx
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
Example of RDF data generated conforming to the provided ShEx schema.
```turtle
a ;
"Fiona Rodriguez" .
a ;
"Computer Science" .
```
--------------------------------
### Load Data with Rudof
Source: https://github.com/rudof-project/rudof/wiki/(Python)-Invoking-rudof-from-Python
Initialize Rudof and load data from files. Ensure the file paths are correct and the files exist.
```python3
from pyrudof import Rudof, RudofConfig
rudof = Rudof(RudofConfig())
with open('path/to/data.file') as fd_data:
rudof.read_data_str(f_data.read())
with open('path/to/shapes.file') as fd_shapes:
rudof.read_data_str(f_shacl.read())
```
--------------------------------
### Sample Generated Output from SHACL
Source: https://github.com/rudof-project/rudof/blob/master/rudof_generate/README.md
Example of RDF data generated conforming to the provided SHACL schema.
```turtle
"Diana Jones" ;
;
"1971-03-12"^^ ;
a .
"Advanced Mathematics" ;
a .
```
--------------------------------
### Initialize Rudof and Get Version
Source: https://github.com/rudof-project/rudof/blob/master/docs/src/internals/crates/rudof_lib.md
Demonstrates initializing the `Rudof` struct with default configuration and retrieving its version. The `Rudof` instance acts as the primary interface for all library operations.
```rust
use rudof_lib::{Rudof, RudofConfig};
// Initialize Rudof with default config
let mut rudof = Rudof::new(RudofConfig::default());
// Get the current version
let version = rudof.version().execute();
println!("Rudof version: {}", version);
// Update the configuration
rudof.update_config(RudofConfig::default());
// Reset all internal state
rudof.reset_all().execute();
```
--------------------------------
### Check Java Version
Source: https://github.com/rudof-project/rudof/wiki/(DCTap-→-SVG-PNG)-Convert-a-CSV-file-in-DCTap-to-an-UML‐like-visualization-in-SVG-PNG-...
Verify if Java is installed and meets the minimum version requirement (Java 8) for PlantUML.
```sh
java -version
```