--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf-json/Overview.html Thu Aug 29 17:16:48 2013 +0100
@@ -0,0 +1,763 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN' 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
+<html dir="ltr" about="" property="dcterms:language" content="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:dcterms='http://purl.org/dc/terms/' xmlns:bibo='http://purl.org/ontology/bibo/' xmlns:foaf='http://xmlns.com/foaf/0.1/' xmlns:xsd='http://www.w3.org/2001/XMLSchema#' version="XHTML+RDFa 1.0" typeof="bibo:Document">
+<head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+ <title>RDF 1.1 JSON Alternate Serialization (RDF/JSON)</title>
+ <style>
+.figure { font-weight: bold; text-align: center; }
+ </style>
+
+
+ <style type="text/css">
+/*****************************************************************
+ * ReSpec CSS
+ * Robin Berjon (robin at berjon dot com)
+ * v0.05 - 2009-07-31
+ *****************************************************************/
+
+
+/* --- INLINES --- */
+em.rfc2119 {
+ text-transform: lowercase;
+ font-variant: small-caps;
+ font-style: normal;
+ color: #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+ border: none;
+}
+
+dfn {
+ font-weight: bold;
+}
+
+a.internalDFN {
+ color: inherit;
+ border-bottom: 1px solid #99c;
+ text-decoration: none;
+}
+
+a.externalDFN {
+ color: inherit;
+ border-bottom: 1px dotted #ccc;
+ text-decoration: none;
+}
+
+a.bibref {
+ text-decoration: none;
+}
+
+code {
+ color: #ff4500;
+}
+
+
+/* --- WEB IDL --- */
+pre.idl {
+ border-top: 1px solid #90b8de;
+ border-bottom: 1px solid #90b8de;
+ padding: 1em;
+ line-height: 120%;
+}
+
+pre.idl::before {
+ content: "WebIDL";
+ display: block;
+ width: 150px;
+ background: #90b8de;
+ color: #fff;
+ font-family: initial;
+ padding: 3px;
+ font-weight: bold;
+ margin: -1em 0 1em -1em;
+}
+
+.idlType {
+ color: #ff4500;
+ font-weight: bold;
+ text-decoration: none;
+}
+
+/*.idlModule*/
+/*.idlModuleID*/
+/*.idlInterface*/
+.idlInterfaceID, .idlDictionaryID {
+ font-weight: bold;
+ color: #005a9c;
+}
+
+.idlSuperclass {
+ font-style: italic;
+ color: #005a9c;
+}
+
+/*.idlAttribute*/
+.idlAttrType, .idlFieldType, .idlMemberType {
+ color: #005a9c;
+}
+.idlAttrName, .idlFieldName, .idlMemberName {
+ color: #ff4500;
+}
+.idlAttrName a, .idlFieldName a, .idlMemberName a {
+ color: #ff4500;
+ border-bottom: 1px dotted #ff4500;
+ text-decoration: none;
+}
+
+/*.idlMethod*/
+.idlMethType {
+ color: #005a9c;
+}
+.idlMethName {
+ color: #ff4500;
+}
+.idlMethName a {
+ color: #ff4500;
+ border-bottom: 1px dotted #ff4500;
+ text-decoration: none;
+}
+
+/*.idlParam*/
+.idlParamType {
+ color: #005a9c;
+}
+.idlParamName {
+ font-style: italic;
+}
+
+.extAttr {
+ color: #666;
+}
+
+/*.idlConst*/
+.idlConstType {
+ color: #005a9c;
+}
+.idlConstName {
+ color: #ff4500;
+}
+.idlConstName a {
+ color: #ff4500;
+ border-bottom: 1px dotted #ff4500;
+ text-decoration: none;
+}
+
+/*.idlException*/
+.idlExceptionID {
+ font-weight: bold;
+ color: #c00;
+}
+
+.idlTypedefID, .idlTypedefType {
+ color: #005a9c;
+}
+
+.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
+ color: #c00;
+ font-weight: normal;
+}
+
+.excName a {
+ font-family: monospace;
+}
+
+.idlRaises a.idlType, .excName a.idlType {
+ border-bottom: 1px dotted #c00;
+}
+
+.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
+ width: 45px;
+ text-align: center;
+}
+.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; }
+.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; }
+
+.idlImplements a {
+ font-weight: bold;
+}
+
+dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
+ margin-left: 2em;
+}
+
+.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
+ font-weight: normal;
+}
+
+.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
+ font-weight: bold;
+ color: #000;
+ font-family: monospace;
+}
+
+.attributes dt code, .fields dt code, .dictionary-members dt code {
+ background: #ffffd2;
+}
+
+.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
+ color: #005a9c;
+ background: transparent;
+ font-family: inherit;
+ font-weight: normal;
+ font-style: italic;
+}
+
+.methods dt code {
+ background: #d9e6f8;
+}
+
+.constants dt code {
+ background: #ddffd2;
+}
+
+.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
+ margin-bottom: 1em;
+}
+
+table.parameters, table.exceptions {
+ border-spacing: 0;
+ border-collapse: collapse;
+ margin: 0.5em 0;
+ width: 100%;
+}
+table.parameters { border-bottom: 1px solid #90b8de; }
+table.exceptions { border-bottom: 1px solid #deb890; }
+
+.parameters th, .exceptions th {
+ color: #fff;
+ padding: 3px 5px;
+ text-align: left;
+ font-family: initial;
+ font-weight: normal;
+ text-shadow: #666 1px 1px 0;
+}
+.parameters th { background: #90b8de; }
+.exceptions th { background: #deb890; }
+
+.parameters td, .exceptions td {
+ padding: 3px 10px;
+ border-top: 1px solid #ddd;
+ vertical-align: top;
+}
+
+.parameters tr:first-child td, .exceptions tr:first-child td {
+ border-top: none;
+}
+
+.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
+ width: 100px;
+}
+
+.parameters td.prmType {
+ width: 120px;
+}
+
+table.exceptions table {
+ border-spacing: 0;
+ border-collapse: collapse;
+ width: 100%;
+}
+
+/* --- TOC --- */
+.toc a {
+ text-decoration: none;
+}
+
+a .secno {
+ color: #000;
+}
+
+/* --- TABLE --- */
+table.simple {
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-bottom: 3px solid #005a9c;
+}
+
+.simple th {
+ background: #005a9c;
+ color: #fff;
+ padding: 3px 5px;
+ text-align: left;
+}
+
+.simple th[scope="row"] {
+ background: inherit;
+ color: inherit;
+ border-top: 1px solid #ddd;
+}
+
+.simple td {
+ padding: 3px 10px;
+ border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+ background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+ margin-top: 0;
+}
+
+.section dd > p:last-child {
+ margin-bottom: 0;
+}
+
+.section dd {
+ margin-bottom: 1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+ margin-bottom: 0;
+}
+
+/* --- EXAMPLES --- */
+pre.example {
+ border-top: 1px solid #ff4500;
+ border-bottom: 1px solid #ff4500;
+ padding: 1em;
+ margin-top: 1em;
+}
+
+pre.example::before {
+ content: "Example";
+ display: block;
+ width: 150px;
+ background: #ff4500;
+ color: #fff;
+ font-family: initial;
+ padding: 3px;
+ font-weight: bold;
+ margin: -1em 0 1em -1em;
+}
+
+/* --- EDITORIAL NOTES --- */
+.issue {
+ padding: 1em;
+ margin: 1em 0em 0em;
+ border: 1px solid #f00;
+ background: #ffc;
+}
+
+.issue::before {
+ content: "Issue";
+ display: block;
+ width: 150px;
+ margin: -1.5em 0 0.5em 0;
+ font-weight: bold;
+ border: 1px solid #f00;
+ background: #fff;
+ padding: 3px 1em;
+}
+
+.note {
+ margin: 1em 0em 0em;
+ padding: 1em;
+ border: 2px solid #cff6d9;
+ background: #e2fff0;
+}
+
+.note::before {
+ content: "Note";
+ display: block;
+ width: 150px;
+ margin: -1.5em 0 0.5em 0;
+ font-weight: bold;
+ border: 1px solid #cff6d9;
+ background: #fff;
+ padding: 3px 1em;
+}
+
+/* --- Best Practices --- */
+div.practice {
+ border: solid #bebebe 1px;
+ margin: 2em 1em 1em 2em;
+}
+
+span.practicelab {
+ margin: 1.5em 0.5em 1em 1em;
+ font-weight: bold;
+ font-style: italic;
+}
+
+span.practicelab { background: #dfffff; }
+
+span.practicelab {
+ position: relative;
+ padding: 0 0.5em;
+ top: -1.5em;
+}
+
+p.practicedesc {
+ margin: 1.5em 0.5em 1em 1em;
+}
+
+@media screen {
+ p.practicedesc {
+ position: relative;
+ top: -2em;
+ padding: 0;
+ margin: 1.5em 0.5em -1em 1em;
+ }
+}
+
+/* --- SYNTAX HIGHLIGHTING --- */
+pre.sh_sourceCode {
+ background-color: white;
+ color: black;
+ font-style: normal;
+ font-weight: normal;
+}
+
+pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; } /* language keywords */
+pre.sh_sourceCode .sh_type { color: #666; } /* basic types */
+pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
+pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
+pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
+pre.sh_sourceCode .sh_specialchar { color: #ffc0cb; font-family: monospace; } /* e.g., \n, \t, \\ */
+pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; } /* comments */
+pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
+pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; } /* e.g., #include, import */
+pre.sh_sourceCode .sh_symbol { color: blue; } /* e.g., *, + */
+pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
+pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
+pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; } /* TODO and FIXME */
+
+/* Predefined variables and functions (for instance glsl) */
+pre.sh_sourceCode .sh_predef_var { color: #00008B; }
+pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }
+
+/* for OOP */
+pre.sh_sourceCode .sh_classname { color: teal; }
+
+/* line numbers (not yet implemented) */
+pre.sh_sourceCode .sh_linenum { display: none; }
+
+/* Internet related */
+pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
+
+/* for ChangeLog and Log files */
+pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
+pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
+pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }
+
+/* for Prolog, Perl... */
+pre.sh_sourceCode .sh_variable { color: #006400; }
+
+/* for LaTeX */
+pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
+pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
+pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
+pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
+pre.sh_sourceCode .sh_argument { color: #006400; }
+pre.sh_sourceCode .sh_optionalargument { color: purple; }
+pre.sh_sourceCode .sh_math { color: orange; }
+pre.sh_sourceCode .sh_bibtex { color: blue; }
+
+/* for diffs */
+pre.sh_sourceCode .sh_oldfile { color: orange; }
+pre.sh_sourceCode .sh_newfile { color: #006400; }
+pre.sh_sourceCode .sh_difflines { color: blue; }
+
+/* for css */
+pre.sh_sourceCode .sh_selector { color: purple; }
+pre.sh_sourceCode .sh_property { color: blue; }
+pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }
+
+/* other */
+pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
+pre.sh_sourceCode .sh_paren { color: red; }
+pre.sh_sourceCode .sh_attribute { color: #006400; }
+
+</style><link href="https://www.w3.org/StyleSheets/TR/W3C-WG-NOTE" rel="stylesheet" type="text/css" charset="utf-8" /></head>
+
+ <body style="display: inherit;"><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" alt="W3C" src="http://www.w3.org/Icons/w3c_home" /></a></p><h1 id="title" class="title" property="dcterms:title">RDF 1.1 JSON Alternate Serialization (RDF/JSON)</h1><h2 content="2013-08-28T07:00:00+0000" datatype="xsd:dateTime" property="dcterms:issued" id="w3c-working-group-note-28-august-2013"><acronym title="World Wide Web Consortium">W3C</acronym> Working Group Note 28 August 2013</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2013/NOTE-rdf-json-20130828/">http://www.w3.org/TR/2013/NOTE-rdf-json-20130828/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/rdf-json/">http://www.w3.org/TR/rdf-json/</a></dd><dt>Previous version:</dt><dd>none</dd><dt>Editors:</dt><dd rel="bibo:editor"><span typeof="foaf:Person"><a href="http://iandavis.com/" content="Ian Davis" property="foaf:name" rel="foaf:homepage">Ian Davis</a>, <a href="http://www.talis.com/" rel="foaf:workplaceHomepage">Talis</a></span>
+</dd>
+<dd rel="bibo:editor"><span typeof="foaf:Person"><span property="foaf:name">Thomas Steiner</span>, <a href="http://www.google.com/" rel="foaf:workplaceHomepage">Google Inc.</a></span>
+</dd>
+<dd rel="bibo:editor"><span typeof="foaf:Person"><span property="foaf:name">Arnaud J Le Hors</span>, <a href="http://www.ibm.com/" rel="foaf:workplaceHomepage">IBM</a></span>
+</dd>
+</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="license">Copyright</a> © 2011-2013 <span rel="dcterms:publisher"><span typeof="foaf:Organization"><a href="http://www.w3.org/" content="World Wide Web Consortium" property="foaf:name" rel="foaf:homepage"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup></span></span> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr /></div>
+
+<div id="abstract" class="introductory section" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#abstract" rel="bibo:chapter"><h2>Abstract</h2>
+ <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) [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC4627">RFC4627</a></cite>] and alternative
+ to the one recommended in JSON-LD [<cite><a class="bibref" rel="biblioentry" href="#bib-JSON-LD">JSON-LD</a></cite>].</p>
+ <p>The syntax defined in this document should not be used unless there is
+ a specific reason to do so. <b>Use of JSON-LD is
+ recommended</b>.</p>
+</div><div class="introductory section" id="sotd" typeof="bibo:Chapter" resource="#sotd" rel="bibo:chapter"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports index</a> at http://www.w3.org/TR/.</em></p>
+ <p><b>Important Note:</b> The <a href="http://www.w3.org/2011/rdf-wg/">RDF Working
+ Group</a> has decided not to push this document through the <acronym title="World Wide Web Consortium">W3C</acronym>
+ Recommendation Track. You should therefore not expect to see this
+ document eventually become a <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation.</p>
+ <p>This document was published as a Working Group Note to provide those
+ who are using it and/or have an interest in it with a stable reference.</p>
+ <p>The RDF Working Group decided to put <a href="http://www.w3.org/TR/json-ld/">JSON-LD</a> on the
+ Recommendation track. Therefore, unless you have a specific reason to use
+ the syntax defined in this document instead of JSON-LD, <b>you are
+ encouraged to use JSON-LD</b>.</p>
+<p>This document was published by the <a href="http://www.w3.org/2011/rdf-wg/">RDF Working Group</a> as a Working Group Note. If you wish to make comments regarding this document, please send them to <a href="mailto:public-rdf-comments@w3.org">public-rdf-comments@w3.org</a> (<a href="mailto:public-rdf-comments-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-rdf-comments/">archives</a>). All feedback is welcome.</p><p>Publication as a Working Group Note does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>. <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/46168/status">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.</p></div><div id="toc" typeof="bibo:Chapter" resource="#toc" rel="bibo:chapter" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#section-intro" class="tocxref"><span class="secno">1 </span>Introduction</a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2 </span>Conformance</a></li><li class="tocline"><a href="#overview-of-rdf-json" class="tocxref"><span class="secno">3 </span>Overview of RDF/JSON</a></li><li class="tocline"><a href="#section-serialization" class="tocxref"><span class="secno">4 </span>Serialization of RDF as JSON</a></li><li class="tocline"><a href="#sec-examples" class="tocxref"><span class="secno">5 </span>Examples</a></li><li class="tocline"><a href="#section-Acknowledgments" class="tocxref"><span class="secno">6 </span>Acknowledgments</a></li><li class="tocline"><a href="#sec-mediaReg" class="tocxref"><span class="secno">A </span>Internet Media Type, File Extension and Macintosh File Type</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">B </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div>
+
+
+
+
+
+<div id="section-intro" typeof="bibo:Chapter" resource="#section-intro" rel="bibo:chapter" class="section">
+ <h2><span class="secno">1 </span>Introduction</h2>
+
+ <p>This document defines RDF/JSON, a concrete syntax for RDF, as
+ defined in the RDF Concepts and Abstract Syntax <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation
+ [<cite><a class="bibref" rel="biblioentry" href="#bib-RDF11-CONCEPTS">RDF11-CONCEPTS</a></cite>],
+ in JavaScript Object Notation (JSON) [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC4627">RFC4627</a></cite>].</p>
+ <p>The syntax defined in this document is an alternative
+ to the one recommended in JSON-LD [<cite><a class="bibref" rel="biblioentry" href="#bib-JSON-LD">JSON-LD</a></cite>]. It should not be
+ used unless there is a specific reason to do
+ so. <b>Use of JSON-LD is recommended</b>.</p>
+
+</div>
+
+<div id="conformance" typeof="bibo:Chapter" resource="#conformance" rel="bibo:chapter" class="section"><h2><span class="secno">2 </span>Conformance</h2><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p>
+<p>The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>, and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2119">RFC2119</a></cite>].</p>
+</div>
+
+<div class="informative section" id="overview-of-rdf-json" typeof="bibo:Chapter" resource="#overview-of-rdf-json" rel="bibo:chapter">
+
+ <h2><span class="secno">3 </span>Overview of RDF/JSON</h2><p><em>This section is non-normative.</em></p>
+
+ <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 [<cite><a class="bibref" rel="biblioentry" href="#bib-RDF11-CONCEPTS">RDF11-CONCEPTS</a></cite>]).
+ 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)</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>
+
+ <p>All keywords defined in this document are case sensitive, and
+ must be lowercase.</p>
+
+
+</div>
+
+<div id="section-serialization" typeof="bibo:Chapter" resource="#section-serialization" rel="bibo:chapter" class="section">
+ <h2><span class="secno">4 </span>Serialization of RDF as JSON</h2>
+ <p>Given a set of RDF Triples an RDF/JSON document may be 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 the lexical form of S and:
+ <ul><li>If the object of the triple is an RDF Literal with language L, add a key called "lang" with the
+ value being L.</li>
+ <li>If the object of the triple is an RDF Typed Literal with datatype URI D, add a key called "datatype" with the
+ value being D.</li>
+ </ul>
+ </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><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>
+
+
+
+
+</div>
+
+<div class="informative section" id="sec-examples" typeof="bibo:Chapter" resource="#sec-examples" rel="bibo:chapter">
+ <h2><span class="secno">5 </span>Examples</h2><p><em>This section is non-normative.</em></p>
+
+ <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>This is equivalent to the following N-Triples [<cite><a class="bibref" rel="biblioentry" href="#bib-N-TRIPLES">N-TRIPLES</a></cite>]:</p>
+ <pre class="example"><http://example.org/about> <http://purl.org/dc/terms/title> "Anna's Homepage"@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>This is equivalent to the following N-Triples:</p>
+ <pre class="example"><http://example.org/about> <http://purl.org/dc/terms/title> "Anna's Homepage"@en .
+<http://example.org/about> <http://purl.org/dc/terms/title> "Annas hjemmeside"@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>This is equivalent to the following N-Triples:</p>
+ <pre class="example"><http://example.org/about> <http://purl.org/dc/terms/title> "<p xmlns=\"http://www.w3.org/1999/xhtml\"><b>Anna's</b> Homepage>/p>"^^<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>This is equivalent to the following N-Triples:</p>
+ <pre class="example"><http://example.org/about> <http://purl.org/dc/terms/creator> _:anna .
+_:anna <http://xmlns.com/foaf/0.1/name> "Anna" .</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>This is equivalent to the following N-Triples:</p>
+ <pre class="example">_:anna <http://xmlns.com/foaf/0.1/homepage> <http://example.org/anna> .</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>This is equivalent to the following N-Triples:</p>
+ <pre class="example">_:anna <http://xmlns.com/foaf/0.1/name> "Anna" .
+_:anna <http://xmlns.com/foaf/0.1/homepage> <http://example.org/anna> .</pre>
+
+
+ <p>An empty RDF graph is serialized as a JSON object with zero keys.</p>
+ <pre class="example">{ }</pre>
+
+</div>
+
+<div class="informative section" id="section-Acknowledgments" typeof="bibo:Chapter" resource="#section-Acknowledgments" rel="bibo:chapter">
+ <h2><span class="secno">6 </span>Acknowledgments</h2><p><em>This section is non-normative.</em></p>
+
+ <p>This document is based on original work from Talis [<cite><a class="bibref" rel="biblioentry" href="#bib-TALIS-RDF-JSON">TALIS-RDF-JSON</a></cite>] and has benefited from the review of the RDF WG, especially Andy Seaborne and Pierre-Antoine Champin.</p>
+
+
+</div>
+
+ <div class="appendix section" id="sec-mediaReg" typeof="bibo:Chapter" resource="#sec-mediaReg" rel="bibo:chapter">
+ <h2><span class="secno">A </span>Internet Media Type, File Extension and Macintosh File Type</h2>
+ <p>The suggested media type for RDF/JSON is "application/rdf+json".</p>
+
+ <p>It is suggested that RDF/JSON files have the extension ".rj" (all lowercase) on all platforms.</p>
+ <p>JSON is encoded in Unicode, with a default encoding of UTF-8. See RFC627, section 3 "Encoding".</p>
+
+</div>
+
+
+
+
+
+
+
+<div id="references" class="appendix section" typeof="bibo:Chapter" resource="#references" rel="bibo:chapter"><h2><span class="secno">B </span>References</h2><div id="normative-references" typeof="bibo:Chapter" resource="#normative-references" rel="bibo:chapter" class="section"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography" about=""><dt id="bib-N-TRIPLES">[N-TRIPLES]</dt><dd rel="dcterms:requires">Gavin Carothers. <a href="http://www.w3.org/TR/n-triples/"><cite>N-Triples</cite></a>. W3C Working Draft (work in progress). URL: <a href="http://www.w3.org/TR/n-triples/">http://www.w3.org/TR/n-triples/</a>
+</dd><dt id="bib-RDF11-CONCEPTS">[RDF11-CONCEPTS]</dt><dd rel="dcterms:requires">Richard Cyganiak; David Wood. <a href="http://www.w3.org/TR/rdf11-concepts/"><cite>RDF 1.1 Concepts and Abstract Syntax</cite></a>. July 2013. W3C Last Call Working Draft. URL: <a href="http://www.w3.org/TR/rdf11-concepts/">http://www.w3.org/TR/rdf11-concepts/</a>
+</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd rel="dcterms:requires">S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
+</dd><dt id="bib-RFC4627">[RFC4627]</dt><dd rel="dcterms:requires">D. Crockford. <a href="http://www.ietf.org/rfc/rfc4627.txt"><cite>The application/json Media Type for JavaScript Object Notation (JSON)</cite></a> July 2006. Internet RFC 4627. URL: <a href="http://www.ietf.org/rfc/rfc4627.txt">http://www.ietf.org/rfc/rfc4627.txt</a>
+</dd></dl></div><div id="informative-references" typeof="bibo:Chapter" resource="#informative-references" rel="bibo:chapter" class="section"><h3><span class="secno">B.2 </span>Informative references</h3><dl class="bibliography" about=""><dt id="bib-JSON-LD">[JSON-LD]</dt><dd rel="dcterms:references">Manu Sporny; Dave Longley; Gregg Kellogg; Markus Lanthaler; Mark Birbeck. <a href="http://www.w3.org/TR/json-ld-syntax/"><cite>JSON-LD Syntax 1.0: A Context-based JSON Serialization for Linking Data</cite></a> 11 April 2013. W3C Last Call Working Draft (work in progress). URL: <a href="http://www.w3.org/TR/json-ld-syntax/">http://www.w3.org/TR/json-ld-syntax/</a>
+</dd><dt id="bib-TALIS-RDF-JSON">[TALIS-RDF-JSON]</dt><dd rel="dcterms:references">Talis. <a href="http://docs.api.talis.com/platform-api/output-types/rdf-json"><cite>RDF JSON</cite></a>. URL: <a href="http://docs.api.talis.com/platform-api/output-types/rdf-json">http://docs.api.talis.com/platform-api/output-types/rdf-json</a>
+</dd></dl></div></div></body></html>
\ No newline at end of file