In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, Terse RDF Triple Language (Turtle) is a
syntax and
file format
A file format is a Computer standard, standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary format, pr ...
for expressing data in the
Resource Description Framework The Resource Description Framework (RDF) is a World Wide Web Consortium (W3C) standard originally designed as a data model for metadata. It has come to be used as a general method for description and exchange of graph data. RDF provides a variety of ...
(RDF) data model. Turtle syntax is similar to that of
SPARQL, an
RDF query language. It is a common data format for storing RDF data, along with
N-Triples,
JSON-LD and
RDF/XML.
RDF represents information using
semantic triples, which comprise a subject, predicate, and object. Each item in the triple 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, information about
Huckleberry Finn could be expressed as:
<http://example.org/person/Mark_Twain>
<http://example.org/relation/author>
<http://example.org/books/Huckleberry_Finn> .
History
Turtle was defined by Dave Beckett as a subset of
Tim Berners-Lee
Sir Timothy John Berners-Lee (born 8 June 1955), also known as TimBL, is an English computer scientist best known as the inventor of the World Wide Web. He is a Professorial Fellow of Computer Science at the University of Oxford and a profe ...
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
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. ...
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
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 t ...
(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.
A significant proportion of RDF toolkits include Turtle parsing and serializing capability. Some examples of such toolkits are
Redland,
RDF4J,
Jena
Jena () is a German city and the second largest city in Thuringia. Together with the nearby cities of Erfurt and Weimar, it forms the central metropolitan area of Thuringia with approximately 500,000 inhabitants, while the city itself has a po ...
, Python's
RDFLib and JavaScript'
N3.js
Example
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: .
@prefix dc: .
@prefix ex: .
dc:title "RDF/XML Syntax Specification (Revised)" ;
ex:editor
"> ex:fullname "Dave Beckett";
ex:homePage
.
(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:
"RDF/XML Syntax Specification (Revised)" .
_:bnode .
_:bnode "Dave Beckett" .
_:bnode .
The
MIME type
A media type (also known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication o ...
of Turtle is
text/turtle
. The character encoding of Turtle content is always
UTF-8
UTF-8 is a variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit''.
UTF-8 is capable of ...
.
Named graphs
TriG
Trigonometry () is a branch of mathematics that studies relationships between side lengths and angles of triangles. The field emerged in the Hellenistic world during the 3rd century BC from applications of geometry to astronomical studies. T ...
RDF syntax extends Turtle with support for
named graphs.
See also
*
N-Triples
*
Notation3 (N3)
*
LV2
References
External links
Turtle Specification
{{Semantic Web
Resource Description Framework
Syntax
Computer file formats