rdf-write

Writes validated RDF data to Turtle, JSON-LD, N-Triples, and N-Quads files.

Updated May 12, 2026
One-click install
npx skills add https://github.com/angelo-v/pi-kit --skill rdf-write-angelo-v
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rdf-write
Source: https://github.com/angelo-v/pi-kit/tree/main/packages/linked-data/skills/rdf-write
Command: npx skills add https://github.com/angelo-v/pi-kit --skill rdf-write-angelo-v

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing RDF files by hand often leads to syntax errors, inconsistent formatting, and data that violates SHACL shapes. This Skill writes RDF graphs through a dedicated tool that validates, normalises, and saves the data, then checks conformance against discovered shapes. ## Core Features & Use Cases - Validated RDF Writing: Compose Turtle and write it via the rdf_write tool, which parses and normalises the data or returns parse errors with line info. - Multiple Output Formats: Save graphs as .ttl (Turtle), .jsonld (JSON-LD), .nt (N-Triples), or .nq (N-Quads), with an optional format override. - SHACL Conformance Loop: Automatically discover applicable shapes with discover_shapes_for_class and validate with rdf_validate, iterating until the data conforms. - Use Case: Generate a FOAF-based knowledge graph describing people and organisations, write it as a normalised .ttl file, and confirm it passes all SHACL constraints in the workspace. ## Quick Start Create an RDF ontology file in Turtle format describing a Person class and save it as ontology.ttl, then validate it against any SHACL shapes in the workspace.

Frequently Asked Questions about rdf-write

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write RDF data to a Turtle file?▼

Compose valid Turtle with declared prefixes and call the rdf_write tool with the Turtle text and target path. The tool validates, normalises, and writes the file, or returns a parse error with line information to fix.

What RDF serialization formats are supported for output?▼

Four formats are supported based on file extension: .ttl writes normalised Turtle, .jsonld writes compacted JSON-LD, .nt writes N-Triples, and .nq writes N-Quads. Use the format parameter to override the extension default.

When should I use rdf_patch instead of rdf_write?▼

Use rdf_patch when adding, removing, or replacing a few triples in an existing .ttl file, since it applies a SPARQL Update statement and rewrites only changed triples. Use rdf_write for creating new files or complete overwrites.

How do I validate RDF data against SHACL shapes?▼

After writing, call discover_shapes_for_class for each type IRI to find matching shapes, then pass those shapes files to rdf_validate. If violations appear, fix the data, rewrite, and repeat until the file conforms.

Why does my Turtle file fail to parse?▼

The most common parse error is a missing final period at the end of a triple block. Also check that all prefixes are declared and that semicolons and commas are used correctly for grouping triples.