Rust

rudof is a set of Rust crates. Most programs need only rudof_lib. It gives one entry point, the Rudof struct, to all the features of the command line tool.

Installation

cargo add rudof_lib

RDF data, ShEx, SHACL and SPARQL are always available. The other subsystems are Cargo features, so that you can make smaller builds, for example for WebAssembly. The rudof_lib README lists the features.

How the API works

Each operation starts with a method call on a Rudof instance. The method returns a builder for the operation. You chain options on the builder, and then call .execute().

#![allow(unused)]
fn main() {
use rudof_lib::{Rudof, RudofConfig};
use rudof_lib::formats::{InputSpec, ShExFormat, ResultShExValidationFormat};
use std::str::FromStr;

let mut rudof = Rudof::new(RudofConfig::default());

let data = vec![InputSpec::from_str(r#"
    prefix : <http://example.org/>
    :alice :name "Alice" .
"#)?];
rudof.load_data().with_data(&data).execute()?;

let schema = InputSpec::from_str(r#"
    prefix : <http://example.org/>
    prefix xsd: <http://www.w3.org/2001/XMLSchema#>
    :Person { :name xsd:string }
"#)?;
rudof.load_shex_schema(&schema).with_shex_schema_format(&ShExFormat::ShExC).execute()?;

let shapemap = InputSpec::from_str("<http://example.org/alice>@<http://example.org/Person>")?;
rudof.load_shapemap(&shapemap).execute()?;
rudof.validate_shex().execute()?;

rudof.serialize_shex_validation_results(&mut std::io::stdout())
    .with_result_shex_validation_format(&ResultShExValidationFormat::Compact)
    .execute()?;
}

An InputSpec is inline content, a file path or a URL.

Topics

PageContent
Core and session stateCreate a Rudof instance, change the configuration, reset the state.
DataLoad, inspect, change, stage and compare RDF data. Endpoints and service descriptions.
ShExValidate with ShEx. ShExPath, precompiled schemas and external shapes.
SHACLValidate with SHACL.
Property graphsPG-Schema validation and the embedded property graph database.
SPARQL queriesRun SPARQL queries.
Conversion and comparisonConvert and compare schemas. DCTAP and rdf-config.
Data generation and materializationGenerate synthetic data, and build RDF from Map semantic actions.
Low-level RDFThe rudof_rdf traits, backends and parser combinators.

Crates

All crates are on crates.io, and their API reference is on docs.rs. The README of each crate, which crates.io shows, describes its purpose and internals.

CratePurpose
rudof_libThe main library. Use it first.
rudof_rdfRDF model, parsers, serializers, SPARQL endpoints and backends.
rudof_rdf_sinkDestinations for the RDF triples that rudof produces.
rudof_iriIRI types.
prefixmapPrefix maps.
shex_astShEx abstract syntax, parsers and ShapeMaps.
shex_validationShEx validation.
shape_pathShExPath.
rbeRegular bag expressions.
shaclSHACL validation.
dctapDCTAP profiles.
pgschemaPG-Schema and property graph validation.
rdf_configrdf-config documents.
mieMIE documents.
shapes_converterConversion between shape languages.
shapes_comparatorComparison of shapes.
sparql_serviceSPARQL service descriptions and the query processor.
rudof_generateSynthetic data generation.
rudof_mcpThe MCP server.
rudof_configThe TOML configuration layer.
rudof_vizVisualization primitives.
rudof_typingThe typing cache of the validators.
rudof_earlEARL reports.

Since version 0.2.17, all rudof crates have the same version number. If you use several rudof crates, use the same version for all of them.