TEXT FORMAT

TriG

TriG is a plain-text serialization for RDF datasets — collections of multiple RDF graphs rather than a single graph. It became a W3C Recommendation on 25 February 2014, edited by Gavin Carothers and Andy Seaborne under the RDF Working Group, with roots in an earlier 2007 specification from Freie Universität Berlin. Its media type is application/trig, its file extension is .trig, and documents are encoded in UTF-8. The name is a play on "Turtle" (Terse RDF Triple Language) with a "graph" twist.

TriG is a strict superset of format:turtle: every valid Turtle document is also a valid TriG document, and TriG inherits Turtle's full term syntax — @prefix/PREFIX declarations, prefixed and relative IRIs, blank nodes, typed and language-tagged literals, predicate-object lists, and RDF collections. What TriG adds is the ability to group triples into named graphs. A block of triples enclosed in curly braces { ... } and prefixed by an IRI or blank-node label forms a named graph (optionally introduced by the GRAPH keyword), while a brace block with no label — or triples written at the top level as in Turtle — populates the dataset's default graph. Reusing the same graph label merges the triples via set union, and blank-node labels are scoped consistently across the whole document.

Within the RDF family, TriG occupies the dataset tier alongside format:rdf-nquads, just as Turtle and format:n-triples occupy the single-graph tier. Compared to N-Quads' rigid one-quad-per-line layout, TriG is far more compact and human-readable, but because it permits abbreviations and multi-line literals, a line does not map to a statement, so naive line-based splitting or diffing can corrupt it. TriG is also the readable counterpart to the XML-based format:trix, and coexists with format:rdf-xml, format:json-ld, and format:notation3 as RDF exchange syntaxes.

Named graphs make TriG a natural fit for provenance, versioning, access control, and quad-store import/export, since each graph can carry metadata about the assertions it holds. It is widely supported by RDF toolkits — tool:apache-jena, tool:rdflib, and tool:dotnetrdf all read and write it — and serves as a standard bulk-load format for triple/quad stores. Its main limitation is inherent: TriG only expresses RDF, so non-RDF graph structures (property-graph edge properties, ordered adjacency, matrix data) must be modeled explicitly before they fit its triple-plus-graph shape.

Alternative Names: RDF 1.1 TriG

File Extensions: .trig Mimetype: application/trig vRDF 1.1
FeatureTriG
Multiple Graphs per Document supported
Nodes supported
Undirected Edges not supported
Directed Edges supported
Hyperedges not supported
Mixed-directionality Edges not supported
Parallel Edges supported
Self-loops supported
Edges on Edges partial
Nested Graphs in Nodes not supported
Nested Graphs in Edges not supported
Nested Graphs in Graphs not supported
Node Labels not supported
Edge Labels supported
Attributes on Nodes supported
Attributes on Edges not supported
Attributes on Graphs partial
Typed Edges supported

Tools(Read & Write)

Read-only Tools

Frequently Asked Questions

What is a TriG file?

A TriG file stores a graph — its nodes, edges and attributes — in the TriG format (also: RDF 1.1 TriG). See the feature table above for what it supports.

How do I open a TriG file?

Open it in a graph tool that supports TriG, or convert it to a format your tool reads. With GraphInOut you can convert TriG to GraphML, DOT, Connected JSON and more, right in your browser.

How do I convert a TriG file to another format?

Use the Convert from TriG link above: upload or paste your TriG file (input preset to TriG), choose a target format and download the result — free, no install.