XML FORMAT

TriX

TriX (Triples in XML) is an XML serialization for RDF that was designed to represent named graphs — that is, sets of RDF triples each associated with a graph name, giving an effective quad model of subject, predicate, object, and graph. It was introduced in 2004 by Jeremy Carroll (HP Labs) and Patrick Stickler (Nokia) in the paper "RDF Triples in XML," as a companion to the theoretical Named Graphs work that also motivated the more Turtle-like TriG. Unlike RDF/XML, which optimizes for terse, human-authored prose and offers many syntactic shortcuts, TriX deliberately favors a highly regular, minimal, and predictable XML structure.

Structurally a TriX document is a root TriX element in the namespace http://www.w3.org/2004/03/trix/trix-1/, containing one or more graph elements. Each graph may carry a name (a uri or blank-node id) and holds a flat sequence of triple elements, each with exactly three child terms in subject-predicate-object order. Terms are expressed with a small closed vocabulary: uri for IRIs, id for blank nodes, plainLiteral for string literals (with an optional xml:lang attribute), and typedLiteral for datatyped values (with a datatype attribute pointing at an XSD or other type IRI). Because every RDF term maps to one explicit element, the structure is fully self-describing with no prefix expansion, list sugar, or nesting to interpret.

The design rationale is toolability: because TriX is plain, normalized XML, it can be produced, queried, transformed, and validated with off-the-shelf XML machinery such as XSLT, XQuery, and XML Schema, and the specification even defines an XSLT-based extensibility mechanism for shorthand syntaxes. This makes it attractive for pipelines that already live in the XML ecosystem and need to move RDF datasets through them.

In practice TriX occupies a niche. It never became a W3C Recommendation, and mainstream RDF interchange today gravitates toward Turtle, TriG, N-Triples, N-Quads, and JSON-LD. It remains supported as a read/write format in Eclipse RDF4J (formerly Sesame) via its Rio parsers, in Python's RDFLib (Python), and by RDF toolkits such as Jena/RIOT, so it endures mainly as a bridge for XML-centric processing and archival of quad-level data rather than as a primary serialization.

Alternative Names: Triples in XML

File Extensions: .trix vHPL-2004-56
FeatureTriX
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)

Frequently Asked Questions

What is a TriX file?

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

How do I open a TriX file?

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

How do I convert a TriX file to another format?

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