Turtle (syntax)
   HOME

TheInfoList



OR:

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, e ...
, Terse RDF Triple Language (Turtle) is a
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituency) ...
and
file format A file format is a 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 or free. Some file formats ...
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 SPARQL (pronounced "sparkle" , a recursive acronym for SPARQL Protocol and RDF Query Language) is an RDF query language—that is, a semantic query language for databases—able to retrieve and manipulate data stored in Resource Description F ...
, an
RDF query language An RDF query language is a computer language, specifically a query language for databases, able to retrieve and manipulate data stored in Resource Description Framework (RDF) format. SPARQL has emerged as the standard RDF query language, and in 2 ...
. It is a common data format for storing RDF data, along with
N-Triples 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 (Terse RDF Triple Language) format. N-Triples should not be ...
,
JSON-LD JSON-LD (JavaScript Object Notation for Linked Data) is a method of encoding linked data using JSON. One goal for JSON-LD was to require as little effort as possible from developers to transform their existing JSON to JSON-LD. JSON-LD allows data ...
and
RDF/XML RDF/XML is a syntax,RDF/XML Syntax Specification
semantic triple A semantic triple, or RDF triple or simply triple, is the atomic data entity in the Resource Description Framework (RDF) data model. As its name indicates, a triple is a set of three entities that codifies a statement about semantic data in the ...
s, which comprise a subject, predicate, and object. Each item in the triple is expressed as a Web
URI Uri may refer to: Places * Canton of Uri, a canton in Switzerland * Úri, a village and commune in Hungary * Uri, Iran, a village in East Azerbaijan Province * Uri, Jammu and Kashmir, a town in India * Uri (island), an island off Malakula Islan ...
. 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 Huckleberry "Huck" Finn is a fictional character created by Mark Twain who first appeared in the book ''The Adventures of Tom Sawyer'' (1876) and is the protagonist and narrator of its sequel, ''Adventures of Huckleberry Finn'' (1884). He is 12 ...
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 and Dan Connolly's
Notation3 Notation3, or N3 as it is more commonly known, is a shorthand non-XML serialization of Resource Description Framework models, designed with human-readability in mind: N3 is much more compact and readable than XML RDF notation. The format is being ...
(N3) language, and a superset of the minimal
N-Triples 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 (Terse RDF Triple Language) format. N-Triples should not be ...
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 RDF/XML is a syntax,RDF/XML Syntax Specification
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 SPARQL (pronounced "sparkle" , a recursive acronym for SPARQL Protocol and RDF Query Language) is an RDF query language—that is, a semantic query language for databases—able to retrieve and manipulate data stored in Resource Description F ...
, 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 ...
(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 Eclipse RDF4J (formerly OpenRDF Sesame) is an open-source framework for storing, querying, and analysing RDF data. It was created by the Dutch software company Aduna as part of "On-To-Knowledge", a semantic web project that ran from 1999 to 2002 ...
,
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 popu ...
, Python's
RDFLib RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information. This library contains parsers/serializers for almost all of the known RDF serializations, such as RDF/XML, Turtle, N-Triples, & JSON- ...
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 __.html" ;"title=" ex:fullname "Dave Beckett"; ex:homePage "> ex:fullname "Dave Beckett"; ex:homePage . (Turtle examples are also valid
Notation3 Notation3, or N3 as it is more commonly known, is a shorthand non-XML serialization of Resource Description Framework models, designed with human-readability in mind: N3 is much more compact and readable than XML RDF notation. The format is being ...
). 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 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 (Terse RDF Triple Language) format. N-Triples should not be ...
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, Internet Assigned Numbers Authority (IANA) is the official authority for t ...
of Turtle is text/turtle. The character encoding of Turtle content is always
UTF-8 UTF-8 is a variable-width encoding, 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'' ...
.


Named graphs

TriG RDF syntax extends Turtle with support for
named graph Named graphs are a key concept of Semantic Web architecture in which a set of Resource Description Framework statements (a graph) are identified using a URI, allowing descriptions to be made of that set of statements such as context, provenanc ...
s.


See also

*
N-Triples 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 (Terse RDF Triple Language) format. N-Triples should not be ...
* Notation3 (N3) *
LV2 LV2 (LADSPA Version 2) is a set of royalty-free open standards for plug-in (computing), plug-ins and matching host applications. It includes support for the audio synthesis, synthesis and digital signal processing, processing of digital audio and ...


References


External links


Turtle Specification
{{Semantic Web Resource Description Framework Syntax Computer file formats