--- a/rdf-turtle/index.html Fri Mar 30 09:22:18 2012 -0700
+++ b/rdf-turtle/index.html Fri Mar 30 11:07:21 2012 -0700
@@ -174,6 +174,18 @@
rel:enemyOf <http://example.org/#green-goblin> ;
a foaf:Person ;
foaf:name "Spiderman" .</script></pre>
+
+ <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/sparql11-query/#rTriplesBlock"><code>TriplesBlock</code></a>.
+ The two grammars share production and terminal names where possible.
+ Likewise, the N-Triples grammar re-uses some productions and terminals from Turtle.
+ </p>
+
+ <p>
+ The <a href="#sec-grammar">Turtle Grammar</a> and <a href="#sec-parsing">Parsing</a> sections define the construction of an RDF graph from a Turtle document.
+ The RDF graph represented by an N-Triples document contains exactly each triple matching <a href="#prod-ntriples-triple">N-Triples <code>triple</code> production</a>.
+ </p>
+
<p>
An N-Triples document contains no parsing directives.
Comments in either language may be given after a <code>#</code> that is not part of another lexical token and continue to the end of the line.
@@ -192,136 +204,98 @@
N-Triples triples are also Turtle triples, but Turtle includes other <a href="#terms">representations of RDF Terms</a> and <a href="#groups">abbreviations of RDF Triples</a>.
</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/sparql11-query/#rTriplesBlock"><code>TriplesBlock</code></a>.
- The two grammars share production and terminal names where possible.
- Likewise, the N-Triples grammar re-uses some productions and terminals from Turtle.
- </p>
-
- <p>
- The <a href="#sec-grammar">Turtle Grammar</a> and <a href="#sec-parsing">Parsing</a> sections define the construction of an RDF graph from a Turtle document.
- The RDF graph represented by an N-Triples document contains exactly each triple matching <a href="#prod-ntriples-triple">N-Triples <code>triple</code> production</a>.
- </p>
</section>
<section id="terms">
<h2>RDF Terms in Turtle and N-Triples</h2>
<p>
- There are three types of <em>RDF Term</em>:
+ There are three types of <em>RDF Term</em> defined in RDF Concepts:
<a href="../rdf-concepts/index.html#dfn-iri">IRIs</a> (Internationalized Resource Identifiers),
<a href="../rdf-concepts/index.html#dfn-literal">literals</a> and
- <a href="../rdf-concepts/index.html#dfn-blank-node">blank nodes</a>.
+ <a href="../rdf-concepts/index.html#dfn-blank-node">blank nodes</a>. Turtle provides a number
+ of ways of writing each.
</p>
<section id="IRIs">
<h3>RDF IRIs</h3>
<p>
- Turtle's grammar production <a href="#prod-turtle2-IRIref">IRIref</a> designates <a href="../rdf-concepts/index.html#dfn-iri">RDF IRIs</a>.
- These may be written as relative or absolute IRIs or prefixed names.
- Relative and absolute IRIs are enclosed in '<' and '>' and may contain <a href="#numeric">numeric escape sequences</a> (described below).
- The N-Triples language includes absolute IRIs but no relative IRIs or prefixed names.
+ <a href="../rdf-concepts/index.html#dfn-iri">RDF IRIs</a> may be written as relative or absolute IRIs or prefixed names.
+ Relative and absolute IRIs are enclosed in '<' and '>' and may contain <a href="#numeric">numeric escape sequences</a> (described below). For example <code><http://example.org/#green-goblin></code>.
</p>
+ <p>
+ The token <code>a</code> in the predicate position of a Turtle triple represents the IRI <code>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</code> .
+ </p>
+
+ <p>The following Turtle document contains examples of all the diffrent ways of writting IRIs in Turtle.</p>
+
+ <pre class="example"><script type="text/turtle"># A triple with all absolute IRIs (which is also a valid N-Triples triple):
+<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> .
+
+@base <http://one.example/> .
+<subject2> <predicate2> <object2> . # relative IRIs, e.g. http://one.example/subject2
+
+@prefix p: <http://two.example/> .
+p:subject3 p:predicate3 p:object3 . # prefixed name, e.g. http://two.example/subject3
+
+@prefix p: <path/> . # prefix p: now stands for http://one.example/path/
+p:subject4 p:predicate4 p:object4 . # prefixed name, e.g. http://one.example/path/subject4
+
+@prefix : <http://another.example/> . # empty prefix
+:subject5 :predicate5 :object5 . # prefixed name, e.g. http://another.example/subject5
+
+:subject6 a :subject7 . # same as :subject6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :subject7 .
+</script></pre>
+
<section id="turtleIRIs">
- <h3>Relative IRIs and Prefixed Names in Turtle</h3>
+ <h3>Prefixed Names in Turtle</h3>
<p>
- The <code>@prefix</code> directive associates a prefix label with an IRI.
- Subsequent <code>@prefix</code> directives may re-map the same local name.
A prefixed name is a prefix label and a local part, separated by a colon ":".
- A prefixed name is mapped to an IRI by concatenating the IRI associated with the prefix and the local part.
- The local part of a prefixed name may have <a href="#reserved">reserved character escape sequences</a> (described below).
- </p>
+ A prefixed name is turned into an IRI by concatenating the IRI associated with the prefix and the local part. The <code>@prefix</code> directive associates a prefix label with an IRI.
+ Subsequent <code>@prefix</code> directives may re-map the same prefix label. </p>
+
+ <p>
+ To write <code>http://www.perceive.net/schemas/relationship/enemyOf</code> using a prefixed name: Define a prefix label for <code>http://www.perceive.net/schemas/relationship/</code>. <code>@prefix rel: <http://www.perceive.net/schemas/relationship/> .</code>. Then write <code>rel:enemyOf</code> which is equalivate to writing <code><http://www.perceive.net/schemas/relationship/enemyOf></code>.
+ </p>
+ <pre class="example"><script type="text/turtle">@prefix rel: <http://www.perceive.net/schemas/relationship/> .
+
+<http://example.org/#green-goblin> rel:enemyOf <http://example.org/#spiderman> .
+ </script></pre>
+
<div class="note">
<p>
- Prefixed names are a superset of XML namespaces.
+ Prefixed names are a superset of XML QNames.
They differ in that the local part of prefixed names may include:
</p>
<ul>
<li>leading digits, e.g. <code>leg:3032571</code> or <code>isbn13:9780136019701</code></li>
- <li>reserved character escape sequences, e.g. <code>og:video\:height</code> or <code>wgs:lat\-long</code></li>
+ <li><a href="#reserved">reserved character escape sequences</a>, e.g. <code>og:video\:height</code> or <code>wgs:lat\-long</code></li>
</ul>
</div>
-
- <p>
- Relative IRIs are combined with base IRIs as per <a href="http://www.ietf.org/rfc/rfc3986.txt" class="norm">Uniform Resource Identifier (URI): Generic Syntax</a> [<a href="#rfc3986">RFC3986</a>] using only the basic algorithm in section 5.2.
- Neither Syntax-Based Normalization nor Scheme-Based Normalization (described in sections 6.2.2 and 6.2.3 of RFC3986) are performed.
- Characters additionally allowed in IRI references are treated in the same way that unreserved characters are treated in URI references, per section 6.5 of <a href="http://www.ietf.org/rfc/rfc3987.txt" class="norm">Internationalized Resource Identifiers (IRIs)</a> [<a href="#rfc3987">RFC3987</a>].
- </p>
- <p>
- The <code>@base</code> directive defines the Base IRI used to resolve relative IRIs per RFC3986 section 5.1.1, "Base URI Embedded in Content".
- Section 5.1.2, "Base URI from the Encapsulating Entity" defines how the In-Scope Base IRI may come from an encapsulating document, such as a SOAP envelope with an xml:base directive or a mime multipart document with a Content-Location header.
- The "Retrieval URI" identified in 5.1.3, Base "URI from the Retrieval URI", is the URL from which a particular SPARQL query was retrieved.
- If none of the above specifies the Base URI, the default Base URI (section 5.1.4, "Default Base URI") is used.
- Each <code>@base</code> directive sets a new In-Scope Base URI, relative to the previous one.
- </p>
-
- <p>
- The token <code>a</code> in the predicate position of a Turtle triple represents the IRI <code>rdf:type</code> .
- </p>
-
- <pre class="example"><script type="text/plain">
-# A triple with all absolute IRIs (which is also a valid N-Triples triple):
-<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> .
-
-@base <http://one.example/>
-<subject2> <predicate2> <object2> . # relative IRIs, e.g. http://one.example/subject2
-
-@prefix p: <http://two.example/>
-p:subject3 p:predicate3 p:object3 . # prefixed IRIs, e.g. http://two.example/subject3
-
-@prefix p: <path/> # prefix p: now stands for http://one.example/path/
-p:subject4 p:predicate4 p:object4 . # prefixed IRIs, e.g. http://one.example/path/subject4
-
-@prefix : <http://another.example/> # empty prefix
-:subject5 :predicate5 :object5 . # prefixed IRIs, e.g. http://another.example/subject5
-
-:subject6 a :subject7 . # same as :subject6 rdf:type :subject7 .
-</script></pre>
-
</section>
- <section id="iri-summary">
- <h3>Summary of IRI Representations in N-Triples and Turtle</h3>
+ <section>
+ <h3>Relative IRIs</h3>
+ <p>
+ Relative IRIs are resolved with base IRIs as per <a href="http://www.ietf.org/rfc/rfc3986.txt" class="norm">Uniform Resource Identifier (URI): Generic Syntax</a> [<a href="#rfc3986">RFC3986</a>] using only the basic algorithm in section 5.2.
+ Neither Syntax-Based Normalization nor Scheme-Based Normalization (described in sections 6.2.2 and 6.2.3 of RFC3986) are performed.
+ Characters additionally allowed in IRI references are treated in the same way that unreserved characters are treated in URI references, per section 6.5 of <a href="http://www.ietf.org/rfc/rfc3987.txt" class="norm">Internationalized Resource Identifiers (IRIs)</a> [<a href="#rfc3987">RFC3987</a>].
+ </p>
+ <p>
+ The <code>@base</code> directive defines the Base IRI used to resolve relative IRIs per RFC3986 section 5.1.1, "Base URI Embedded in Content".
+ Section 5.1.2, "Base URI from the Encapsulating Entity" defines how the In-Scope Base IRI may come from an encapsulating document, such as a SOAP envelope with an xml:base directive or a mime multipart document with a Content-Location header.
+ The "Retrieval URI" identified in 5.1.3, Base "URI from the Retrieval URI", is the URL from which a particular SPARQL query was retrieved.
+ If none of the above specifies the Base URI, the default Base URI (section 5.1.4, "Default Base URI") is used.
+ Each <code>@base</code> directive sets a new In-Scope Base URI, relative to the previous one.
+ </p>
+ <p class="issue">
+ Totally imposible to follow what the above means. Need set of examples showing diffrent base IRI resolution, and restated @bases
+ </p>
+ </section>
- <table id="term2escape" class="separated" style="border-collapse:collapse;margin: 2em;">
- <thead>
- <tr>
- <th></th>
- <th>Turtle</th>
- <th>N-Triples</th>
- <th>example</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="r">absolute IRI</td>
- <td style="background-color: green; border:1px solid black;">yes</td>
- <td style="background-color: green; border:1px solid black;">yes</td>
- <td><code><http://a.example/some/path/></code></td>
- </tr>
- <tr>
- <td class="r">relative IRI</td>
- <td style="background-color: green; border:1px solid black;">yes</td>
- <td>no</td>
- <td><code></some/path/></code></td>
- </tr>
- <tr>
- <td class="r">prefixed name</td>
- <td style="background-color: green; border:1px solid black;">yes</td>
- <td>no</td>
- <td><code>foo:bar\=baz</code></td>
- </tr>
- <tr>
- <td class="r"><code>a</code> for the predicate <code>rdf:type</code></td>
- <td style="background-color: green; border:1px solid black;">yes</td>
- <td>no</td>
- <td><code>a</code></td>
- </tr>
- </tbody>
- </table>
- </section>
+
</section>
<section id="literals">
@@ -1189,6 +1163,48 @@
<li>More than one way to represent a single character
</ul>
</section>
+
+ <section id="iri-summary">
+ <h3>Summary of diffrences in IRI Representations in N-Triples and Turtle</h3>
+
+ <table id="term2escape" class="separated" style="border-collapse:collapse;margin: 2em;">
+ <thead>
+ <tr>
+ <th></th>
+ <th>Turtle</th>
+ <th>N-Triples</th>
+ <th>example</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="r">absolute IRI</td>
+ <td style="background-color: green; border:1px solid black;">yes</td>
+ <td style="background-color: green; border:1px solid black;">yes</td>
+ <td><code><http://a.example/some/path/></code></td>
+ </tr>
+ <tr>
+ <td class="r">relative IRI</td>
+ <td style="background-color: green; border:1px solid black;">yes</td>
+ <td>no</td>
+ <td><code></some/path/></code></td>
+ </tr>
+ <tr>
+ <td class="r">prefixed name</td>
+ <td style="background-color: green; border:1px solid black;">yes</td>
+ <td>no</td>
+ <td><code>foo:bar\=baz</code></td>
+ </tr>
+ <tr>
+ <td class="r"><code>a</code> for the predicate <code>rdf:type</code></td>
+ <td style="background-color: green; border:1px solid black;">yes</td>
+ <td>no</td>
+ <td><code>a</code></td>
+ </tr>
+ </tbody>
+ </table>
+ </section>
+
<section id="n-triples-compatibility" class="informative">
<h3>Compatibility with previous RDF Test Cases N-Triples</h3>
<p class="issue">This section is very prescriptive and contains no information not contained above.</p>