First 2 sections of Turtle in ReSpec
authorGavin Carothers <gavin@carothers.name>
Fri, 10 Jun 2011 14:16:09 -0700
changeset 33 aedbdd65edbb
parent 32 5729240838d4
child 34 85dd2ec79370
First 2 sections of Turtle in ReSpec
rdf-turtle/index.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf-turtle/index.html	Fri Jun 10 14:16:09 2011 -0700
@@ -0,0 +1,438 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Turtle</title>
+        <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+        <script src='../ReSpec.js/js/respec.js' class='remove'></script>
+        <script class='remove'>
+      var respecConfig = {
+          // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
+          specStatus:           "ED",
+          
+          // the specification's short name, as in http://www.w3.org/TR/short-name/
+          shortName:            "Turtle",
+
+          // if your specification has a subtitle that goes below the main
+          // formal title, define it here
+          subtitle   :  "Terse RDF Triple Language",
+
+          // if you wish the publication date to be other than today, set this
+          // publishDate:  "2009-08-06",
+
+          // if the specification's copyright date is a range of years, specify
+          // the start date here:
+          copyrightStart: "2008",
+
+          // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+          // and its maturity status
+          // previousPublishDate:  "1977-03-15",
+          // previousMaturity:  "WD",
+
+          // if there a publicly available Editor's Draft, this is the link
+          edDraftURI:           "http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html",
+
+          // if this is a LCWD, uncomment and set the end of its review period
+          // lcEnd: "2009-08-05",
+
+          // if you want to have extra CSS, append them to this list
+          // it is recommended that the respec.css stylesheet be kept
+          extraCSS:             ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"],
+
+          // editors, add as many as you like
+          // only "name" is required
+          editors:  [
+              { name: "Eric Prud'hommeaux", url: "http://www.w3.org/People/Eric/",
+                company: "W3C", companyURL: "http://www.w3.org/" },
+              { name: "Gavin Carothers", url: "http://gavin.carothers.name/",
+                company: "TopQuadrant, Inc", companyURL: "http://topquadrant.com/" },
+          ],
+
+          // authors, add as many as you like. 
+          // This is optional, uncomment if you have authors as well as editors.
+          // only "name" is required. Same format as editors.
+
+          authors:  [
+              { name: "David Beckett", url: "http://purl.org/net/dajobe/" },
+              { name: "Tim Berners-Lee", url: "http://www.w3.org/People/Berners-Lee/",
+                company: "W3C", companyURL: "http://www.w3.org/" },
+              { name: "Eric Prud'hommeaux", url: "http://www.w3.org/People/Eric/",
+                company: "W3C", companyURL: "http://www.w3.org/" },
+          ],
+          
+          // name of the WG
+          wg:           "RDF Working Group",
+          
+          // URI of the public WG page
+          wgURI:        "http://www.w3.org/2011/rdf-wg/",
+          
+          // name (with the @w3c.org) of the public mailing to which comments are due
+          wgPublicList: "public-rdf-comments",
+          
+          // URI of the patent status for this WG, for Rec-track documents
+          // !!!! IMPORTANT !!!!
+          // This is important for Rec-track documents, do not copy a patent URI from a random
+          // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
+          // Team Contact.
+          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/46168/status",
+          doRDFa: true,
+      };
+    </script>
+        
+    </head>
+
+    <body>
+        <section id='abstract'>
+			<p>The Resource Description Framework
+			(<abbr title="Resource Description Framework">RDF</abbr>) is a 
+			general-purpose language for representing information in the Web.</p>
+
+			<p>This document defines a textual syntax for RDF called Turtle
+			that allows RDF graphs to be completely written in a compact and
+			natural text form, with abbreviations for common usage patterns and
+			datatypes.  Turtle provides levels of  compatibility with the existing
+			<a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a>
+			and
+			<a href="http://www.w3.org/DesignIssues/Notation3">Notation 3</a> 
+			formats as well as the triple pattern syntax of the
+			<a href="http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/">SPARQL</a>
+
+			W3C Recommendation.
+			</p>
+
+			<p>This document specifies a language that is in common usage under the name 
+			"Turtle". It is intended to be compatible with, and a subset of, 
+			<a href="">Notation 3</a>.</p>
+        </section>
+        
+        <section id="sec-intro">
+			<h2>Introduction</h2>
+			<p>This document defines Turtle, the Terse RDF Triple Language,
+			a concrete syntax for RDF as defined in the
+			<a href="http://www.w3.org/TR/rdf-concepts/">RDF Concepts and Abstract Syntax</a> ([[!RDF-CONCEPTS]]) W3C Recommendation.
+			Turtle is an extension of 
+			<a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a>
+
+			([[!N-TRIPLES]])
+			carefully taking the most useful and appropriate things added from
+			<a href="http://www.w3.org/DesignIssues/Notation3">Notation 3</a>
+			([[N3]])
+			while staying within the RDF model.</p>
+
+			<p>The recommended XML syntax for RDF,
+			<a href="http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/">RDF/XML</a>
+			([[RDF-SYNTAX-GRAMMAR]])
+			has certain restrictions imposed by XML and the use of XML Namespaces
+			that prevent it encoding all RDF graphs (some predicate URIs are
+			forbidden and XML 1.0 forbids encoding some Unicode codepoints).
+			These restrictions do not apply to Turtle.</p>
+
+				<p>Turtle is intended to be compatible with, and a subset of, <a href="">Notation 3</a> (see 
+			<a href="#sec-diff-n3">Turtle compared to Notation 3</a>), and is generally usable in systems that support N3.</p>
+
+			<p>The Turtle grammar for <a href="#prod-turtle2-triples"><code>triples</code></a> is a subset of the 
+			<a href="http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/">SPARQL Query Language for RDF</a>
+			[[RDF-SPARQL-QUERY]] grammar for <a href="http://www.w3.org/TR/rdf-sparql-query/#rTriplesBlock"><code>TriplesBlock</code></a>. The two grammars share production and terminal names where possible.</p>
+        </section>
+		<section>
+
+			<h2>An Introduction to Turtle (Informative)</h2>
+			<p>This section is informative.  The
+			<a href="#sec-syntax">Turtle Syntax</a> and <a href="#sec-grammar">Turtle Grammar</a> sections formally define the language.
+			</p>
+
+			<p>A Turtle document allows writing down an RDF graph in a compact
+			textual form.  It consists of a sequence of directives, triple-generating
+			statements or blank lines.  Comments may be given after a <code>#</code>
+
+			and continue to the end of the line.</p>
+
+			<p>Simple triples are a sequence of (subject, predicate, object)
+			terms, separated by whitespace and terminated by '.' after each
+			triple.  This corresponds to
+			<a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a>
+			[[N-TRIPLES]].
+			</p>
+
+			<p>There are three types of <em>RDF Term</em>:
+			<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-URI-reference">RDF URI References</a> (URIs for short),
+			<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-literal">literals</a> and
+			<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-blank-node">blank nodes</a>.</p>
+
+			<section id="terms">
+				<h3>RDF Terms</h3>
+
+				<p>URIs are written enclosed in '&lt;' and '&gt;' and may be
+				absolute RDF URI References or relative to the current base URI
+				(described below).
+				</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+&lt;http://example.org/path/&gt;
+
+&lt;http://example.org/path/#fragment&gt;
+&lt;/path&gt;
+&lt;#fragment&gt;
+&lt;&gt;
+				</pre>
+
+				<p>URIs may also be abbreviated by using Turtle's <code>@prefix</code>
+				directive that allows declaring a short prefix name for a long prefix
+				of repeated URIs. This is useful for many RDF vocabularies that are
+				all defined in nearby namespace URIs, possibly using XML's namespace
+				mechanism that works in a similar fashion.</p>
+
+				<p>Once a prefix such as <code>@prefix foo:
+				&lt;http://example.org/ns#&gt;</code> is defined, any mention of a
+				URI later in the document may use a <em>qualified name</em> that
+				starts <code>foo:</code> to stand for the longer URI.  So for
+				example, the qualified name <code>foo:bar</code> is a shorthand for
+				the URI <code>http://example.org/ns#bar</code>.</p>
+
+				<pre class="example">
+# this is a complete turtle document
+@prefix foo: &lt;http://example.org/ns#&gt; .
+@prefix : &lt;http://other.example.org/ns#&gt; .
+foo:bar foo: : .
+:bar : foo:bar .
+				</pre>
+
+				<p>Literals are written either using double-quotes when they do not
+				contain linebreaks like <code>"simple literal"</code> or
+				<code>"""long literal"""</code> when they may contain linebreaks.
+				</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+"a string"
+"""a string"""
+"""a string
+with newlines
+"""
+				</pre>
+
+				<p>Literals may be given either a language suffix or a datatype URI
+				but not both.  Languages are indicated by appending the simple
+				literal with <code>@</code> and the language tag.  Datatype URIs
+				similarly append <code>^^</code> followed by any legal URI form (full
+				or qualified) as described above to give the datatype URI.
+				</p>
+
+				<pre class="example">
+
+# this is not a complete turtle document
+"chat"
+"chat"@en
+"chat"@fr
+"foo"^^&lt;http://example.org/my/datatype&gt;
+"""10"""^^xsd:decimal
+				</pre>
+
+				<p>Blank nodes are written as <code>_:</code><em>BLANK_NODE_LABEL</em>
+				to provide a blank node either from the given <a href="#prod-turtle2-BLANK_NODE_LABEL">BLANK_NODE_LABEL</a>.
+				A generated blank node may also be made with <code>[]</code>
+
+				which is useful to provide the subject of RDF triples for
+				each pair from the <a href="#prod-turtle2-predicateObjectList">predicateObjectList</a>
+				or the root of the <a href="#prod-turtle2-collection">collection</a>.
+				</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+_:me
+_:a1234
+				</pre>
+
+
+				<p>Literals and URIs may also contain escapes to encode surrounding
+				syntax, non-printable characters and to encode Unicode characters by
+				codepoint number (although they may also be given directly, encoded
+				as UTF-8).  The character escapes are:</p>
+
+				<ul>
+				<li><code>\t</code> (U+0009, tab)</li>
+				<li><code>\n</code> (U+000A, linefeed)</li>
+				<li><code>\r</code> (U+000D, carriage return)</li>
+
+				<li><code>\"</code> (U+0022, double quote - only allowed inside <a href="#prod-turtle2-String">strings</a>)</li>
+				<li><code>\></code> (U+003E, greater than - only allowed inside <a href="#prod-turtle2-IRI_REF">IRI_REFs</a>)</li>
+				<li><code>\\</code> (U+005C, backslash)</li>
+
+				<li>
+				<code>\u</code><em>HHHH</em> or
+				<code>\U</code><em>HHHHHHHH</em>
+				for writing Unicode characters by hexadecimal codepoint where
+				<em>H</em> is a single hexadecimal digit.
+				</li>
+				</ul>
+
+				<p>See the <a href="#sec-strings">String escapes</a> section for full details.</p>
+			</section>
+			<section id="uris">
+				<h3>Abbreviating URIs</h3>
+
+				<p>The current base URI may be altered in a Turtle document using the
+				<code>@base</code> directive.  It allows further abbreviation of
+				URIs but is usually for simplifying the URIs in the data, where
+				the prefix directives are for vocabularies that describe the data.</p>
+
+				<p>Whenever this directive appears, it defines the base URI for which
+				all relative URIs are resolved against.  That includes URIs,
+				qualified names, prefix directives as well as later base directives.
+				</p>
+
+				<pre class="example">
+# this is a complete turtle document
+# In-scope base URI is the document URI at this point
+&lt;a1&gt; &lt;b1&gt; &lt;c1&gt; .
+@base &lt;http://example.org/ns/&gt; .
+# In-scope base URI is http://example.org/ns/ at this point
+
+&lt;a2&gt; &lt;http://example.org/ns/b2&gt; &lt;c2&gt; .
+@base &lt;foo/&gt; .
+# In-scope base URI is http://example.org/ns/foo/ at this point
+&lt;a3&gt; &lt;b3&gt; &lt;c3&gt; .
+@prefix : &lt;bar#&gt; .
+:a4 :b4 :c4 .
+@prefix : &lt;http://example.org/ns2#&gt; .
+:a5 :b5 :c5 .
+				</pre>
+
+
+				<p>The token <code>a</code> is equivalent to the URI
+				<code>&lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;</code>
+				</p>
+
+				<pre class="example">
+# this is a complete turtle document
+@prefix doc: &lt;http://example.org/#ns&gt; .
+
+&lt;http://example.org/path&gt; a doc:Document .
+				</pre>
+				</section>
+				<section id="abbrev">
+				<h3 >Abbreviating common datatypes</h3>
+
+				<p>Decimal integers may be written directly and correspond to
+				the XML Schema Datatype
+				<a href="http://www.w3.org/TR/xmlschema-2/#integer">xsd:integer</a>.
+				in both syntax and datatype URI.</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+-5
+0
+1
+10
++1
+# some long form examples
+"-5"^^xsd:integer
+"10"^^&lt;http://www.w3.org/2001/XMLSchema#integer&gt;
+				</pre>
+
+				<p>Decimal floating point double/fixed precision numbers may be written
+				directly and correspond to the XML Schema Datatype
+				<a href="http://www.w3.org/TR/xmlschema-2/#integer">xsd:double</a>
+				in both syntax and datatype URI.
+				</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+1.3e2
+10e0
+-12.5e10
+# some long form examples
+"1.3e2"^^xsd:double
+"-12.5e10"^^&lt;http://www.w3.org/2001/XMLSchema#double&gt;
+				</pre>
+
+				<p>Decimal floating point arbitrary precision numbers may be written
+				directly and correspond to the XML Schema Datatype
+				<a href="http://www.w3.org/TR/xmlschema-2/#integer">xsd:decimal</a>.
+				in both syntax and datatype URI.
+				</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+0.0
+1.0
+1.234567890123456789
+-5.0
+# some long form examples
+"0.0"^^xsd:decimal
+"-5.0"^^&lt;http://www.w3.org/2001/XMLSchema#decimal&gt;
+
+				</pre>
+
+				<p>Boolean may be written directly as <code>true</code> or
+				<code>false</code> and correspond to the
+				the XML Schema Datatype
+				<a href="http://www.w3.org/TR/xmlschema-2/#boolean">xsd:boolean</a>
+				in both syntax and datatype URI.
+				</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+true
+false
+# same in long form
+"true"^^xsd:boolean
+"false"^^&lt;http://www.w3.org/2001/XMLSchema#boolean&gt;
+				</pre>
+			</section>
+
+			<section  id="groups">
+				<h3>Abbreviating groups of triples</h3>
+
+				<p>The <code>,</code> symbol may be used to repeat the subject and
+				predicate of triples that only differ in the object RDF term.</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+:a :b :c ,
+	:d .
+# the last triple is :a :b :d .
+				</pre>
+
+				<p>The <code>;</code> symbol may be used to repeat the subject of
+				of triples that vary only in predicate and object RDF terms.</p>
+
+				<pre class="example">
+# this is not a complete turtle document
+:a :b :c ;
+:d :e .
+# the last triple is :a :d :e .
+				</pre>
+
+				</section>
+				<section id="collections">
+				<h3>Abbreviating RDF Collections</h3>
+
+				<p>An RDF Collection may be abbreviated using a sequence of
+				RDF Terms enclosed in <code>( )</code> brackets.  Whitespace may
+				be used to separate them, as usual.  This format provides a
+				blank node at the start of RDF Collection which may be used
+				in further abbreviations.
+				</p>
+
+				<pre class="example">
+
+# this is a complete turtle document
+@prefix : &lt;http://example.org/foo&gt; .
+# the value of this triple is the RDF collection blank node
+:subject :predicate ( :a : b : c ) .
+
+# an empty collection value - rdf:nil
+:subject :predicate2 () .
+				</pre>
+
+				<p>See section <a href="#sec-collections">Collections</a> for
+				the details on the long form of the generated triples.
+				</p>
+			</section>
+		</section>
+    </body>
+
+</html>
+
+