+ N-Triples Prime and Grammar n-triples
authorGavin Carothers <gavin@carothers.name>
Mon, 22 Aug 2011 16:24:11 -0700
branchn-triples
changeset 133 aa992bfafdca
parent 132 8d0a8b1bb60c
child 134 2425138ccd6a
+ N-Triples Prime and Grammar
rdf-turtle/index.html
rdf-turtle/n-prime.bnf
--- a/rdf-turtle/index.html	Mon Aug 22 13:00:56 2011 -0700
+++ b/rdf-turtle/index.html	Mon Aug 22 16:24:11 2011 -0700
@@ -856,6 +856,40 @@
           registration form.
           </p>
         </section>
+        
+        <!-- BEGIN N-TRIPLES SPEC -->
+
+      <section id="sec-triples">
+        <h2>N′-Triples</h2>
+        <p>This section defines an easy to parse line-based subset of
+Turtle. Currently named N-Triples Prime (<abbr title="N-Triples Prime">N′-triples</abbr>).</p>
+        <p>The syntax is an improved version of N-Triples. N-Triples is a format
+originally defined in the RDF Test Cases [[!RDF-TESTCASES]] document. Its original intent was for
+writing test cases, but it has proven to be popular as a dump format for RDF
+data.</p>
+        <section id="n-triple-changes" class="informative">
+          <h3>Changes from N-Triples</h3>
+          <ul>
+            <li>Default encoding is UTF-8 rather then US-ASCII only
+            <li>Uses IRIs rather then RDF URI References
+            <li>Defines a unique media type <code>text/ntriples+turtle</code>
+            <li>Subset of Turtle rather then Notation 3
+          </ul>
+        </section>
+        <section id="n-triples-compatibility"  class="informative">
+          <h3>Compatibility with previous N-Triples</h3>
+          <p>
+          An N-Triples document written using only absolute IRIs is a valid N′-triples document generating the same triples. N-triples uses <code>\u</code> escape sequences for characters outside US-ASCII and processing will have turned these into the original character. A N′-triples document that is serialized into ASCII and uses <code>\u</code> escape sequences for any character outside US-ASCII should be equivalent to a N-Triples document.
+          </p>
+        </section>
+        <section id="n-triple-grammar">
+          <h3>Grammar</h3>
+          <pre data-include="n-prime.bnf" data-oninclude="esc">
+          </pre>
+        </section>
+      </section>
+
+<!-- END N-TRIPLES SPEC -->
 
       <section id="sec-compared">
         <h2>Turtle compared</h2>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf-turtle/n-prime.bnf	Mon Aug 22 16:24:11 2011 -0700
@@ -0,0 +1,44 @@
+primeTriplesDoc         ::= (triple)*
+triple                  ::= subj pred obj '.'
+subj                    ::= IRI_REF | BLANK_NODE_LABEL
+pred                    ::= IRI_REF 
+obj                     ::= IRI_REF | BLANK_NODE_LABEL | lit
+lit                     ::= STRING_LITERAL2 ('^^' IRI_REF | ('@' LANG) )?
+
+@terminals
+LANG                    ::= [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*
+
+/* From Turtle */
+[70s] IRI_REF           ::= '<' ([^<>"{}|^`\]-[#x00-#x20] | UCHAR )* '>'
+[73s] BLANK_NODE_LABEL  ::= "_:" PN_LOCAL 
+[88s] STRING_LITERAL2   ::= '"' ( ( [^\"\\\n\r] ) | ECHAR | UCHAR )* '"' 
+[19] UCHAR              ::= ( "\\u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] ) 
+                            | ( "\\U" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] 
+                              [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] ) 
+[91s] ECHAR             ::= "\\" [tbnrf\\\"'] 
+[95s] PN_CHARS_BASE     ::= [A-Z] 
+                          | [a-z] 
+                          | [#00C0-#00D6] 
+                          | [#00D8-#00F6] 
+                          | [#00F8-#02FF] 
+                          | [#0370-#037D] 
+                          | [#037F-#1FFF] 
+                          | [#200C-#200D] 
+                          | [#2070-#218F] 
+                          | [#2C00-#2FEF] 
+                          | [#3001-#D7FF] 
+                          | [#F900-#FDCF] 
+                          | [#FDF0-#FFFD] 
+                          | [#10000-#EFFFF] 
+                          | UCHAR 
+[96s] PN_CHARS_U        ::= PN_CHARS_BASE 
+                          | "_" 
+[98s] PN_CHARS          ::= PN_CHARS_U 
+                          | "-" 
+                          | [0-9] 
+                          | #00B7 
+                          | [#0300-#036F] 
+                          | [#203F-#2040] 
+[100s] PN_LOCAL         ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | "." )* PN_CHARS )?
+
+@pass                   ::= [ \t\r\n]+ | "#" [^\r\n]* 
\ No newline at end of file