| Crates.io | rdfless |
| lib.rs | rdfless |
| version | 0.4.1 |
| created_at | 2025-06-08 17:04:53.476893+00 |
| updated_at | 2026-01-22 20:41:48.918795+00 |
| description | A colorful pretty printer for RDF (Turtle/TriG/N-Triples/N-Quads/PROV-N) with ANSI colors |
| homepage | |
| repository | https://github.com/larsw/rdfless |
| max_upload_size | |
| id | 1705068 |
| size | 959,473 |
A colorful pretty printer for RDF data with ANSI colors.
rdfless is a command-line tool that reads RDF data in Turtle, TriG, N-Triples, N-Quads, and PROV-N formats and pretty-prints it with syntax highlighting. It's designed to make RDF data more readable in terminal environments. RDF 1.2 for Turtle and TriG is supported, including quoted triples, triple terms, annotation syntax (~ with {| |}), and VERSION/@version directives.
Key features:
Usage: rdfless [OPTIONS] [FILE]...
Arguments:
[FILE]... Input files (Turtle, TriG, N-Triples, N-Quads, or PROV-N format)
Options:
--expand Expand prefixes instead of showing PREFIX declarations
--compact Compact mode (opposite of 'expand')
--format <FORMAT> Override the input format (auto-detected from file extension by default) Supported formats: turtle, trig, ntriples, nquads, provn [possible values: turtle, trig, ntriples, nquads, provn]
--pager Enable paging for large outputs
--no-pager Disable paging (useful when paging is enabled by default in config)
--dark-theme Force dark theme colors
--light-theme Force light theme colors
--no-auto-theme Disable automatic background detection
--continue-on-error Continue parsing even when encountering errors (skip invalid triples)
-s, --subject <SUBJECT> Filter by subject (IRI or prefixed name)
-p, --predicate <PREDICATE> Filter by predicate (IRI or prefixed name)
-o, --object <OBJECT> Filter by object (IRI, prefixed name, or literal value)
-O, --output <OUTPUT> Output file (write to file instead of stdout)
--completion <COMPLETION> Generate shell completion script for bash, zsh, fish, elvish, or powershell [possible values: bash, elvish, fish, powershell, zsh]
-h, --help Print help
-V, --version Print version
Install the latest version with a single command:
curl -sSL https://raw.githubusercontent.com/larsw/rdfless/main/install.sh | bash
This will download and install the latest Linux binary to ~/.local/bin and optionally add it to your PATH.
Download the latest release for your platform from the GitHub Releases page:
rdfless-VERSION-linux-x86_64rdfless-VERSION-windows-x86_64.exerdfless-VERSION-macos-x86_64rdfless_VERSION_amd64.debAll release artifacts include SLSA Build Level 3 provenance and SHA256 checksums for verification:
SHA256 Verification: Each release includes a checksums.txt file with SHA256 hashes for all artifacts:
# Download your binary and the checksums file, then verify:
sha256sum -c checksums.txt
SLSA Provenance Verification: All artifacts include SLSA provenance that can be verified using the slsa-verifier tool:
# Install slsa-verifier
go install github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier@latest
# Verify a binary (example for Linux)
slsa-verifier verify-artifact \
--provenance-path rdfless-VERSION-linux-x86_64.intoto.jsonl \
--source-uri github.com/larsw/rdfless \
rdfless-VERSION-linux-x86_64
This ensures that the binaries you download were built by the official GitHub Actions workflow and haven't been tampered with.
cargo install rdfless
git clone https://github.com/larsw/rdfless.git
cd rdfless
cargo build --release
The binary will be available at target/release/rdfless.
For a complete development workflow with formatting, linting, testing, and building:
# Install Just: https://github.com/casey/just
cargo install just
# Build release version
just build
# Development workflow (format, lint, test, build)
just dev
# Install system-wide (requires sudo)
sudo just install
# Build distribution binaries for all platforms
just dist
# See all available commands
just list
Release builds automatically include the following optimizations:
These optimizations help create a more compact executable without affecting functionality.
rdfless supports shell completion for bash, zsh, fish, elvish, and PowerShell. You can generate completion scripts using the --completion flag:
# Generate completion script
rdfless --completion bash > ~/.local/share/bash-completion/completions/rdfless
# Or for system-wide installation (requires sudo)
sudo rdfless --completion bash > /etc/bash_completion.d/rdfless
# Generate completion script (make sure ~/.zfunc is in your fpath)
mkdir -p ~/.zfunc
rdfless --completion zsh > ~/.zfunc/_rdfless
# Add to ~/.zshrc if not already present:
# fpath=(~/.zfunc $fpath)
# autoload -U compinit && compinit
# Generate completion script
rdfless --completion fish > ~/.config/fish/completions/rdfless.fish
# Generate for elvish
rdfless --completion elvish
# Generate for PowerShell
rdfless --completion powershell
After installing completions, restart your shell or source the appropriate configuration file.
# Process a TTL file
rdfless file.ttl
# Process a TriG file
rdfless file.trig
# Process an N-Triples file
rdfless file.nt
# Process an N-Quads file
rdfless file.nq
# Process a PROV-N file
rdfless file.provn
# Process multiple files
rdfless file1.ttl file2.trig file3.nt file4.nq file5.provn
# Read from stdin
cat file.ttl | rdfless
# Expand prefixes instead of showing PREFIX declarations
rdfless --expand file.ttl
# Override the input format (auto-detected from file extension by default)
rdfless --format turtle file.rdf
rdfless --format trig file.rdf
rdfless --format ntriples file.rdf
rdfless --format nquads file.rdf
rdfless --format provn file.rdf
# Continue parsing even if there are errors in the RDF file
rdfless --continue-on-error malformed_file.ttl
# Filter RDF triples by subject
rdfless --filter-subject "ex:john" file.ttl
rdfless --filter-subject "http://example.org/person1" file.ttl
# Filter RDF triples by predicate
rdfless --filter-predicate "foaf:name" file.ttl
rdfless --filter-predicate "http://xmlns.com/foaf/0.1/name" file.ttl
# Filter RDF triples by object (IRI, prefixed name, or literal)
rdfless --filter-object "ex:Person" file.ttl
rdfless --filter-object "John Doe" file.ttl
rdfless --filter-object "http://example.org/Person" file.ttl
# Combine filtering with other options
rdfless --expand --filter-subject "ex:john" --no-pager file.ttl
rdfless uses a TOML configuration file to customize colors. The configuration file is located at:
~/.local/rdfless/config.toml
If the file doesn't exist, a default configuration will be created automatically.
Example configuration:
[colors]
subject = "blue"
predicate = "green"
object = "white"
literal = "red"
prefix = "yellow"
base = "yellow"
graph = "yellow"
[output]
expand = false
Available colors:
Example configuration with CSS color codes:
[colors]
subject = "#336699"
predicate = "#00cc00"
object = "#ffffff"
literal = "#ff0000"
prefix = "#ffcc00"
base = "#ffcc00"
graph = "#ffcc00"
[output]
expand = false
When paging is enabled (either through the --pager flag or configuration), rdfless uses the minus pager which provides powerful navigation and search capabilities. For a complete list of available keybindings and shortcuts, see PAGER_KEYBINDINGS.md.
Key highlights:
Input:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <https://example.org/> .
ex:Person a rdfs:Class ;
rdfs:label "Person" .
ex:john a ex:Person ;
rdfs:label "John Doe" .
Output will be the same content but with syntax highlighting for better readability.
| Compact Mode | Expanded Mode |
|---|---|
![]() |
![]() |
| Compact Mode | Expanded Mode |
|---|---|
![]() |
![]() |


For how to regenerate these screenshots, see the Contributors guide.
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.
Lars Wilhelmsen lars@lars-backwards.org