HTML and CSS Reference
RDF in Turtle Syntax
A subset of N3 is the Terse RDF Triple Language , often referred to as Turtle . Turtle provides a syntax to describe RDF
graphs in a compact textual form, which is easy to develop. It is a subset of Notation 3 (N3) and a superset of N-Triples.
Turtle is popular among Semantic Web developers and considered as an easy-to-read alternative to RDF/XML. Turtle
is being standardized by the World Wide Web Consortium . The typical file extension of Turtle files is .ttl . The
character encoding of Turtle files should be UTF-8. The MIME type of Turtle is text/turtle . Turtle is supported by
many software frameworks that can be used for querying and analyzing RDF data, such as Jena , Redland ,
and Sesame .
Turtle files consist of a sequence of directives, statements representing triples, and blank lines. Triples can be
written in Turtle as a sequence of subject - predicate - object terms, separated by whitespace, and terminated by a
period ( . ). URIs should be written in angle brackets ( <> ). Literals are delimited by double quotes ( "" ). Listing 7-62
shows an example.
Listing 7-62. A Basic Example for the Turtle Syntax
<http://example.com/shop> <http://example.com/contact> "Text content".
URI length can be reduced by the @PREFIX (Listing 7-63).
Listing 7-63. A URI Prefix Declaration
@PREFIX ex: <http://example.com/>.
In that case, the first example can be written as in Listing 7-64.
Listing 7-64. Using a Prefix
ex:shop ex:contact "Text content".
where ex:shop declares the concatenation of http://example.com/ with shop , revealing the original URI
The power of RDF, which was demonstrated earlier, can be exploited through external files written in rather complex
syntax. However, there is a nice exception: RDFa. RDFa (RDF in attributes) adds attribute-level extensions to any
markup language (from this point of view, the host language, as discussed earlier in Chapter 3) in order to describe
structured data. In other words, RDFa notations can be declared in attributes, rather than elements (which is the
approach used by other RDF serialization formats). Although many attributes are defined by RDFa, some markup
attributes (such as href and rel ) are reused. Wherever possible, the textual content is also reused. RDFa can serve
as a bridge between the “human and data Webs,” since RDFa makes it possible to write RDF triples in the (X)HTML
markup . Structured information can be extracted and utilized from web documents via an RDFa application
programming interface (RDFa API) . The mechanism of the RDF data model mapping allows RDF triples to be
embedded within web documents as well as the extraction of RDF model triples by compliant software.
RDFa provides the option to embed rich metadata within certain attributes of web documents . The set of
attributes to be used for this purpose is as follows:
• about , src
The Unified Resource Identifier (URI) or compact URI (CURIE)  of the resource that
describes the metadata