TOOL

rdf2rdf

rdf2rdf is a small command-line tool, written in Go by the developer "knakk," for converting between RDF serialization formats. It was created primarily to test and showcase the sibling library github.com/knakk/rdf, a Go package providing data structures and parsers/serializers for RDF. The tool reads RDF/XML (RDF/XML), N-Triples (N-Triples), N-Quads (N-Quads), and Turtle (Turtle) as input, and writes N-Triples or Turtle as output. Formats are chosen automatically from file extensions (.rdf/.rdfxml, .nt, .nq, .ttl), and a typical invocation is simply "rdf2rdf -in=input.xml -out=output.ttl".

Because RDF is a graph data model, all of these formats encode the same underlying set of subject-predicate-object statements; rdf2rdf therefore performs a pure re-serialization rather than any structural transformation, translating one concrete syntax into another while preserving the triples themselves. N-Quads adds a fourth "graph name" component to each statement. The tool can flatten quads into triples on output, but this discards the graph-context information, and it cannot fabricate quads from triple input, so quad-to-triple conversion is lossy and triple-to-quad conversion is unsupported.

Its distinguishing design choice is streaming. By default (-stream=true) it decodes and emits statements incrementally, keeping memory usage roughly constant regardless of file size, which makes it well suited to very large dumps. Streaming can be turned off (-stream=false) to buffer the whole graph in memory, which in turn enables sorting of the output and removal of duplicate statements—operations impossible in a purely streaming pass. A verbosity flag controls progress reporting.

rdf2rdf is deliberately narrow in scope. It has no support for JSON-LD (JSON-LD), TriG (TriG), TriX (TriX), RDF/JSON (RDF/JSON), RDFa (RDFa), or RDF-star (RDF-star), no SPARQL or query capability, and no on-the-fly validation or reasoning; it is a format converter, not a triplestore or toolkit. For workflows needing broader format coverage or graph querying, general-purpose RDF frameworks such as Jena/RIOT, RDFLib (Python), or dotNetRDF are more capable, though heavier. Within its niche, rdf2rdf is valued as a fast, dependency-light, single-binary utility for bulk syntax conversion of large RDF datasets.

Graph Formats(Input & Output)

Frequently Asked Questions

What graph file formats does rdf2rdf support?

See the list on this page — it shows every format rdf2rdf can read, write and display.

How do I import a graph into rdf2rdf?

Convert your file to a format rdf2rdf can read, then open it in rdf2rdf. Use GraphInOut to get a rdf2rdf-compatible file in seconds.

How do I convert a file so rdf2rdf can open it?

Use the convert links above — upload or paste your graph, pick a format rdf2rdf accepts and download the result, right in your browser.