Understanding N-Triples

N-Triples is a line-based, plain text format for encoding an RDF (Resource Description Framework) graph. It was originally designed to be a simpler subset of the Notation3 format, specifically for the purpose of providing a highly predictable and easy-to-parse serialization for Semantic Web data.

The fundamental structure of an N-Triples document consists of a series of statements, each representing a single RDF triple. Each triple is composed of three components: a subject, a predicate, and an object. These components are separated by whitespace and the entire statement is terminated by a period (.). According to the W3C N-Triples Recommendation, this format is ideal for large datasets because it allows for simple stream processing.

Unlike more complex formats like Turtle, N-Triples does not support shorthand notations such as prefix declarations or predicate lists. This lack of syntactic sugar makes the format more verbose but significantly easier to process using simple line-oriented tools. The specification for N-Triples is maintained by the W3C as part of the RDF 1.1 suite of standards. Further technical details are available via the RDF 1.1 Concepts and Abstract Syntax documentation.