| Terse RDF Triple Language | |
|---|---|
| Filename extension | .ttl |
| Internet media type | text/turtle |
| Developed by | Dave Beckett |
| Latest release | RDF 1.1 Turtle (REC) 25 February 2014 |
| Type of format | Semantic Web |
| Container for | RDF data |
| Extended from | N-Triples,Notation3 |
| Extended to | TriG |
| Website | www |
Incomputing,Terse RDF Triple Language (Turtle) is asyntax andfile format for expressing data in theResource Description Framework (RDF) data model. Turtle syntax is similar to that ofSPARQL, anRDF query language. It is a common data format for storing RDF data, along withN-Triples,JSON-LD andRDF/XML.
RDF represents information usingsemantic triples, which comprise a subject, predicate, and object. Each item in the triple is expressed as a WebURI. Turtle provides a way to group three URIs to make a triple, and provides ways to abbreviate such information, for example by factoring out common portions of URIs. For example, information aboutHuckleberry Finn could be expressed as:
<http://example.org/books/Huckleberry_Finn> <http://example.org/relation/author> <http://example.org/person/Mark_Twain> .
Turtle was defined by Dave Beckett as a subset ofTim Berners-Lee andDan Connolly'sNotation3 (N3) language, and a superset of the minimalN-Triples format. Unlike full N3, which has an expressive power that goes much beyond RDF, Turtle can only serialize valid RDF graphs. Turtle is an alternative toRDF/XML, the original syntax and standard for writing RDF. As opposed to RDF/XML, Turtle does not rely onXML and is generally recognized as being more readable and easier to edit manually than its XML counterpart.
SPARQL, the query language for RDF, uses a syntax similar to Turtle for expressing query patterns.
In 2011, a working group of theWorld Wide Web Consortium (W3C) started working on an updated version of RDF, with the intention of publishing it along with a standardised version of Turtle. This Turtle specification was published as a W3C Recommendation on 25 February 2014.[1]
A significant proportion of RDF toolkits include Turtle parsing and serializing capability. Some examples of such toolkits areRedland,RDF4J,Jena, Python'sRDFLib and JavaScript's N3.js.
The following example defines 3 prefixes ("rdf", "dc", and "ex"), and uses them in expressing a statement about the editorship of the RDF/XML document:
@prefixrdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefixdc:<http://purl.org/dc/elements/1.1/>.@prefixex:<http://example.org/stuff/1.0/>.<http://www.w3.org/TR/rdf-syntax-grammar>dc:title"RDF/XML Syntax Specification (Revised)";ex:editor[ex:fullname"Dave Beckett";ex:homePage<http://purl.org/net/dajobe/>].
(Turtle examples are also validNotation3).
The example encodes an RDF graph made of four triples, which express these facts:
Here are the triples made explicit inN-Triples notation:
<http://www.w3.org/TR/rdf-syntax-grammar><http://purl.org/dc/elements/1.1/title>"RDF/XML Syntax Specification (Revised)".<http://www.w3.org/TR/rdf-syntax-grammar><http://example.org/stuff/1.0/editor>_:bnode._:bnode<http://example.org/stuff/1.0/fullname>"Dave Beckett"._:bnode<http://example.org/stuff/1.0/homePage><http://purl.org/net/dajobe/>.
TheMIME type of Turtle istext/turtle. The character encoding of Turtle content is alwaysUTF-8.[2]
TriG RDF syntax extends Turtle with support fornamed graphs.