--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf-json/index.html Tue Aug 23 02:52:49 2011 +0100
@@ -0,0 +1,413 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>RDF 1.1 JSON Serialisation (RDF/JSON)</title>
+ <style>
+.figure { font-weight: bold; text-align: center; }
+ </style>
+ <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: "rdf11-json",
+
+ // if your specification has a subtitle that goes below the main
+ // formal title, define it here
+ // subtitle : "an excellent document",
+
+ // 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: "2004",
+
+ // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+ // and its maturity status
+// previousPublishDate: "2004-02-10",
+// previousMaturity: "REC",
+
+ // if there a publicly available Editor's Draft, this is the link
+//@@@
+ edDraftURI: "http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-json/index.html",
+
+ // if this is a LCWD, uncomment and set the end of its review period
+ // lcEnd: "2009-08-05",
+
+ // if there is an earler version of this specification at the Recommendation level,
+ // set this to the shortname of that version. This is optional and not usually
+ // necessary.
+
+ // 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: "Ian Davis", url: "http://iandavis.com/",
+ company: "Talis", companyURL: "http://www.talis.com/",
+ },
+ { name: "Thomas Steiner", // url: "http://example.org/",
+ company: "Google Inc.", companyURL: "http://www.google.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: "Your Name", url: "http://example.org/",
+ // company: "Your Company", companyURL: "http://example.com/" },
+ //],
+
+ // 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",
+
+ // if this parameter is set to true, ReSpec.js will embed various RDFa attributes
+ // throughout the generated specification. The triples generated use vocabulary items
+ // from the dcterms, foaf, and bibo. The parameter defaults to false.
+ doRDFa: true,
+ };
+
+// @@@ A number of references have been patched into the local berjon.biblio and need to be added to the global biblio in CVS:
+ </script>
+ </head>
+
+ <body>
+
+<section id="abstract">
+ <p>The Resource Description Framework (RDF) is a framework for
+ representing information in the Web.</p>
+ <p>This document defines a textual syntax for RDF called RDF/JSON that
+ allows an RDF graph to be completely written in a form compatible
+ with the JavaScript Object Notation (JSON) [[!RFC4627]].</p>
+</section>
+
+
+<section id="section-intro">
+ <h2>Introduction</h2>
+
+ <p>This document defines RDF/JSON, a concrete syntax
+ in JavaScript Object Notation (JSON) ([[!RFC4627]]). for RDF as
+ defined in the RDF Concepts and Abstract Syntax
+ ([[!RDF-CONCEPTS]]) W3C Recommendation.</p>
+
+</section>
+
+
+<section id="conformance"></section>
+
+<section class="informative">
+
+ <h2>Overview of RDF/JSON</h2>
+
+ <p>An RDF Graph consists of a set of RDF triples, each triple consisting
+ of a subject, a predicate and an object (formally defined in [[!RDF-CONCEPTS]]).
+ An RDF/JSON document serializes such a set of RDF triples as a series of nested
+ data structures. </p>
+
+ <p>A conforming RDF/JSON document consists of a single JSON object called
+ the root object. Each unique subject in the set of triples is represented as a key
+ in the root object. No key may appear more than once in the root object.</p>
+
+ <p>The value of each root object key is a further JSON object whose
+ keys are the URIs of the predicates occuring in triples with the
+ given subject. These keys are known as predicate keys.
+ No predicate key may appear more than once within a single object.</p>
+
+ <p>The value of each predicate key is an array of JSON objects representing
+ the object of each serialized triple.</p>
+
+
+
+ <p>In general, a triple (subject S, predicate P, object O) is
+ serialized in the following structure:</p>
+
+ <pre>{ "S" : { "P" : [ O ] } }</pre>
+
+ <p>The object of the triple O is represented as a further JSON
+ object with the following keys:</p>
+
+ <dl>
+ <dt>type</dt>
+ <dd>one of 'uri', 'literal' or 'bnode' (required and must be lowercase)</dd>
+ <dt>value</dt>
+ <dd>the URI of the object, its lexical value or a blank node label depending on whether the object is a uri, literal or bnode
+ </dd>
+ <dt>lang</dt>
+ <dd>the language of a literal value (optional but if supplied it must not be empty)</dd>
+ <dt>datatype</dt>
+ <dd>the datatype URI of the literal value (optional)</dd>
+ </dl>
+
+ <p>Blank node subjects are named using a string conforming to the nodeID production in Turtle. For example: _:A1</p>
+
+ <p>The 'lang' and 'datatype' keys should only be used if the value of the 'type' key is "literal".</p>
+
+
+</section>
+
+<section id="section-serialization">
+ <h2>Serialization of RDF as JSON</h2>
+ <p>Given a set of RDF Triples an RDF/JSON document may constructed using the following algorithm:</p>
+ <ol>
+ <li>Start a JSON object (called the root object)</li>
+ <li>Group all the triples by subject</li>
+ <li>For each unique subject:
+ <ol>
+ <li>Create a JSON object for the subject (called the subject object)</li>
+ <li>Group all triples having the current subject by predicate</li>
+ <li>For each unique predicate:
+ <ol>
+ <li>Create a JSON array (called the value array)</li>
+ <li>Select all triples having the current subject and current predicate</li>
+ <li>For each triple:
+ <ol>
+ <li>Create a JSON object (called the value object)</li>
+ <li>Add the following key/value pairs to the value object:
+ <ul>
+ <li>If the object of the triple is an RDF URI Reference
+ U add a key called "type" with a value being the string "uri". Add a key
+ called "value" with the value being U</li>
+ <li>If the object of the triple is an RDF Literal S
+ add a key called "type" with a value being the string "literal". Add a key
+ called "value" with the value being S</li>
+ <li>If the object of the triple is an RDF Literal S with language L
+ add a key called "type" with a value being the string "literal". Add a key
+ called "value" with the value being S. Add a key called "lang" with the
+ value being L</li>
+ <li>If the object of the triple is an RDF Typed Literal S with datatype URI D
+ add a key called "type" with a value being the string "literal". Add a key
+ called "value" with the value being S. Add a key called "datatype" with the
+ value being D</li>
+ <li>If the object of the triple is a Blank Node with label I
+ add a key called "type" with a value being the string "bnode". Add a key
+ called "value" with the value being the string formed by concatenting an underscore (U+005F) followed by a colon (U+003A) followed by I</li>
+ </ul>
+ </li>
+ <li>Push the value object onto the end of the value array</li>
+ </ol>
+ <li>Add a key/value pair to the subject object with the key being the predicate URI and the value being the value array</li>
+ </ol>
+ </li>
+ <li>Add a key/value pair to the root object with value being the subject object created in the previous step and the key being one of the following:
+ <ul>
+ <li>If the subject of the triple is an RDF URI Reference U the key is U</li>
+ <li>If the subject of the triple is a Blank Node with label I
+ the key is the string formed by concatenting an underscore (U+005F) followed by a colon (U+003A) followed by I</li>
+ </ul>
+ </li>
+ </ol>
+ </li>
+ </ol>
+
+
+
+
+</section>
+
+<section id="sec-examples" class="informative">
+ <h2>Examples</h2>
+
+ <p>An example of a single triple with a literal object having a language of "en"</p>
+ <pre class="example">
+ {
+ "http://example.org/about" : {
+ "http://purl.org/dc/terms/title" : [ { "value" : "Anna's Homepage",
+ "type" : "literal",
+ "lang" : "en" } ]
+ }
+ }
+ </pre>
+
+ <p>An example of two triples that share the same subject and predicate
+ but have differing objects:</p>
+ <pre class="example">
+ {
+ "http://example.org/about" : {
+ "http://purl.org/dc/terms/title" : [ { "value" : "Anna's Homepage",
+ "type" : "literal",
+ "lang" : "en" },
+ { "value" : "Annas hjemmeside",
+ "type" : "literal",
+ "lang" : "da" } ]
+ }
+ }
+ </pre>
+
+ <p>An example of a triple with a datatyped literal object:</p>
+ <pre class="example">
+ {
+ "http://example.org/about" : {
+ "http://purl.org/dc/terms/title" : [ { "value" : "<p xmlns=\"http://www.w3.org/1999/xhtml\"><b>Anna's</b> Homepage>/p>",
+ "type" : "literal",
+ "datatype" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral" } ]
+ }
+ }
+ </pre>
+
+ <p>An example of triples with a common blank node:</p>
+ <pre class="example">
+ {
+ "http://example.org/about" : {
+ "http://purl.org/dc/terms/creator" : [ { "value" : "_:anna",
+ "type" : "bnode" } ] ,
+ "_:anna" : {
+ "http://xmlns.com/foaf/0.1/name" : [ { "value" : "Anna",
+ "type" : "literal" } ]
+ }
+ }
+ </pre>
+
+ <p>An example of a triple with a URI object:</p>
+ <pre class="example">
+ {
+ "_:anna" : {
+ "http://xmlns.com/foaf/0.1/homepage" : [ { "value" : "http://example.org/anna",
+ "type" : "uri" } ]
+ }
+ }
+ </pre>
+
+ <p>An example of triples with common subjects:</p>
+ <pre class="example">
+ {
+ "_:anna" : {
+ "http://xmlns.com/foaf/0.1/name" : [ { "value" : "Anna",
+ "type" : "literal" } ],
+ "http://xmlns.com/foaf/0.1/homepage" : [ { "value" : "http://example.org/anna",
+ "type" : "uri" } ]
+ }
+ }
+ </pre>
+
+ <p>An empty RDF graph is serialized as a JSON object with zero keys.</p>
+ <pre class="example">{ }</pre>
+
+</section>
+
+<section id="section-Acknowledgments" class="informative">
+ <h2>Acknowledgments</h2>
+
+ <p class="issue">This section does not yet list those who made
+ contributions to the RDF 1.1 version, nor does it list the
+ current RDF WG members.</p>
+
+ <p>The RDF 2004 editors acknowledge valuable contributions from
+ Frank Manola, Pat Hayes, Dan Brickley, Jos de Roo,
+ Dave Beckett, Patrick Stickler, Peter F. Patel-Schneider, Jerome Euzenat,
+ Massimo Marchiori, Tim Berners-Lee, Dave Reynolds and Dan Connolly.</p>
+
+ <p>This specification contains a significant contribution from the
+ designers of the RDF typed literal mechanism, Pat
+ Hayes, Sergey Melnik and Patrick Stickler. The document draws upon an earlier
+ RDF Model and Syntax document edited by Ora Lassilla and Ralph Swick,
+ and RDF Schema edited by Dan Brickley and R. V. Guha.</p>
+
+ <p>This specification is a product of extended deliberations by the
+ <a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-Acknowledgments">members
+ of the RDFcore Working Group and the RDF and RDF Schema Working Group</a>.</p>
+</section>
+
+ <section id="sec-mediaReg" class="appendix">
+ <h2>Internet Media Type, File Extension and Macintosh File Type (Normative)</h2>
+ <dl>
+ <dt>Contact:</dt>
+ <dd>Ian Davis</dd>
+ <dt>See also:</dt>
+
+ <dd><a href="http://www.w3.org/2002/06/registering-mediatype">How to Register a Media Type for a W3C Specification</a></dd>
+ <dd><a href="http://www.w3.org/2001/tag/2002/0129-mime">Internet Media Type registration, consistency of use</a><br />TAG Finding 3 June 2002 (Revised 4 September 2002)</dd>
+ </dl>
+ <p>The Internet Media Type / MIME Type for RDF/JSON is "application/rdf+json".</p>
+ <p>It is recommended that RDF/JSON files have the extension ".rj" (all lowercase) on all platforms.</p>
+
+ <p>It is recommended that RDF/JSON files stored on Macintosh HFS file systems be given a file type of "TEXT".</p>
+ <p>This information that follows will be submitted to the IESG for review, approval, and registration with IANA.</p>
+ <dl>
+ <dt>Type name:</dt>
+ <dd>text</dd>
+
+ <dt>Subtype name:</dt>
+ <dd>rdf+json</dd>
+ <dt>Required parameters:</dt>
+ <dd>None</dd>
+ <dt>Optional parameters:</dt>
+ <dd>None</dd>
+
+ <dt>Encoding considerations:</dt>
+ <dd>The encoding considerations of the SPARQL Query Results JSON Format is identical to those of the "application/json" as specified in [[!RFC4627]]</dd>
+ <dd>Unicode code points may also be expressed using an \uXXXX (U+0 to U+FFFF) or \UXXXXXXXX syntax (for U+10000 onwards) where X is a hexadecimal digit [0-9A-F]</dd>
+ <dt>Security considerations:</dt>
+ <dd>RDF/JSON is a general-purpose assertion language; applications may evaluate given data to infer more assertions or to dereference IRIs, invoking the security considerations of the scheme for that IRI. Note in particular, the privacy issues in [[!RFC3023]] section 10 for HTTP IRIs. Data obtained from an inaccurate or malicious data source may lead to inaccurate or misleading conclusions, as well as the dereferencing of unintended IRIs. Care must be taken to align the trust in consulted resources with the sensitivity of the intended use of the data; inferences of potential medical treatments would likely require different trust than inferences for trip planning.</dd>
+
+ <dd>RDF/JSON is used to express arbitrary application data; security considerations will vary by domain of use. Security tools and protocols applicable to text (e.g. PGP encryption, MD5 sum validation, password-protected compression) may also be used on Turtle documents. Security/privacy protocols must be imposed which reflect the sensitivity of the embedded information.</dd>
+ <dd>RDF/JSON can express data which is presented to the user, for example, RDF Schema labels. Application rendering strings retrieved from untrusted RDF/JSON documents must ensure that malignant strings may not be used to mislead the reader. The security considerations in the media type registration for XML ([[!RFC3023]] section 10) provide additional guidance around the expression of arbitrary data and markup.</dd>
+ <dd>RDF/JSON uses IRIs as term identifiers. Applications interpreting data expressed in Turtle should address the security issues of
+ <a class="norm" href="http://www.ietf.org/rfc/rfc3987.txt">Internationalized Resource Identifiers (IRIs)</a> [[!RFC3987]] Section 8, as well as
+ <a class="norm" href="http://www.ietf.org/rfc/rfc3986.txt">Uniform Resource Identifier (URI): Generic Syntax</a> [[!RFC3986]] Section 7.</dd>
+
+ <dd>Multiple IRIs may have the same appearance. Characters in different scripts may
+ look similar (a Cyrillic "о" may appear similar to a Latin "o"). A character followed
+ by combining characters may have the same visual representation as another character
+ (LATIN SMALL LETTER E followed by COMBINING ACUTE ACCENT has the same visual representation
+ as LATIN SMALL LETTER E WITH ACUTE).
+ <!-- (<code>foo:resum鼯code> and <code>fоо:resumé</code>)-->
+ Any person or application that is writing or interpreting data in RDF/JSON must take care to use the IRI that matches the intended semantics, and avoid IRIs that make look similar.
+ Further information about matching of similar characters can be found
+ in <a class="inform" href="http://www.unicode.org/reports/tr36/">Unicode Security
+ Considerations</a> [[UNISEC]] and
+ <a class="norm" href="http://www.ietf.org/rfc/rfc3987.txt">Internationalized Resource
+ Identifiers (IRIs)</a> [[RFC3987]] Section 8.
+
+
+ <dt>Interoperability considerations:</dt>
+ <dd>There are no known interoperability issues.</dd>
+ <dt>Published specification:</dt>
+ <dd>This specification.</dd>
+ <dt>Applications which use this media type:</dt>
+ <dd>No widely deployed applications are known to use this media type. It may be used by some web services and clients consuming their data.</dd>
+ <dt>Additional information:</dt>
+ <dt>Magic number(s):</dt>
+ <dd>None</dd>
+ <dt>File extension(s):</dt>
+ <dd>".rj"</dd>
+ <dt>Macintosh file type code(s):</dt>
+ <dd>"TEXT"</dd>
+ <dt>Person & email address to contact for further information:</dt>
+
+ <dd>Ian Davis, Thomas Steiner <public-rdf-comments@w3.org></dd>
+ <dt>Intended usage:</dt>
+ <dd>COMMON</dd>
+ <dt>Restrictions on usage:</dt>
+ <dd>None</dd>
+ <dt>Author/Change controller:</dt>
+ <dd>The RDF/JSON specificationis a work product of the World Wide Web Consortium's RDF Working Group. The W3C has change control over these specifications.</dd>
+ </dl>
+ </section>
+
+
+<section id="references"></section>
+
+ </body>
+</html>
+