Adding inital draft of TriG
authorGavin Carothers <gavin@carothers.name>
Sat, 15 Oct 2011 11:00:59 -0700
changeset 158 ec587b0bd3bc
parent 157 2824e6f9576e
child 159 1c9eead4429e
Adding inital draft of TriG
trig/index.html
trig/trig.bnf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trig/index.html	Sat Oct 15 11:00:59 2011 -0700
@@ -0,0 +1,259 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+	<title>TriG</title>
+	<meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+	<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' class='remove'></script>
+	<script src='../ReSpec.js/js/respec.js' class='remove'></script>
+	<script class='remove'>
+      $.fn.renameElement = function (name) {
+        return this.each(function () {
+          var $newElement = $(this.ownerDocument.createElement(name));
+          for (var i = 0, n = this.attributes.length; i < n; i++) {
+            var attribute = this.attributes[i];
+            $newElement[0].setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
+          }
+          $(this).contents().appendTo($newElement);
+          $(this).replaceWith($newElement);
+        });
+      };
+      preprocessTrig = { apply: function (ignore) {
+          $("script[type='application/trig']").removeAttr('type').renameElement('span');
+          $("script[type='text/plain']").removeAttr('type').renameElement('span');
+        }
+      };
+      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:            "TriG",
+
+	  // if your specification has a subtitle that goes below the main
+	  // formal title, define it here
+	  subtitle   :  "Named Graph and RDF Dataset Language",
+
+	  // if you wish the publication date to be other than today, set this
+	  // publishDate:  "2011-08-09",
+
+	  // if the specification's copyright date is a range of years, specify
+	  // the start date here:
+	  copyrightStart: "2010",
+
+	  // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+	  // and its maturity status
+	  //previousPublishDate:  "2011-08-09",
+	  //previousMaturity:  "FPWD",
+	  //previousURI: "http://www.w3.org/TR/???",
+
+	  // if there a publicly available Editor's Draft, this is the link
+	  edDraftURI:           "http://dvcs.w3.org/hg/rdf/raw-file/default/trig/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: "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: "Chris Bizer", url: "http://www.bizer.de", 
+	      	company: "Freie Universität Berlin", companyURL: "http://www.fu-berlin.de/" },
+  	      { name: "Richard Cyganiak", url: "http://richard.cyganiak.de", 
+  	      	company: "Freie Universität Berlin", companyURL: "http://www.fu-berlin.de/" },
+	  ],
+	  
+	  // 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,
+	  preProcess: [ preprocessTrig ]
+      };
+    </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 Trig
+			that allows an RDF dataset to be completely written in a compact and
+			natural text form, with abbreviations for common usage patterns and
+			datatypes. TriG is an extension of the 
+			<a href="http://www.w3.org/TR/Turtle">Turtle</a> format.
+			</p>
+		</section>
+
+		<section id="sec-intro">
+			<h2>Introduction</h2>
+			<p>This document defines TriG a concrete syntax for RDF as defined in the
+			<a href="../rdf-concepts/index.html">RDF Concepts and Abstract Syntax</a> 
+			([[!RDF-CONCEPTS]]) W3C Recommendation. TriG is an extension of 
+			<a href="http://www.w3.org/TR/Turtle">Turtle</a> ([[!TURTLE]]), extended 
+			to support representing a complete RDF Dataset.
+		</section>
+
+		<section id="sec-trig-intro" class="informative">
+			<h2>An Introduction to TriG</h2>
+			<p>The
+			<a href="#sec-syntax">TriG Syntax</a> and <a href="#sec-grammar">TriG 
+			Grammar</a> sections formally define the language.
+			</p>
+
+			<p>A TriG document allows writing down an RDF Dataset in a compact
+			textual form.  It consists of a sequence of directives, graph statements 
+			which contain triple-generating statements and optional blank lines.  
+			Comments may be given after a <code>#</code> that is not part of another 
+			lexical token and continue to the end of the line.</p>
+			<p>
+
+			<p>Graph statements are a pair of an IRI and a group of triple statements
+			surrounded by <code>{}</code>. The IRI of the graph statement may not be
+			used in another graph statement, but may reoccur as part of any triple 
+			statement. Optionally one graph statement may not not be labeled with
+			an IRI. Such a graph statement corresponds to the Default Graph of an 
+			RDF Dataset.</p>
+
+			<section id="sec-graph-statements">
+				<h3>Graph Statements</h3>
+				<p class="issue"> Examples should not refer to TriX vocabularies.<p>
+				</p>
+				<p>A RDF Dataset may contain only named graphs.</p>
+
+				<pre class="example">
+					<script type="application/trig"># This document encodes three graphs.
+
[email protected] rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
[email protected] xsd: <http://www.w3.org/2001/XMLSchema#> .
[email protected] swp: <http://www.w3.org/2004/03/trix/swp-1/> .
[email protected] dc: <http://purl.org/dc/elements/1.1/> .
[email protected] ex: <http://www.example.org/vocabulary#> .
[email protected] : <http://www.example.org/exampleDocument#> .
+
+:G1 { :Monica ex:name "Monica Murphy" .      
+      :Monica ex:homepage <http://www.monicamurphy.org> .
+      :Monica ex:email <mailto:[email protected]> .
+      :Monica ex:hasSkill ex:Management }
+
+:G2 { :Monica rdf:type ex:Person .
+      :Monica ex:hasSkill ex:Programming }
+
+:G3 { :G1 swp:assertedBy _:w1 .
+      _:w1 swp:authority :Chris .
+      _:w1 dc:date "2003-10-02"^^xsd:date .   
+      :G2 swp:quotedBy _:w2 .
+      :G3 swp:assertedBy _:w2 .
+      _:w2 dc:date "2003-09-03"^^xsd:date .
+      _:w2 swp:authority :Chris .
+      :Chris rdf:type ex:Person .  
+      :Chris ex:email <mailto:[email protected]> }
+					</script>
+				</pre>
+				<p>A RDF Dataset may contain only single graph.</p>
+				<pre class="example">
+					<script type="application/trig"># This document encodes one graph.
[email protected] ex: <http://www.example.org/vocabulary#> .
[email protected] : <http://www.example.org/exampleDocument#> .
+
+:G1 { :Monica a ex:Person ;
+              ex:name "Monica Murphy" ;      
+              ex:homepage <http://www.monicamurphy.org> ;
+              ex:email <mailto:[email protected]> ;
+              ex:hasSkill ex:Management ,
+                          ex:Programming . } .
+					</script>
+				</pre>
+				<p>A RDF Dataset may contain a default graph, and named graphs.</p>
+				<pre class="example">
+				<script type="application/trig"># This document contains a default graph and two named graphs.
+
[email protected] rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
[email protected] dc: <http://purl.org/dc/elements/1.1/> .
[email protected] foaf: <http://xmlns.com/foaf/0.1/> .
+
+# default graph
+    { 
+      <http://example.org/bob> dc:publisher "Bob" . 
+      <http://example.org/alice> dc:publisher "Alice" .
+    }
+
+<http://example.org/bob> 
+    { 
+       _:a foaf:name "Bob" . 
+       _:a foaf:mbox <mailto:[email protected]> .
+    }
+ 
+<http://example.org/alice>
+    { 
+       _:a foaf:name "Alice" . 
+       _:a foaf:mbox <mailto:[email protected]> .
+    }				</script>
+				</pre>
+			</section>
+			<section>
+				<h3>Other Terms</h3>
+				<p>All other terms and directives come from Turtle.</p>
+			</section>
+		</section>
+
+		<section id="sec-syntax">
+			<h2>Syntax</h2>
+
+		</section>
+		<section id="sec-grammar">
+			<h2>TriG Grammar</h2>
+			<p>Defer to Turtle</p>
+			<section id="grammar-ebnf">
+				<h3>Grammar</h3>
+	            <p>The <abbr title="Extended Backus–Naur Form">EBNF</abbr> used here is defined in XML 1.0 (Third Edition) [[!EBNF-NOTATION]]. </p>
+	            <pre>
+<span data-include="trig.bnf">
+</span>
+	            </pre>
+            </p>
+
+			</section>
+		</section>
+        <section id="sec-mime" class="informative">
+          <h2>Media Type and Content Encoding</h2>
+          
+          <p>The media type of TriG is <code>application/trig</code>.
+          The content encoding of Turtle content is always UTF-8. 
+          See <a href="#sec-mediaReg">Internet Media 
+          Type, File Extension and Macintosh File Type</a> for the media type 
+          registration form.
+          </p>
+        </section>
+
+      <section id="sec-mediaReg" class="appendix">
+        <h2>Internet Media Type, File Extension and Macintosh File Type</h2>
+        <p class="issue">
+        TODO
+        </p>
+    </section>
+	</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trig/trig.bnf	Sat Oct 15 11:00:59 2011 -0700
@@ -0,0 +1,157 @@
+[1g] trigDoc ::= (graph_statement)* 
+ 
+[2g] graph_statement ::= directive "." 
+ | graph
+
+[3g] graph ::= graphIri? "{" (triples ".")* "}"
+
+[4g] graphIri ::= IRIref
+
+# Remaining from Turtle
+
+[3] directive ::= prefixID 
+ | base 
+[4] prefixID ::= PREFIX PNAME_NS IRI_REF 
+ 
+[5] base ::= BASE IRI_REF 
+ 
+[6] triples ::= subject predicateObjectList 
+ 
+[7] predicateObjectList ::= verb objectList ( ';' ( verb objectList )? )*
+ 
+[8] objectList ::= object ( "," object )* 
+ 
+[9] verb ::= predicate 
+ | "a" 
+[10] subject ::= IRIref 
+ | blank 
+[11] predicate ::= IRIref 
+ 
+[12] object ::= IRIref 
+ | blank 
+ | literal 
+[13] literal ::= RDFLiteral 
+ | NumericLiteral 
+ | BooleanLiteral 
+[14] blank ::= BlankNode 
+ | blankNodePropertyList 
+ | collection 
+[15] blankNodePropertyList ::= "[" predicateObjectList "]" 
+ 
+[16] collection ::= "(" object* ")" 
+ 
+[60s] RDFLiteral ::= String ( LANGTAG | ( "^^" IRIref ) )? 
+ 
+[61s] NumericLiteral ::= NumericLiteralUnsigned 
+ | NumericLiteralPositive 
+ | NumericLiteralNegative 
+[62s] NumericLiteralUnsigned ::= INTEGER 
+ | DECIMAL 
+ | DOUBLE 
+[63s] NumericLiteralPositive ::= INTEGER_POSITIVE 
+ | DECIMAL_POSITIVE 
+ | DOUBLE_POSITIVE 
+[64s] NumericLiteralNegative ::= INTEGER_NEGATIVE 
+ | DECIMAL_NEGATIVE 
+ | DOUBLE_NEGATIVE 
+[65s] BooleanLiteral ::= "true" 
+ | "false" 
+[66s] String ::= STRING_LITERAL1 
+ | STRING_LITERAL2 
+ | STRING_LITERAL_LONG1 
+ | STRING_LITERAL_LONG2 
+[67s] IRIref ::= IRI_REF 
+ | PrefixedName 
+[68s] PrefixedName ::= PNAME_LN 
+ | PNAME_NS 
+[69s] BlankNode ::= BLANK_NODE_LABEL 
+ | ANON 
+
[email protected]
+
+[17] BASE ::= "@base" 
+ 
+[18] PREFIX ::= "@prefix" 
+ 
+[70s] IRI_REF ::= "<" ( [^<>\"{}|^`\\] - [#0000- ] | UCHAR )* ">" 
+ 
+[71s] PNAME_NS ::= (PN_PREFIX)? ":" 
+ 
+[72s] PNAME_LN ::= PNAME_NS PN_LOCAL 
+ 
+[73s] BLANK_NODE_LABEL ::= "_:" PN_LOCAL 
+ 
+[76s] LANGTAG ::= BASE 
+ | PREFIX 
+ | "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )* 
+[77s] INTEGER ::= [0-9]+ 
+ 
+[78s] DECIMAL ::= [0-9]+ "." [0-9]+ 
+ | "." [0-9]+ 
+[79s] DOUBLE ::= [0-9]+ "." [0-9]+ EXPONENT 
+ | "." ( [0-9] )+ EXPONENT 
+ | ( [0-9] )+ EXPONENT 
+[80s] INTEGER_POSITIVE ::= "+" INTEGER 
+ 
+[81s] DECIMAL_POSITIVE ::= "+" DECIMAL 
+ 
+[82s] DOUBLE_POSITIVE ::= "+" DOUBLE 
+ 
+[83s] INTEGER_NEGATIVE ::= "-" INTEGER 
+ 
+[84s] DECIMAL_NEGATIVE ::= "-" DECIMAL 
+ 
+[85s] DOUBLE_NEGATIVE ::= "-" DOUBLE 
+ 
+[86s] EXPONENT ::= [eE] [+-]? [0-9]+ 
+ 
+[87s] STRING_LITERAL1 ::= "'" ( ( [^'\\\n\r] ) | ECHAR | UCHAR )* "'" 
+ 
+[88s] STRING_LITERAL2 ::= '"' ( ( [^\"\\\n\r] ) | ECHAR | UCHAR )* '"' 
+ 
+[89s] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\\] | ECHAR | UCHAR ) )* "'''" 
+ 
+[90s] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^\"\\] | 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\\\"'] 
+ 
+[92s] NIL ::= "(" (WS)* ")" 
+ 
+[93s] WS ::= " " 
+ | "\t" 
+ | "\r" 
+ | "\n" 
+[94s] ANON ::= "[" (WS)* "]" 
+ 
+[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] 
+[99s] PN_PREFIX ::= PN_CHARS_BASE ( ( PN_CHARS | "." )* PN_CHARS )? 
+ 
+[100s] PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | "." )* PN_CHARS )? 
+ 
[email protected] ::= [ \t\r\n]+ 
+ | "#" [^\r\n]* 
\ No newline at end of file