||This article provides insufficient context for those unfamiliar with the subject. (June 2011)|
|Internet media type||
|Developed by||Dave Beckett|
|Type of format||Semantic Web|
|Container for||RDF data|
Turtle (Terse RDF Triple Language) is a format for expressing data in the Resource Description Framework (RDF) data model with a syntax similar to SPARQL. RDF, in turn, represents information using "triples", each of which consists of a subject, a predicate, and an object. Each of those items is expressed as a Web URI.
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:
<http://example.org/person/Mark_Twain> <http://example.org/relation/author> <http://example.org/books/Huckleberry_Finn> .
Turtle was defined by Dave Beckett as a subset of Tim Berners-Lee and Dan Connolly's Notation3 (N3) language, and a superset of the minimal N-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 to RDF/XML, the originally unique syntax and standard for writing RDF. As opposed to RDF/XML, Turtle does not rely on XML 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 the World 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.
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:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix ex: <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 valid Notation3).
The example encodes an RDF graph made of four triples, which express these facts:
- The W3C technical report on RDF syntax and grammar has the title RDF/XML Syntax Specification (Revised).
- That report's editor is a certain individual, who in turn
- Has full name Dave Beckett.
- Has a home page at a certain place.
Here are the triples made explicit in N-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/> .
- "RDF 1.1 Turtle - Terse RDF Triple LanguageTurtle". World Wide Web Consortium (W3C). 25 February 2014. Retrieved 16 December 2015. line feed character in
|title=at position 18 (help)
- "MIME Media Types: text/turtle". Internet Assigned Numbers Authority (IANA). 28 March 2011. Retrieved 27 November 2011.