The Resource Description Framework (RDF) is a framework for representing information in the Web.
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]].
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.
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.
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.
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.
The value of each predicate key is an array of JSON objects representing the object of each serialized triple.
In general, a triple (subject S, predicate P, object O) is serialized in the following structure:
{ "S" : { "P" : [ O ] } }
The object of the triple O is represented as a further JSON object with the following keys:
Blank node subjects are named using a string conforming to the nodeID production in Turtle. For example: _:A1
The 'lang' and 'datatype' keys should only be used if the value of the 'type' key is "literal".
Given a set of RDF Triples an RDF/JSON document may be constructed using the following algorithm:
An example of a single triple with a literal object having a language of "en"
{ "http://example.org/about" : { "http://purl.org/dc/terms/title" : [ { "value" : "Anna's Homepage", "type" : "literal", "lang" : "en" } ] } }
An example of two triples that share the same subject and predicate but have differing objects:
{ "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" } ] } }
An example of a triple with a datatyped literal object:
{ "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" } ] } }
An example of triples with a common blank node:
{ "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" } ] } }
An example of a triple with a URI object:
{ "_:anna" : { "http://xmlns.com/foaf/0.1/homepage" : [ { "value" : "http://example.org/anna", "type" : "uri" } ] } }
An example of triples with common subjects:
{ "_: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" } ] } }
An empty RDF graph is serialized as a JSON object with zero keys.
{ }
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.
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.
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.
This specification is a product of extended deliberations by the members of the RDFcore Working Group and the RDF and RDF Schema Working Group.
The Internet Media Type / MIME Type for RDF/JSON is "application/rdf+json".
It is recommended that RDF/JSON files have the extension ".rj" (all lowercase) on all platforms.
It is recommended that RDF/JSON files stored on Macintosh HFS file systems be given a file type of "TEXT".
This information that follows will be submitted to the IESG for review, approval, and registration with IANA.