N-Triples
   HOME

TheInfoList



OR:

N-Triples is a format for storing and transmitting data. It is a line-based, plain text serialisation format for RDF (Resource Description Framework) graphs, and a subset of the
Turtle Turtles are an order of reptiles known as Testudines, characterized by a special shell developed mainly from their ribs. Modern turtles are divided into two major groups, the Pleurodira (side necked turtles) and Cryptodira (hidden necked t ...
(Terse RDF Triple Language) format. N-Triples should not be confused with Notation3 which is a superset of Turtle. N-Triples was primarily developed by Dave Beckett at the
University of Bristol , mottoeng = earningpromotes one's innate power (from Horace, ''Ode 4.4'') , established = 1595 – Merchant Venturers School1876 – University College, Bristol1909 – received royal charter , type ...
and Art Barstow at the
World Wide Web Consortium The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working ...
(W3C). N-Triples was designed to be a simpler format than Notation3 and Turtle, and therefore easier for software to parse and generate. However, because it lacks some of the shortcuts provided by other RDF serialisations (such as
CURIE In computing, a CURIE (or ''Compact URI'') defines a generic, abbreviated syntax for expressing Uniform Resource Identifiers (URIs). It is an abbreviated URI expressed in a compact syntax, and may be found in both XML and non-XML grammars. A CURI ...
s and nested resources, which are provided by both RDF/XML and Turtle) it can be onerous to type out large amounts of data by hand, and difficult to read.


Usage

There is very little variation in how an RDF graph can be represented in N-Triples. This makes it a very convenient format to provide "model answers" fo
RDF test suites


Implementations

As N-Triples is a subset of Turtle and Notation3, by definition all tools which support input in either of those formats will support N-Triples. In addition, some tools like Cwm have specific support for N-Triples.


File format

Each line of the file has either the form of a comment or of a statement: A statement consists of ''four'' parts, separated by whitespace: * the subject, * the predicate, * the object, * a
full stop The full stop (Commonwealth English), period (North American English), or full point , is a punctuation mark. It is used for several purposes, most often to mark the end of a declarative sentence (as distinguished from a question or exclamatio ...
which means the termination of a statement Subjects may take the form of a URI or a ''
blank node In RDF, a blank node (also called ''bnode'') is a node in an RDF graph representing a resource for which a URI or literal is not given. The resource represented by a blank node is also called an anonymous resource. According to the RDF standard ...
''; predicates must be a URI; objects may be a URI, blank node or a literal. URIs are delimited with less-than and greater-than signs used as
angle brackets A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a 'left' or 'r ...
. Blank nodes are represented by an alphanumeric string, prefixed with an underscore and colon (_:). Literals are represented as printable ASCII strings (with backslash escapes), delimited with double-quote characters, and optionally suffixed with a language or datatype indicator. Language indicators are an at sign followed by an RFC 3066 language tag; datatype indicators are a double-
caret Caret is the name used familiarly for the character , provided on most QWERTY keyboards by typing . The symbol has a variety of uses in programming and mathematics. The name "caret" arose from its visual similarity to the original proofreade ...
followed by a URI. Comments consist of a line beginning with a hash sign.


Example

The N-Triples statements below are equivalent to this RDF/XML: * RDF/XML N-Triples Art Barstow Dave Beckett * N-Triples . "N-Triples"@en-US . _:art . _:dave . _:art . _:art "Art Barstow". _:dave . _:dave "Dave Beckett". (The symbol ↵ is used to indicate a place where a line has been wrapped for legibility. N-Triples do not allow lines to be wrapped arbitrarily: the line endings indicate the end of a statement.)


N-Quads

The related ''N-Quads'' superset extends N-Triples with an optional context value at the fourth position. . # comments here # or on a line by themselves _:subject1 "object1" . _:subject2 "object2" .


See also

* Notation3 (N3) *
Turtle (syntax) In computing, Terse RDF Triple Language (Turtle) is a syntax and file format for expressing data in the Resource Description Framework (RDF) data model. Turtle syntax is similar to that of SPARQL, an RDF query language. It is a common data format ...
* TriG (syntax)


References


External links


RDF for Intrepid Unix Hackers: Grepping N-Triples

RDF for Intrepid Unix Hackers: Transmuting N-Triples
{{Semantic Web Metadata Computer file formats