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, ...
, 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 ( constituenc ...
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 format ...
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 ...
, 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 ...
. It is a common data format for storing RDF data, along with N-Triples, JSON-LD and RDF/XML. RDF represents information using
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 f ...
s, 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 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 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 profes ...
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. T ...
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 ...
, 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,
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 __.html" ;"title=" ex:fullname "Dave Beckett"; ex:homePage "> 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 e ...
.


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 (discrete mathematics), graph) are identified using a URI, allowing descriptions to be made of that set of statements ...
s.


See also

* N-Triples * Notation3 (N3) * LV2


References


External links


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