Skip to content

Commit

Permalink
Added an appendix on converting to/from RDF to JSON-LD Syntax.
Browse files Browse the repository at this point in the history
This change is based on a request from Richard Cyganiak.
  • Loading branch information
msporny committed May 24, 2012
1 parent 295aea1 commit 584dec5
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions spec/latest/json-ld-syntax/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2292,21 +2292,23 @@ <h3>Compact Document Form</h3>
</section>

<section class="appendix normative">
<h2>JSON-LD Grammar</h2>
<h2>JSON-LD Authoring Guidelines</h2>

<p>Since the JSON-LD syntax is a subset of the JSON syntax, it follows that
all well-formed JSON-LD documents are well-formed JSON documents. It also
means that a non-well-formed JSON document can never be a well-formed
all valid JSON-LD documents are valid JSON documents. It also
means that an invalid JSON document can never be a valid
JSON-LD document. Furthermore, JSON-LD places a number of restrictions on
the JSON syntax in order to define a <em>grammar</em> that is used to express
valid JSON-LD documents. At times, even if this grammar is violated, a
JSON-LD processor will do its best to recover from the error and
deterministically transform the author's markup into valid JSON-LD.</p>

<p class="issue">The final nuanced details of the exact grammar are still being
discussed, as well as the best mechanism to express these restrictions. EBNF
seems like overkill since it's a subset of JSON. EBNF doesn't quite capture
some of the more esoteric restrictions in the language.
the JSON syntax in order to define a set of authoring <em>guidelines</em>
that is used to express <em>well-formed</em> JSON-LD documents. At times,
even if these guidelines are violated, a JSON-LD processor will do its best
to recover from the mistake and will deterministically transform the author's
markup into well-formed JSON-LD.</p>

<p class="issue">The final details of the guidelines are still being
discussed, as well as the best mechanism to express these restrictions.
EBNF doesn't quite capture what these guidelines are attempting to do -
which is strongly express what constitutes a well-formed JSON-LD document.
For the time being, a simple list of plain english guidelines are provided.
</p>

<ol>
Expand Down Expand Up @@ -2346,7 +2348,7 @@ <h2>JSON-LD Grammar</h2>
</section>

<section class="appendix informative">
<h2>Markup Examples</h2>
<h2>Converting To and From JSON-LD</h2>

<p>JSON-LD is a specification for representing <tref>Linked Data</tref> in JSON. A common
way of working with Linked Data is through <tdef>RDF</tdef>, the Resource Description Framework.
Expand All @@ -2355,16 +2357,32 @@ <h2>Markup Examples</h2>
RDF may be found in the [[RDF-PRIMER]].</p>

<p>The JSON-LD markup examples below demonstrate how JSON-LD can be used to
express semantic data marked up in other languages such as Turtle, RDFa, Microformats,
express semantic data marked up in other languages and data models
such as RDF, Turtle, RDFa, Microformats,
and Microdata. These sections are merely provided as proof that JSON-LD is
very flexible in what it can express across different <tref>Linked Data</tref> approaches.
Further information on transforming JSON-LD into RDF are detailed in the
[[JSON-LD-API]].</p>

<section>
<h3>RDF</h3>

<p>The RDF data model, as outlined in [[RDF-CONCEPTS]], is an abstract
syntax for representing a directed graph of information. JSON-LD is
capable of serializing any RDF graph, and performing full RDF to
JSON-LD to RDF round-tripping. A complete description of how JSON-LD maps
to RDF and algorithms detailing how one can convert from RDF to
JSON-LD and from JSON-LD to RDF are included in the JSON-LD API
[[!JSON-LD-API]] specification.
</p>

</section>

<section>
<h3>Turtle</h3>

<p>The following are examples of representing <tref>RDF</tref> as expressed in [[TURTLE]] into JSON-LD.</p>
<p>The following are examples of converting <tref>RDF</tref>
expressed in [[TURTLE]] into JSON-LD.</p>

<section>
<h4>Prefix definitions</h4>
Expand Down

0 comments on commit 584dec5

Please sign in to comment.