spec/latest/json-ld-api/index.html
author Gregg Kellogg <gregg@greggkellogg.net>
Sun, 27 Jul 2014 14:57:42 -0700
changeset 2170 5e345ac627c6
parent 2068 85fa70be5f91
permissions -rw-r--r--
Update the JSON-LD-API with steps to check for list nodes shared across graphs.
This addresses issue #357.
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     1
<!DOCTYPE html>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     2
<html>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     3
<head>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     4
<title>JSON-LD 1.0 Processing Algorithms and API</title>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     5
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     6
<script type="text/javascript" src="../respec-w3c-common.js" class="remove"></script>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     7
<script type="text/javascript" src="../respec-w3c-extensions.js" class="remove"></script>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     8
<script type="text/javascript" class="remove">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
     9
//<![CDATA[
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    10
  var respecConfig = {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    11
      // extend the bibliography entries
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    12
      "localBiblio": localBibliography,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    13
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    14
      doRDFa: "1.1",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    15
      // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
1893
8ff237dff16b Switch back to the ED template for the specs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 1870
diff changeset
    16
      specStatus:           "ED",
2048
f898fc0dbe1b Add static PR specs and diffs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2039
diff changeset
    17
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    18
      // if you wish the publication date to be other than today, set this
2048
f898fc0dbe1b Add static PR specs and diffs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2039
diff changeset
    19
      //publishDate:          "2013-11-05",
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    20
      copyrightStart:       "2010",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    21
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    22
      // the specification's short name, as in http://www.w3.org/TR/short-name/
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    23
      shortName:            "json-ld-api",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    24
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    25
      // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    26
      // and its maturity status
2170
5e345ac627c6 Update the JSON-LD-API with steps to check for list nodes shared across graphs.
Gregg Kellogg <gregg@greggkellogg.net>
parents: 2068
diff changeset
    27
      previousPublishDate:  "2014-01-16",
5e345ac627c6 Update the JSON-LD-API with steps to check for list nodes shared across graphs.
Gregg Kellogg <gregg@greggkellogg.net>
parents: 2068
diff changeset
    28
      previousMaturity:     "REC",
5e345ac627c6 Update the JSON-LD-API with steps to check for list nodes shared across graphs.
Gregg Kellogg <gregg@greggkellogg.net>
parents: 2068
diff changeset
    29
      previousDiffURI:      "http://www.w3.org/TR/2014/REC-json-ld-api-20140116/",
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    30
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    31
      // if there a publicly available Editor's Draft, this is the link
2170
5e345ac627c6 Update the JSON-LD-API with steps to check for list nodes shared across graphs.
Gregg Kellogg <gregg@greggkellogg.net>
parents: 2068
diff changeset
    32
      edDraftURI:           "http://www.w3.org/TR/json-ld-api/",
5e345ac627c6 Update the JSON-LD-API with steps to check for list nodes shared across graphs.
Gregg Kellogg <gregg@greggkellogg.net>
parents: 2068
diff changeset
    33
5e345ac627c6 Update the JSON-LD-API with steps to check for list nodes shared across graphs.
Gregg Kellogg <gregg@greggkellogg.net>
parents: 2068
diff changeset
    34
      testSuiteURI:         "http://json-ld.org/test-suite/",
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    35
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    36
      // if you want to have extra CSS, append them to this list
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    37
      // it is recommended that the respec.css stylesheet be kept
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    38
      // extraCSS: [],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    39
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    40
      issueBase: "https://github.com/json-ld/json-ld.org/issues/",
1978
792bcc17d3ab Enumerate features at risk in the SOTD
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 1977
diff changeset
    41
      atRiskBase: "https://www.w3.org/2011/rdf-wg/wiki/JSON-LD_Features_at_Risk#",
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    42
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    43
      // editors, add as many as you like
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    44
      // only "name" is required
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    45
      editors:  [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    46
          { name: "Markus Lanthaler", url: "http://www.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    47
            company: "Graz University of Technology", companyURL: "http://www.tugraz.at/" },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    48
          { name: "Gregg Kellogg", url: "http://greggkellogg.net/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    49
            company: "Kellogg Associates", companyURL: "http://kellogg-assoc.com/" },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    50
          { name: "Manu Sporny", url: "http://manu.sporny.org/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    51
            company: "Digital Bazaar", companyURL: "http://digitalbazaar.com/" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    52
      ],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    53
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    54
      // authors, add as many as you like.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    55
      // This is optional, uncomment if you have authors as well as editors.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    56
      // only "name" is required. Same format as editors.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    57
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    58
      authors:  [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    59
          { name: "Dave Longley", url: "http://digitalbazaar.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    60
            company: "Digital Bazaar", companyURL: "http://digitalbazaar.com/"},
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    61
          { name: "Gregg Kellogg", url: "http://greggkellogg.net/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    62
            company: "Kellogg Associates", companyURL: "http://kellogg-assoc.com/" },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    63
          { name: "Markus Lanthaler", url: "http://www.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    64
            company: "Graz University of Technology", companyURL: "http://www.tugraz.at/" },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    65
          { name: "Manu Sporny", url: "http://digitalbazaar.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    66
            company: "Digital Bazaar", companyURL: "http://digitalbazaar.com/" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    67
      ],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    68
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    69
      // name of the WG
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    70
      wg:           "RDF Working Group",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    71
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    72
      // URI of the public WG page
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    73
      wgURI:        "http://www.w3.org/2011/rdf-wg/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    74
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    75
      // name (with the @w3c.org) of the public mailing to which comments are due
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    76
      wgPublicList: "public-rdf-comments",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    77
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    78
      // URI of the patent status for this WG, for Rec-track documents
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    79
      // !!!! IMPORTANT !!!!
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    80
      // This is important for Rec-track documents, do not copy a patent URI from a random
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    81
      // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    82
      // Team Contact.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    83
      wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/46168/status",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    84
      maxTocLevel: 2,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    85
      preProcess: [ preProc ],
2048
f898fc0dbe1b Add static PR specs and diffs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2039
diff changeset
    86
      //alternateFormats: [ {uri: "diff-20130910.html", label: "diff to previous version"} ]
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    87
  };
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    88
//]]>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    89
</script>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    90
<style type="text/css">
2033
faea9505be17 Style comments in examples in a different color
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2031
diff changeset
    91
  .highlight {
faea9505be17 Style comments in examples in a different color
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2031
diff changeset
    92
    font-weight: bold;
faea9505be17 Style comments in examples in a different color
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2031
diff changeset
    93
    color: #0a3;
faea9505be17 Style comments in examples in a different color
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2031
diff changeset
    94
  }
faea9505be17 Style comments in examples in a different color
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2031
diff changeset
    95
  .comment {
faea9505be17 Style comments in examples in a different color
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2031
diff changeset
    96
    color: #999;
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    97
  }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    98
  .error a {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
    99
    color:  #ff4500;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   100
    border-bottom:  1px dotted #ff4500;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   101
    text-decoration: none;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   102
  }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   103
  ol.algorithm {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   104
    counter-reset: numsection;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   105
    list-style-type: none;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   106
  }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   107
  ol.algorithm li {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   108
    margin: 0.5em 0;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   109
  }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   110
  ol.algorithm li:before {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   111
    font-weight: bold;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   112
    counter-increment: numsection;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   113
    content: counters(numsection, ".") ") ";
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   114
  }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   115
</style>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   116
</head>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   117
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   118
<body>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   119
<section id="abstract">
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   120
  <p>This specification defines a set of algorithms for programmatic transformations
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   121
    of JSON-LD documents. Restructuring data according to the defined transformations
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   122
    often dramatically simplifies its usage. Furthermore, this document proposes
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   123
    an Application Programming Interface (API) for developers implementing the
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   124
    specified algorithms.</p>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   125
</section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   126
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   127
<section id="sotd">
2048
f898fc0dbe1b Add static PR specs and diffs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2039
diff changeset
   128
  <p>This document has been under development for over 31 months in the
1982
7ac2ac2190bb Minor tweak
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 1978
diff changeset
   129
    JSON for Linking Data Community Group. The document has been
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   130
    transferred to the RDF Working Group for review, improvement, and publication
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   131
    along the Recommendation track. The specification has undergone significant
2048
f898fc0dbe1b Add static PR specs and diffs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2039
diff changeset
   132
    development, review, and changes during the course of the last 31 months.</p>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   133
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   134
  <p>There are several independent
1870
8881f2469748 Link to preliminary implementation report instead of the homepage
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 1866
diff changeset
   135
    <a href="http://json-ld.org/test-suite/reports/">interoperable implementations</a> of
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   136
    this specification. There is a fairly complete test suite [[JSON-LD-TESTS]]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   137
    and a <a href="http://json-ld.org/playground/">live JSON-LD editor</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   138
    that is capable of demonstrating the features described in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   139
    this document. While there will be continuous development on implementations,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   140
    the test suite, and the live editor, they are believed to be mature enough
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   141
    to be integrated into a non-production system at this point in time. There
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   142
    is an expectation that they could be used in a production system within the
2048
f898fc0dbe1b Add static PR specs and diffs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2039
diff changeset
   143
    next two months.</p>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   144
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   145
  <p>There are a number of ways that one may participate in the development of
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   146
    this specification:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   147
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   148
  <ul>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   149
    <li>If you want to make sure that your feedback is formally addressed by
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   150
      the RDF Working Group, you should send it to public-rdf-comments:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   151
      <a href="http://lists.w3.org/Archives/Public/public-rdf-comments/">public-rdf-comments@w3.org</a></li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   152
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   153
    <li>Ad-hoc technical discussion primarily occurs on the public community mailing list:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   154
      <a href="http://lists.w3.org/Archives/Public/public-linked-json/">public-linked-json@w3.org</a></li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   155
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   156
    <li><a href="http://json-ld.org/minutes/">Public JSON-LD Community Group teleconferences</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   157
      are held on Tuesdays at 1500UTC every week. Participation is open to the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   158
      public.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   159
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   160
    <li>RDF Working Group teleconferences are held on Wednesdays at 1500UTC
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   161
      every week. Participation is limited to RDF Working Group members.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   162
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   163
    <li>Specification bugs and issues should be reported in the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   164
      <a href="https://github.com/json-ld/json-ld.org/issues">issue tracker</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   165
      if you do not want to send an email to the public-rdf-comments mailing
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   166
      list.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   167
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   168
    <li><a href="https://github.com/json-ld/json-ld.org/tree/master/spec">Source code</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   169
      for the specification can be found on Github.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   170
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   171
    <li>The <a href="http://webchat.freenode.net/?channels=json-ld">#json-ld</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   172
      IRC channel is available for real-time discussion on irc.freenode.net.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   173
  </ul>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   174
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   175
  <p>Changes since the
2034
93bc200cad10 Fix bug when processing blank nodes with reverse properties
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2033
diff changeset
   176
    <a href="http://www.w3.org/TR/2013/CR-json-ld-api-20130910/">10&nbsp;September&nbsp;2013 Candidate Recommendation</a>:</p>
93bc200cad10 Fix bug when processing blank nodes with reverse properties
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2033
diff changeset
   177
93bc200cad10 Fix bug when processing blank nodes with reverse properties
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2033
diff changeset
   178
  <ul>
93bc200cad10 Fix bug when processing blank nodes with reverse properties
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2033
diff changeset
   179
    <li>Fixed a bug that relabeled blank node identifiers used with reverse properties inconsistently when
93bc200cad10 Fix bug when processing blank nodes with reverse properties
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2033
diff changeset
   180
      creating a node map .</li>
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   181
    <li>Made the API non-normative given that Promises are still not properly specified.</li>
2034
93bc200cad10 Fix bug when processing blank nodes with reverse properties
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2033
diff changeset
   182
  </ul>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   183
</section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   184
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   185
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   186
<section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   187
  <h1>Introduction</h1>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   188
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   189
  <p>This document is a detailed specification of the JSON-LD processing algorithms.
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   190
    The document is primarily intended for the following audiences:</p>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   191
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   192
  <ul>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   193
    <li>Software developers who want to implement the algorithms to transform
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   194
      JSON-LD documents.</li>
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   195
    <li>Web authors and developers who want a very detailed view of how
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   196
      a <tref>JSON-LD Processor</tref> operates.</li>
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   197
    <li>Developers who want an overview of the proposed JSON-LD API.</li>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   198
  </ul>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   199
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   200
  <p>To understand the basics in this specification you must first be familiar with
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   201
    JSON, which is detailed in [[!RFC4627]]. You must also understand the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   202
    JSON-LD syntax defined in [[!JSON-LD]], which is the base syntax used by all
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   203
    of the algorithms in this document. To understand the API and how it is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   204
    intended to operate in a programming environment, it is useful to have working
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   205
    knowledge of the JavaScript programming language [[ECMA-262]] and
2039
28169782d45c Make reference to WebIDL non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2038
diff changeset
   206
    WebIDL [[WEBIDL]]. To understand how JSON-LD maps to RDF, it is helpful to be
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   207
    familiar with the basic RDF concepts [[RDF11-CONCEPTS]].</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   208
</section> <!-- end of Introduction -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   209
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   210
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   211
<section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   212
  <h1>Features</h1>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   213
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   214
  <p>The JSON-LD Syntax specification [[!JSON-LD]] defines a syntax to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   215
    express Linked Data in JSON. Because there is more than one way to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   216
    express Linked Data using this syntax, it is often useful to be able to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   217
    transform JSON-LD documents so that they may be more easily consumed by
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   218
    specific applications.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   219
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   220
  <p>JSON-LD uses <tref title="context">contexts</tref> to allow Linked Data
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   221
    to be expressed in a way that is specifically tailored to a particular
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   222
    person or application. By providing a <tref>context</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   223
    JSON data can be expressed in a way that is a natural fit for a particular
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   224
    person or application whilst also indicating how the data should be
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   225
    understood at a global scale. In order for people or applications to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   226
    share data that was created using a <tref>context</tref> that is different
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   227
    from their own, a JSON-LD processor must be able to transform a document
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   228
    from one <tref>context</tref> to another. Instead of requiring JSON-LD
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   229
    processors to write specific code for every imaginable
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   230
    <tref>context</tref> switching scenario, it is much easier to specify a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   231
    single algorithm that can remove any <tref>context</tref>. Similarly,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   232
    another algorithm can be specified to subsequently apply any
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   233
    <tref>context</tref>. These two algorithms represent the most basic
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   234
    transformations of JSON-LD documents. They are referred to as
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   235
    <tref>expansion</tref> and <tref>compaction</tref>, respectively.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   236
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   237
  <p>There are four major types of transformation that are discussed in this
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   238
    document: expansion, compaction, flattening, and RDF serialization/deserialization.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   239
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   240
  <section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   241
    <h2>Expansion</h2>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   242
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   243
    <p>The algorithm that removes <tref>context</tref> is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   244
      called <tdef>expansion</tdef>. Before performing any other
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   245
      transformations on a JSON-LD document, it is easiest to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   246
      remove any <tref>context</tref> from it and to make data structures
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   247
      more regular.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   248
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   249
    <p>To get an idea of how context and data structuring affects the same data,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   250
      here is an example of JSON-LD that uses only <tref title="term">terms</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   251
      and is fairly compact:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   252
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   253
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   254
         title="Sample JSON-LD document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   255
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   256
    {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   257
      "@context": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   258
        "name": "http://xmlns.com/foaf/0.1/name",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   259
        "homepage": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   260
          "@id": "http://xmlns.com/foaf/0.1/homepage",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   261
          "@type": "@id"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   262
        }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   263
      },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   264
      "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   265
      "name": "Markus Lanthaler",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   266
      "homepage": "http://www.markus-lanthaler.com/"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   267
    }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   268
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   269
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   270
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   271
    <p>The next input example uses one <tref>IRI</tref> to express a property
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   272
    and an <tref title="array">array</tref> to encapsulate another, but
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   273
    leaves the rest of the information untouched.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   274
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   275
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   276
         title="Sample JSON-LD document using an IRI instead of a term to express a property">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   277
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   278
    {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   279
      "@context": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   280
        ****"website": "http://xmlns.com/foaf/0.1/homepage"****
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   281
      },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   282
      "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   283
      "****http://xmlns.com/foaf/0.1/name****": "Markus Lanthaler",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   284
      ****"website"****: ****{ "@id":**** "http://www.markus-lanthaler.com/" ****}****
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   285
    }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   286
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   287
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   288
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   289
    <p>Note that both inputs are valid JSON-LD and both represent the same
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   290
      information. The difference is in their <tref>context</tref> information
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   291
      and in the data structures used. A JSON-LD processor can remove
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   292
      <tref>context</tref> and ensure that the data is more regular by employing
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   293
      <tref>expansion</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   294
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   295
    <p><tref>Expansion</tref> has two important goals: removing any contextual
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   296
      information from the document, and ensuring all values are represented
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   297
      in a regular form. These goals are accomplished by expanding all properties
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   298
      to <tref title="absolute IRI">absolute IRIs</tref> and by expressing all
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   299
      values in <tref title="array">arrays</tref> in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   300
      <tref>expanded form</tref>. <tref>Expanded form</tref> is the most verbose
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   301
      and regular way of expressing of values in JSON-LD; all contextual
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   302
      information from the document is instead stored locally with each value.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   303
      Running the <a href="#expansion-algorithm">Expansion algorithm</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   304
      (<code class="idlMemberName"><a href="#widl-JsonLdProcessor-expand-Promise-any-input-JsonLdOptions-options">expand</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   305
      operation) against the above examples results in the following output:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   306
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   307
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   308
         title="Expanded sample document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   309
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   310
    [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   311
      {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   312
        "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   313
        "http://xmlns.com/foaf/0.1/name": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   314
          { "@value": "Markus Lanthaler" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   315
        ],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   316
        "http://xmlns.com/foaf/0.1/homepage": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   317
          { "@id": "http://www.markus-lanthaler.com/" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   318
        ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   319
      }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   320
    ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   321
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   322
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   323
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   324
    <p>Note that in the output above all <tref>context</tref> definitions have
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   325
      been removed, all <tref title="term">terms</tref> and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   326
      <tref title="compact IRI">compact IRIs</tref> have been expanded to absolute
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   327
      <tref title="IRI">IRIs</tref>, and all
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   328
      <tref title="JSON-LD value">JSON-LD values</tref> are expressed in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   329
      <tref title="array">arrays</tref> in <tref>expanded form</tref>. While the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   330
      output is more verbose and difficult for a human to read, it establishes a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   331
      baseline that makes JSON-LD processing easier because of its very regular
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   332
      structure.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   333
  </section> <!-- end of Expansion -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   334
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   335
  <section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   336
    <h2>Compaction</h2>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   337
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   338
    <p>While <tref>expansion</tref> removes <tref>context</tref> from a given
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   339
      input, <tref title="compaction">compaction's</tref> primary function is to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   340
      perform the opposite operation: to express a given input according to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   341
      a particular <tref>context</tref>. <tdef>Compaction</tdef> applies a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   342
      <tref>context</tref> that specifically tailors the way information is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   343
      expressed for a particular person or application. This simplifies applications
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   344
      that consume JSON or JSON-LD by expressing the data in application-specific
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   345
      terms, and it makes the data easier to read by humans.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   346
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   347
    <p><tref>Compaction</tref> uses a developer-supplied <tref>context</tref> to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   348
      shorten <tref title="IRI">IRIs</tref> to <tref title="term">terms</tref> or
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   349
      <tref title="compact IRI">compact IRIs</tref> and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   350
      <tref title="JSON-LD value">JSON-LD values</tref> expressed in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   351
      <tref>expanded form</tref> to simple values such as <tref title="string">strings</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   352
      or <tref title="number">numbers</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   353
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   354
    <p>For example, assume the following expanded JSON-LD input document:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   355
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   356
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   357
         title="Expanded sample document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   358
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   359
    [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   360
      {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   361
        "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   362
        "http://xmlns.com/foaf/0.1/name": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   363
          { "@value": "Markus Lanthaler" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   364
        ],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   365
        "http://xmlns.com/foaf/0.1/homepage": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   366
          { "@id": "http://www.markus-lanthaler.com/" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   367
        ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   368
      }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   369
    ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   370
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   371
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   372
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   373
    <p>Additionally, assume the following developer-supplied JSON-LD
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   374
      <tref>context</tref>:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   375
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   376
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   377
         title="JSON-LD context">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   378
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   379
    {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   380
      "@context": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   381
        "name": "http://xmlns.com/foaf/0.1/name",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   382
        "homepage": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   383
          "@id": "http://xmlns.com/foaf/0.1/homepage",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   384
          "@type": "@id"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   385
        }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   386
      }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   387
    }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   388
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   389
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   390
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   391
    <p>Running the <a href="#compaction-algorithm">Compaction Algorithm</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   392
      (<code class="idlMemberName"><a href="#widl-JsonLdProcessor-compact-Promise-any-input-JsonLdContext-context-JsonLdOptions-options">compact</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   393
      operation) given the context supplied above against the JSON-LD input
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   394
      document provided above would result in the following output:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   395
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   396
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   397
         title="Compacted sample document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   398
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   399
    {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   400
      "@context": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   401
        "name": "http://xmlns.com/foaf/0.1/name",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   402
        "homepage": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   403
          "@id": "http://xmlns.com/foaf/0.1/homepage",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   404
          "@type": "@id"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   405
        }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   406
      },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   407
      "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   408
      "name": "Markus Lanthaler",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   409
      "homepage": "http://www.markus-lanthaler.com/"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   410
    }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   411
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   412
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   413
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   414
    <p>Note that all <tref title="IRI">IRIs</tref> have been compacted to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   415
      <tref title="term">terms</tref> as specified in the <tref>context</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   416
      which has been injected into the output. While compacted output is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   417
      useful to humans, it is also used to generate structures that are easy to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   418
      program against. Compaction enables developers to map any expanded document
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   419
      into an application-specific compacted document. While the context provided
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   420
      above mapped <code>http://xmlns.com/foaf/0.1/name</code> to <code>name</code>, it
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   421
      could also have been mapped to any other term provided by the developer.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   422
  </section> <!-- end of Compaction -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   423
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   424
  <section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   425
    <h2>Flattening</h2>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   426
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   427
    <p>While expansion ensures that a document is in a uniform structure,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   428
      flattening goes a step further to ensure that the shape of the data
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   429
      is deterministic. In expanded documents, the properties of a single
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   430
      <tref>node</tref> may be spread across a number of different
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   431
      <tref title="JSON object">JSON objects</tref>. By flattening a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   432
      document, all properties of a <tref>node</tref> are collected in a single
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   433
      <tref>JSON object</tref> and all <tref title="blank node">blank nodes</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   434
      are labeled with a <tref>blank node identifier</tref>. This may drastically
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   435
      simplify the code required to process JSON-LD data in certain applications.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   436
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   437
    <p>For example, assume the following JSON-LD input document:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   438
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   439
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   440
         title="Sample JSON-LD document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   441
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   442
    {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   443
      "@context": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   444
        "name": "http://xmlns.com/foaf/0.1/name",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   445
        "knows": "http://xmlns.com/foaf/0.1/knows"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   446
      },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   447
      "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   448
      "name": "Markus Lanthaler",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   449
      "knows": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   450
        {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   451
          "name": "Dave Longley"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   452
        }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   453
      ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   454
    }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   455
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   456
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   457
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   458
    <p>Running the <a href="#flattening-algorithm">Flattening algorithm</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   459
      (<code class="idlMemberName"><a href="#widl-JsonLdProcessor-flatten-Promise-any-input-JsonLdContext-context-JsonLdOptions-options">flatten</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   460
      operation) with a context set to <tref>null</tref> to prevent compaction
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   461
      returns the following document:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   462
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   463
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   464
         title="Flattened sample document in expanded form">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   465
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   466
    [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   467
      {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   468
        "@id": "_:t0",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   469
        "http://xmlns.com/foaf/0.1/name": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   470
          { "@value": "Dave Longley" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   471
        ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   472
      },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   473
      {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   474
        "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   475
        "http://xmlns.com/foaf/0.1/name": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   476
          { "@value": "Markus Lanthaler" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   477
        ],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   478
        "http://xmlns.com/foaf/0.1/knows": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   479
          { "@id": "_:t0" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   480
        ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   481
      }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   482
    ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   483
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   484
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   485
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   486
    <p>Note how in the output above all properties of a <tref>node</tref> are collected in a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   487
      single <tref>JSON object</tref> and how the <tref>blank node</tref> representing
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   488
      &quot;Dave Longley&quot; has been assigned the <tref>blank node identifier</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   489
      <code>_:t0</code>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   490
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   491
    <p>To make it easier for humans to read or for certain applications to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   492
      process it, a flattened document can be compacted by passing a context. Using
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   493
      the same context as the input document, the flattened and compacted document
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   494
      looks as follows:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   495
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   496
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   497
         title="Flattened and compacted sample document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   498
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   499
    {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   500
      "@context": {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   501
        "name": "http://xmlns.com/foaf/0.1/name",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   502
        "knows": "http://xmlns.com/foaf/0.1/knows"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   503
      },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   504
      "@graph": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   505
        {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   506
          "@id": "_:t0",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   507
          "name": "Dave Longley"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   508
        },
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   509
        {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   510
          "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   511
          "name": "Markus Lanthaler",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   512
          "knows": { "@id": "_:t0" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   513
        }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   514
      ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   515
    }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   516
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   517
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   518
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   519
    <p>Please note that the result of flattening and compacting a document
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   520
      is always a <tref>JSON object</tref> which contains an <code>@graph</code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   521
      member that represents the <tref>default graph</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   522
  </section> <!-- end of Flattening -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   523
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   524
  <section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   525
    <h2>RDF Serialization/Deserialization</h2>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   526
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   527
    <p>JSON-LD can be used to serialize RDF data as described in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   528
      [[RDF11-CONCEPTS]]. This ensures that data can be round-tripped to and from
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   529
      any RDF syntax without any loss in fidelity.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   530
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   531
    <p>For example, assume the following RDF input serialized in Turtle [[TURTLE]]:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   532
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   533
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   534
         title="Sample Turtle document">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   535
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   536
    <http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   537
    <http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/homepage> <http://www.markus-lanthaler.com/> .
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   538
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   539
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   540
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   541
    <p>Using the <a href="#serialize-rdf-as-json-ld-algorithm">Serialize RDF as JSON-LD algorithm</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   542
      a developer could transform this document into expanded JSON-LD:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   543
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   544
    <pre class="example" data-transform="updateExample"
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   545
         title="Sample Turtle document converted to JSON-LD">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   546
    <!--
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   547
    [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   548
      {
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   549
        "@id": "http://me.markus-lanthaler.com/",
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   550
        "http://xmlns.com/foaf/0.1/name": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   551
          { "@value": "Markus Lanthaler" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   552
        ],
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   553
        "http://xmlns.com/foaf/0.1/homepage": [
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   554
          { "@id": "http://www.markus-lanthaler.com/" }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   555
        ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   556
      }
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   557
    ]
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   558
    -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   559
    </pre>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   560
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   561
    <p>Note that the output above could easily be compacted using the technique outlined
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   562
      in the previous section. It is also possible to deserialize the JSON-LD document back
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   563
      to RDF using the <a href="#deserialize-json-ld-to-rdf-algorithm">Deserialize JSON-LD to RDF algorithm</a>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   564
  </section> <!-- end of RDF Serialization/Deserialization -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   565
</section> <!-- end of Features section -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   566
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   567
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   568
<section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   569
  <h1>Conformance</h1>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   570
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   571
  <p>All examples and notes as well as sections marked as non-normative in this
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   572
    specification are non-normative. Everything else in this specification is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   573
    normative.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   574
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   575
  <p>The keywords MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   576
    MAY, and OPTIONAL in this specification are to be interpreted as described
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   577
    in [[!RFC2119]].</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   578
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   579
  <p>There are two classes of products that can claim conformance to this
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   580
    specification: <tref title="JSON-LD Processor">JSON-LD Processors</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   581
    and <tref title="RDF Serializer/Deserializer">RDF Serializers/Deserializers</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   582
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   583
  <p>A conforming <tdef>JSON-LD Processor</tdef> is a system which can perform the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   584
    <a href="#expansion-algorithm">Expansion</a>, <a href="#compaction-algorithm">Compaction</a>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   585
    and <a href="#flattening-algorithm">Flattening</a> operations defined in this specification.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   586
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   587
  <p><tref title="JSON-LD Processor">JSON-LD Processors</tref> MUST NOT
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   588
    attempt to correct malformed <tref title="IRI">IRIs</tref> or language tags;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   589
    however, they MAY issue validation warnings. IRIs are not modified other
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   590
    than conversion between <tref title="relative IRI">relative</tref> and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   591
    <tref title="absolute IRI">absolute IRIs</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   592
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   593
  <p>A conforming <tdef>RDF Serializer/Deserializer</tdef> is a system that can
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   594
    <a href="#deserialize-json-ld-to-rdf-algorithm">deserialize JSON-LD to RDF</a> and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   595
    <a href="#serialize-rdf-as-json-ld-algorithm">serialize RDF as JSON-LD</a> as
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   596
    defined in this specification.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   597
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   598
  <p>The algorithms in this specification are generally written with more concern for clarity
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   599
    than efficiency. Thus, <tref title="JSON-LD Processor">JSON-LD Processors</tref> may
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   600
    implement the algorithms given in this specification in any way desired,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   601
    so long as the end result is indistinguishable from the result that would
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   602
    be obtained by the specification's algorithms.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   603
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   604
  <p class="note">Implementers can partially check their level of conformance to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   605
    this specification by successfully passing the test cases of the JSON-LD test
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   606
    suite [[JSON-LD-TESTS]]. Note, however, that passing all the tests in the test
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   607
    suite does not imply complete conformance to this specification. It only implies
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   608
    that the implementation conforms to aspects tested by the test suite.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   609
</section> <!-- end of Conformance section -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   610
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   611
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   612
<section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   613
  <h1>General Terminology</h1>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   614
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   615
  <p>This document uses the following terms as defined in JSON [[!RFC4627]]. Refer
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   616
    to the <em>JSON Grammar</em> section in [[!RFC4627]] for formal definitions.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   617
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   618
  <dl>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   619
    <dt><tdef>JSON object</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   620
    <dd>An object structure is represented as a pair of curly brackets surrounding
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   621
      zero or more key-value pairs. A key is a <tref>string</tref>.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   622
      A single colon comes after each key, separating the key from the value.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   623
      A single comma separates a value from a following key. In contrast to JSON,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   624
      in JSON-LD the keys in an object must be unique.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   625
    <dt><tdef>array</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   626
    <dd>An array structure is represented as square brackets surrounding zero
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   627
      or more values. Values are separated by commas.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   628
      In JSON, an array is an <em>ordered</em> sequence of zero or more values.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   629
      While JSON-LD uses the same array representation as JSON,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   630
      the collection is <em>unordered</em> by default. While order is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   631
      preserved in regular JSON arrays, it is not in regular JSON-LD arrays
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   632
      unless specifically defined (see
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   633
      <cite><a href="../json-ld/#sets-and-lists">Sets and Lists</a></cite> in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   634
      the JSON-LD specification [[JSON-LD]]).</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   635
    <dt><tdef>string</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   636
    <dd>A string is a sequence of zero or more Unicode characters,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   637
      wrapped in double quotes, using backslash escapes (if necessary). A
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   638
      character is represented as a single character string.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   639
    <dt><tdef>number</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   640
    <dd>A number is similar to that used in most programming languages, except
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   641
      that the octal and hexadecimal formats are not used and that leading
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   642
      zeros are not allowed.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   643
    <dt><tdef>true</tdef> and <tdef>false</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   644
    <dd>Values that are used to express one of two possible boolean states.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   645
    <dt><tdef>null</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   646
    <dd>The <tref>null</tref> value. A key-value pair in the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   647
      <code>@context</code> where the value, or the <code>@id</code> of the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   648
      value, is <tref>null</tref> explicitly decouples a term's association
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   649
      with an IRI. A key-value pair in the body of a JSON-LD document whose
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   650
      value is <tref>null</tref> has the same meaning as if the key-value pair
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   651
      was not defined. If <code>@value</code>, <code>@list</code>, or
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   652
      <code>@set</code> is set to <tref>null</tref> in expanded form, then
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   653
      the entire <tref>JSON object</tref> is ignored.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   654
  </dl>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   655
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   656
  <p>Furthermore, the following terminology is used throughout this document:</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   657
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   658
  <dl>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   659
    <dt><tdef>keyword</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   660
    <dd>A JSON key that is specific to JSON-LD, specified in the section
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   661
      <cite><a href="../json-ld/#syntax-tokens-and-keywords">Syntax Tokens and Keywords</a></cite>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   662
      of the JSON-LD specification [[!JSON-LD]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   663
    <dt><tdef>context</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   664
    <dd>A set of rules for interpreting a JSON-LD document as specified in the section
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   665
      <cite><a href="../json-ld/#the-context">The Context</a></cite> of the JSON-LD
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   666
      specification [[!JSON-LD]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   667
    <dt><tdef>JSON-LD document</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   668
    <dd>A <tref>JSON-LD document</tref> is a serialization of a collection of
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   669
      <tref title="graph">graphs</tref> and comprises exactly one
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   670
      <tref>default graph</tref> and zero or more <tref title="named graph">named graphs</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   671
    <dt><tdef>named graph</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   672
    <dd>A named graph is a pair consisting of an <tref>IRI</tref> or <tref>blank node</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   673
      (the <tdef>graph name</tdef>) and a <tref>graph</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   674
    <dt><tdef>default graph</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   675
    <dd>The default graph is the only graph in a JSON-LD document which has no <tref>graph name</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   676
    <dt><tdef>Graph</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   677
    <dd>A labeled directed graph, i.e., a set of <tref title="node">nodes</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   678
      connected by <tref title="edge">edges</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   679
      as specified in the <cite><a href="../json-ld/#data-model">Data Model</a></cite>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   680
      section of the JSON-LD specification [[!JSON-LD]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   681
    <dt><tdef>edge</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   682
    <dd>Every <tref>edge</tref> has a direction associated with it and is labeled with
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   683
      an <tref>IRI</tref> or a <tref>blank node identifier</tref>. Within the JSON-LD syntax
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   684
      these edge labels are called <tdef title="property">properties</tdef>. Whenever possible, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   685
      <tref>edge</tref> should be labeled with an <tref>IRI</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   686
    <dt><tdef>node</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   687
    <dd>Every <tref>node</tref> is an <tref>IRI</tref>, a <tref>blank node</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   688
      a <tref>JSON-LD value</tref>, or a <tref>list</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   689
    <dt><tdef><abbr title="Internationalized Resource Identifier">IRI</abbr></tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   690
    <dd>An <tref>IRI</tref> (Internationalized Resource Identifier) is a string that conforms to the syntax
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   691
      defined in [[RFC3987]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   692
    <dt><tdef>absolute IRI</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   693
    <dd>An absolute IRI is defined in [[!RFC3987]] containing a <em>scheme</em> along with a <em>path</em> and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   694
      optional <em>query</em> and fragment segments.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   695
    <dt><tdef>relative IRI</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   696
    <dd>A relative IRI is an IRI that is relative to some other <tref>absolute IRI</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   697
    <dt><tdef>blank node</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   698
    <dd>A <tref>node</tref> in a <tref>graph</tref> that is neither an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   699
      <tref>IRI</tref>, nor a <tref>JSON-LD value</tref>, nor a <tref>list</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   700
    <dt><tdef>blank node identifier</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   701
    <dd>A blank node identifier is a string that can be used as an identifier for a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   702
      <tref>blank node</tref> within the scope of a JSON-LD document. Blank node identifiers
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   703
      begin with <code>_:</code>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   704
    <dt><tdef>JSON-LD value</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   705
    <dd>A <tref>JSON-LD value</tref> is a <tref>string</tref>, a <tref>number</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   706
      <tref>true</tref> or <tref>false</tref>, a <tref>typed value</tref>, or a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   707
      <tref>language-tagged string</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   708
    <dt><tdef>typed value</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   709
    <dd>A <tref>typed value</tref> consists of a value, which is a string, and a type,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   710
      which is an <tref>IRI</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   711
    <dt><tdef>language-tagged string</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   712
    <dd>A <tref>language-tagged string</tref> consists of a string and a non-empty language
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   713
      tag as defined by [[BCP47]]. The language tag must be well-formed according to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   714
      <a href="http://tools.ietf.org/html/bcp47#section-2.2.9">section 2.2.9 Classes of Conformance</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   715
      of [[BCP47]], and is normalized to lowercase.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   716
    <dt><tdef>list</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   717
    <dd>A <tref>list</tref> is an ordered sequence of <tref title="IRI">IRIs</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   718
      <tref title="blank node">blank nodes</tref>, and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   719
      <tref title="JSON-LD value">JSON-LD values</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   720
  </dl>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   721
</section> <!-- end of General Terminology section -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   722
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   723
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   724
<section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   725
  <h1>Algorithm Terms</h1>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   726
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   727
  <dl>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   728
    <dt><tdef>active graph</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   729
    <dd>The name of the currently active graph that the processor should use when
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   730
      processing.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   731
    <dt><tdef>active subject</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   732
    <dd>The currently active subject that the processor should use when
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   733
      processing.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   734
    <dt><tdef>active property</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   735
    <dd>The currently active <tref>property</tref> or <tref>keyword</tref> that
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   736
      the processor should use when processing.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   737
    <dt><tdef>active context</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   738
    <dd>A context that is used to resolve <tref title="term">terms</tref> while
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   739
      the processing algorithm is running.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   740
    <dt><tdef>local context</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   741
    <dd>A context that is specified within a <tref>JSON object</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   742
      specified via the <code>@context</code> <tref>keyword</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   743
    <dt><tdef>JSON-LD input</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   744
    <dd>The JSON-LD data structure that is provided as input to the algorithm.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   745
    <dt><tdef>term</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   746
    <dd>A <tref>term</tref> is a short word defined in a context that may be expanded to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   747
      an <tref>IRI</tref></dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   748
    <dt><tdef>compact IRI</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   749
    <dd>A compact IRI has the form of <tdef>prefix</tdef>:<em>suffix</em> and is used as a way
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   750
      of expressing an IRI without needing to define separate <tref>term</tref> definitions for
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   751
      each IRI contained within a common vocabulary identified by <tref>prefix</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   752
    <dt><tdef>node object</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   753
    <dd>A <tref>node object</tref> represents zero or more properties of a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   754
      <tref>node</tref> in the <tref>graph</tref> serialized by the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   755
      JSON-LD document. A <tref>JSON object</tref> is a <tref>node object</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   756
      if it exists outside of the JSON-LD <tref>context</tref> and:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   757
      <ul>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   758
        <li>it does not contain the <code>@value</code>, <code>@list</code>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   759
          or <code>@set</code> keywords, or</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   760
        <li>it is not the top-most <tref>JSON object</tref> in the JSON-LD document consisting
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   761
          of no other members than <code>@graph</code> and <code>@context</code>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   762
      </ul>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   763
    </dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   764
    <dt><tdef>value object</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   765
    <dd>A <tref>value object</tref> is a <tref>JSON object</tref> that has an <code>@value</code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   766
      member.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   767
    <dt><tdef>list object</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   768
    <dd>A <tref>list object</tref> is a <tref>JSON object</tref> that has an <code>@list</code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   769
      member.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   770
    <dt><tdef>set object</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   771
    <dd>A <tref>set object</tref> is a <tref>JSON object</tref> that has an <code>@set</code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   772
      member.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   773
    <dt><tdef>scalar</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   774
    <dd>A scalar is either a JSON <tref>string</tref>, <tref>number</tref>, <tref>true</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   775
      or <tref>false</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   776
    <dt><tdef>RDF subject</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   777
    <dd>A <tref href="http://www.w3.org/TR/rdf11-concepts/#dfn-subject">subject</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   778
      as specified by [[RDF11-CONCEPTS]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   779
    <dt><tdef>RDF predicate</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   780
    <dd>A <tref href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate">predicate</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   781
      as specified by [[RDF11-CONCEPTS]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   782
    <dt><tdef>RDF object</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   783
    <dd>An <tref href="http://www.w3.org/TR/rdf11-concepts/#dfn-object">object</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   784
      as specified by [[RDF11-CONCEPTS]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   785
    <dt><tdef>RDF triple</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   786
    <dd>A <tref href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple">triple</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   787
      as specified by [[RDF11-CONCEPTS]].</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   788
    <dt><tdef>RDF dataset</tdef></dt>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   789
    <dd>A <tref href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset">dataset</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   790
      as specified by [[RDF11-CONCEPTS]] representing a collection of
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   791
      <tref href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph">RDF graphs</tref>.</dd>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   792
  </dl>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   793
</section> <!-- end of Algorithm Terms section -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   794
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   795
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   796
<section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   797
  <h1>Context Processing Algorithms</h1>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   798
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   799
  <section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   800
    <h2>Context Processing Algorithm</h2>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   801
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   802
    <p>When processing a JSON-LD data structure, each processing rule is applied
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   803
      using information provided by the <tref>active context</tref>. This
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   804
      section describes how to produce an <tref>active context</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   805
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   806
    <p>The <tref>active context</tref> contains the active
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   807
      <tdef title="term definition">term definitions</tdef> which specify how
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   808
      properties and values have to be interpreted as well as the current <tdef>base IRI</tdef>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   809
      the <tdef>vocabulary mapping</tdef> and the <tdef>default language</tdef>. Each
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   810
      <tref>term definition</tref> consists of an <tdef>IRI mapping</tdef>, a boolean
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   811
      flag <tdef>reverse property</tdef>, an optional <tdef>type mapping</tdef>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   812
      or <tdef>language mapping</tdef>, and an optional  <tdef>container mapping</tdef>.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   813
      A <tref>term definition</tref> can not only be used to map a <tref>term</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   814
      to an IRI, but also to map a <tref>term</tref> to a <tref>keyword</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   815
      in which case it is referred to as a <tdef>keyword alias</tdef>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   816
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   817
    <p>When processing, the <tref>active context</tref> is initialized
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   818
      without any <tref title="term definition">term definitions</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   819
      <tref>vocabulary mapping</tref>, or <tref>default language</tref>.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   820
      If a <tref>local context</tref> is encountered during processing, a new
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   821
      <tref>active context</tref> is created by cloning the existing
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   822
      <tref>active context</tref>. Then the information from the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   823
      <tref>local context</tref> is merged into the new <tref>active context</tref>.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   824
      Given that <tref title="local context">local contexts</tref> may contain
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   825
      references to remote contexts, this includes their retrieval.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   826
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   827
    <section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   828
      <h3>Overview</h3>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   829
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   830
      <p>First we prepare a new <tref>active context</tref> <i>result</i> by cloning
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   831
        the current <tref>active context</tref>. Then we normalize the form of the passed
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   832
        <tref>local context</tref> to an <tref>array</tref>.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   833
        <tref title="local context">Local contexts</tref> may be in the form of a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   834
        <tref>JSON object</tref>, a <tref>string</tref>, or an <tref>array</tref> containing
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   835
        a combination of the two. Finally we process each <tref>context</tref> contained
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   836
        in the <tref>local context</tref> <tref>array</tref> as follows.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   837
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   838
      <p>If <tref>context</tref> is a <tref>string</tref>, it represents a reference to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   839
        a remote context. We dereference the remote context and replace <tref>context</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   840
        with the value of the <code>@context</code> key of the top-level object in the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   841
        retrieved JSON-LD document. If there's no such key, an invalid remote context has
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   842
        been detected. Otherwise, we process <tref>context</tref> by recursively using
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   843
        this algorithm ensuring that there is no cyclical reference.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   844
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   845
      <p>If <tref>context</tref> is a <tref>JSON object</tref>, we first update the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   846
        <tref>base IRI</tref>, the <tref>vocabulary mapping</tref>, and the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   847
        <tref>default language</tref> by processing three specific keywords:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   848
        <code>@base</code>, <code>@vocab</code>, and <code>@language</code>.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   849
        These are handled before any other keys in the <tref>local context</tref> because
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   850
        they affect how the other keys are processed. Please note that <code>@base</code> is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   851
        ignored when processing remote contexts.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   852
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   853
      <p>Then, for every other key in <tref>local context</tref>, we update
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   854
        the <tref>term definition</tref> in <i>result</i>. Since
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   855
        <tref title="term definition">term definitions</tref> in a <tref>local context</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   856
        may themselves contain <tref title="term">terms</tref> or
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   857
        <tref title="compact IRI">compact IRIs</tref>, we may need to recurse.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   858
        When doing so, we must ensure that there is no cyclical dependency,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   859
        which is an error. After we have processed any
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   860
        <tref title="term definition">term definition</tref> dependencies,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   861
        we update the current <tref title="term definition">term definition</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   862
        which may be a <tref>keyword alias</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   863
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   864
      <p>Finally, we return <i>result</i> as the new <tref>active context</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   865
    </section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   866
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   867
    <section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   868
      <h3>Algorithm</h3>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   869
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   870
      <p>This algorithm specifies how a new <tref>active context</tref> is updated
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   871
        with a <tref>local context</tref>. The algorithm takes three input variables:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   872
        an <tref>active context</tref>, a <tref>local context</tref>, and an  <tref>array</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   873
        <i>remote contexts</i> which is used to detect cyclical context inclusions.
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   874
        If <i>remote contexts</i> is not passed, it is initialized to an empty
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   875
        <tref>array</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   876
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   877
      <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   878
        <li>Initialize <i>result</i> to the result of cloning
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   879
          <tref>active context</tref>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   880
        <li>If <tref>local context</tref> is not an <tref>array</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   881
          set it to an <tref>array</tref> containing only
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   882
          <tref>local context</tref>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   883
        <li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   884
          For each item <i>context</i> in <tref>local context</tref>:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   885
          <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   886
            <li>If <i>context</i> is <tref>null</tref>, set <i>result</i> to a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   887
              newly-initialized <tref>active context</tref> and continue with the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   888
              next <i>context</i>. The <tref>base IRI</tref> of the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   889
              <tref>active context</tref> is set to the IRI of the currently being processed
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   890
              document (which might be different from the currently being processed context),
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   891
              if available; otherwise to <tref>null</tref>. If set, the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   892
              <code class="idlMemberName"><a href="#widl-JsonLdOptions-base">base</a></code>
2038
053f9ebcc699 Make API non-normative
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 2034
diff changeset
   893
              option of a JSON-LD API Implementation overrides the <tref>base IRI</tref>.</li>
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   894
            <li>If <i>context</i> is a <tref>string</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   895
              <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   896
                <li>Set <i>context</i> to the result of resolving <i>value</i> against
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   897
                  the base IRI which is established as specified in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   898
                  <cite><a href="http://tools.ietf.org/html/rfc3986#section-5.1">section 5.1 Establishing a Base URI</a></cite>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   899
                  of [[!RFC3986]]. Only the basic algorithm in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   900
                  <cite><a href="http://tools.ietf.org/html/rfc3986#section-5.2">section 5.2</a></cite>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   901
                  of [[!RFC3986]] is used; neither
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   902
                  <cite><a href="http://tools.ietf.org/html/rfc3986#section-6.2.2">Syntax-Based Normalization</a></cite> nor
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   903
                  <cite><a href="http://tools.ietf.org/html/rfc3986#section-6.2.3">Scheme-Based Normalization</a></cite>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   904
                  are performed. Characters additionally allowed in IRI
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   905
                  references are treated in the same way that unreserved
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   906
                  characters are treated in URI references, per
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   907
                  <cite><a href="http://tools.ietf.org/html/rfc3987#section-6.5">section 6.5</a></cite>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   908
                  of [[!RFC3987]].</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   909
                <li>If <i>context</i> is in the <i>remote contexts</i> array, a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   910
                  <code class="error"><a href="#idl-def-JsonLdErrorCode.recursive-context-inclusion">recursive context inclusion</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   911
                  error has been detected and processing is aborted;
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   912
                  otherwise, add <i>context</i> to <i>remote contexts</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   913
                <li>Dereference <i>context</i>. If <i>context</i> cannot be dereferenced, a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   914
                  <code class="error"><a href="#idl-def-JsonLdErrorCode.loading-remote-context-failed">loading remote context failed</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   915
                  error has been detected and processing is aborted. If the dereferenced document has no
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   916
                  top-level <tref>JSON object</tref> with an <code>@context</code> member, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   917
                  <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-remote-context">invalid remote context</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   918
                  has been detected and processing is aborted; otherwise,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   919
                  set <i>context</i> to the value of that member.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   920
                <li>Set <i>result</i> to the result of recursively calling this algorithm,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   921
                  passing <i>result</i> for <tref>active context</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   922
                  <i>context</i> for <tref>local context</tref>, and <i>remote contexts</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   923
                <li>Continue with the next <i>context</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   924
              </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   925
            </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   926
            <li>If <i>context</i> is not a <tref>JSON object</tref>, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   927
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-local-context">invalid local context</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   928
              error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   929
            <li>If <i>context</i> has an <code>@base</code> key and <i>remote contexts</i> is empty, i.e., the currently
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   930
              being processed context is not a remote context:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   931
              <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   932
                <li>Initialize <i>value</i> to the value associated with the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   933
                  <code>@base</code> key.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   934
                <li>If <i>value</i> is <tref>null</tref>, remove the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   935
                  <tref>base IRI</tref> of <i>result</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   936
                <li>Otherwise, if <i>value</i> is an <tref>absolute IRI</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   937
                  the <tref>base IRI</tref> of <i>result</i> is set to <i>value</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   938
                <li>Otherwise, if <i>value</i> is a <tref>relative IRI</tref> and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   939
                  the <tref>base IRI</tref> of <i>result</i> is not <tref>null</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   940
                  set the <tref>base IRI</tref> of <i>result</i> to the result of
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   941
                  resolving <i>value</i> against the current <tref>base IRI</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   942
                  of <i>result</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   943
                <li>Otherwise, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   944
                  <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-base-IRI">invalid base IRI</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   945
                  error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   946
              </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   947
            </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   948
            <li>If <i>context</i> has an <code>@vocab</code> key:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   949
              <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   950
                <li>Initialize <i>value</i> to the value associated with the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   951
                  <code>@vocab</code> key.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   952
                <li>If <i>value</i> is <tref>null</tref>, remove
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   953
                  any <tref>vocabulary mapping</tref> from <i>result</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   954
                <li>Otherwise, if <i>value</i> is an <tref>absolute IRI</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   955
                  or <tref>blank node identifier</tref>, the <tref>vocabulary mapping</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   956
                  of <i>result</i> is set to <i>value</i>. If it is not an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   957
                  <tref>absolute IRI</tref> or <tref>blank node identifier</tref>, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   958
                  <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-vocab-mapping">invalid vocab mapping</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   959
                  error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   960
              </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   961
            </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   962
            <li>If <i>context</i> has an <code>@language</code> key:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   963
              <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   964
                <li>Initialize <i>value</i> to the value associated with the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   965
                  <code>@language</code> key.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   966
                <li>If <i>value</i> is <tref>null</tref>, remove
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   967
                  any <tref>default language</tref> from <i>result</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   968
                <li>Otherwise, if <i>value</i> is <tref>string</tref>, the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   969
                  <tref>default language</tref> of <i>result</i> is set to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   970
                  lowercased <i>value</i>. If it is not a <tref>string</tref>, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   971
                  <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-default-language">invalid default language</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   972
                  error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   973
              </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   974
            </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   975
            <li>Create a <tref>JSON object</tref> <i>defined</i> to use to keep
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   976
              track of whether or not a <tref>term</tref> has already been defined
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   977
              or currently being defined during recursion.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   978
            <li>For each <i>key</i>-<i>value</i> pair in <i>context</i> where
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   979
              <i>key</i> is not <code>@base</code>, <code>@vocab</code>, or
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   980
              <code>@language</code>, invoke the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   981
              <a href="#create-term-definition">Create Term Definition algorithm</a>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   982
              passing <i>result</i> for <tref>active context</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   983
              <i>context</i> for <tref>local context</tref>, <i>key</i>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   984
              and <i>defined</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   985
          </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   986
        </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   987
        <li>Return <i>result</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   988
      </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   989
    </section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   990
  </section> <!-- end of Context Processing -->
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   991
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   992
  <section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   993
    <h2>Create Term Definition</h2>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   994
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   995
    <p>This algorithm is called from the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   996
      <a href="#context-processing-algorithm">Context Processing algorithm</a>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   997
      to create a <tref>term definition</tref> in the <tref>active context</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   998
      for a <tref>term</tref> being processed in a <tref>local context</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
   999
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1000
    <section class="informative">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1001
      <h3>Overview</h3>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1002
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1003
      <p><tref title="term definition">Term definitions</tref> are created by
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1004
        parsing the information in the given <tref>local context</tref> for the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1005
        given <tref>term</tref>. If the given <tref>term</tref> is a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1006
        <tref>compact IRI</tref>, it may omit an <tref>IRI mapping</tref> by
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1007
        depending on its <tref>prefix</tref> having its own
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1008
        <tref>term definition</tref>. If the <tref>prefix</tref> is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1009
        a key in the <tref>local context</tref>, then its <tref>term definition</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1010
        must first be created, through recursion, before continuing. Because a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1011
        <tref>term definition</tref> can depend on other
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1012
        <tref title="term definition">term definitions</tref>, a mechanism must
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1013
        be used to detect cyclical dependencies. The solution employed here
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1014
        uses a map, <i>defined</i>, that keeps track of whether or not a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1015
        <tref>term</tref> has been defined or is currently in the process of
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1016
        being defined. This map is checked before any recursion is attempted.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1017
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1018
      <p>After all dependencies for a <tref>term</tref> have been defined, the rest of
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1019
        the information in the <tref>local context</tref> for the given
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1020
        <tref>term</tref> is taken into account, creating the appropriate
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1021
        <tref>IRI mapping</tref>, <tref>container mapping</tref>, and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1022
        <tref>type mapping</tref> or <tref>language mapping</tref> for the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1023
        <tref>term</tref>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1024
    </section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1025
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1026
    <section>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1027
      <h3>Algorithm</h3>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1028
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1029
      <p>The algorithm has four required inputs which are:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1030
        an <tref>active context</tref>, a <tref>local context</tref>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1031
        a <i>term</i>, and a map <i>defined</i>.</p>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1032
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1033
      <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1034
        <li>If <i>defined</i> contains the key <i>term</i> and the associated
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1035
          value is <tref>true</tref> (indicating that the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1036
          <tref>term definition</tref> has already been created), return. Otherwise,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1037
          if the value is <tref>false</tref>, a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1038
          <code class="error"><a href="#idl-def-JsonLdErrorCode.cyclic-IRI-mapping">cyclic IRI mapping</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1039
          error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1040
        <li>Set the value associated with <i>defined</i>'s <i>term</i> key to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1041
          <tref>false</tref>. This indicates that the <tref>term definition</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1042
          is now being created but is not yet complete.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1043
        <li>Since <tref title="keyword">keywords</tref> cannot be overridden,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1044
          <i>term</i> must not be a <tref>keyword</tref>. Otherwise, a
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1045
          <code class="error"><a href="#idl-def-JsonLdErrorCode.keyword-redefinition">keyword redefinition</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1046
          error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1047
        <li>Remove any existing <tref>term definition</tref> for <i>term</i> in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1048
          <tref>active context</tref>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1049
        <li>Initialize <i>value</i> to a copy of the value associated with the key
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1050
          <i>term</i> in <tref>local context</tref>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1051
        <li>If <i>value</i> is <tref>null</tref> or <i>value</i>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1052
          is a <tref>JSON object</tref> containing the key-value pair
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1053
          <code>@id</code>-<tref>null</tref>, set the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1054
          <tref>term definition</tref> in <tref>active context</tref> to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1055
          <tref>null</tref>, set the value associated with <i>defined</i>'s
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1056
          key <i>term</i> to <tref>true</tref>, and return.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1057
        <li>Otherwise, if <i>value</i> is a <tref>string</tref>, convert it
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1058
          to a <tref>JSON object</tref> consisting of a single member whose
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1059
          key is <code>@id</code> and whose value is <i>value</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1060
        <li>Otherwise, <i>value</i> must be a <tref>JSON object</tref>, if not, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1061
          <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-term-definition">invalid term definition</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1062
          error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1063
        <li>Create a new <tref>term definition</tref>, <i>definition</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1064
        <li>If <i>value</i> contains the key <code>@type</code>:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1065
          <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1066
            <li>Initialize <i>type</i> to the value associated with the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1067
              <code>@type</code> key, which must be a <tref>string</tref>. Otherwise, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1068
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-type-mapping">invalid type mapping</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1069
              error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1070
            <li>Set <i>type</i> to the result of using the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1071
              <a href="#iri-expansion">IRI Expansion algorithm</a>, passing
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1072
              <tref>active context</tref>, <i>type</i> for <i>value</i>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1073
              <tref>true</tref> for <i>vocab</i>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1074
              <tref>false</tref> for <i>document relative</i>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1075
              <tref>local context</tref>, and <i>defined</i>. If the expanded <i>type</i> is
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1076
              neither <code>@id</code>, nor <code>@vocab</code>, nor an <tref>absolute IRI</tref>, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1077
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-type-mapping">invalid type mapping</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1078
              error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1079
            <li>Set the <tref>type mapping</tref> for <i>definition</i> to <i>type</i>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1080
          </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1081
        </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1082
        <li>If <i>value</i> contains the key <code>@reverse</code>:
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1083
          <ol class="algorithm">
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1084
            <li>If <i>value</i> contains an <code>@id</code>, member, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1085
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-reverse-property">invalid reverse property</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1086
              error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1087
            <li>If the value associated with the <code>@reverse</code> key
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1088
              is not a <tref>string</tref>, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1089
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping">invalid IRI mapping</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1090
              error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1091
            <li>Otherwise, set the <tref>IRI mapping</tref> of <i>definition</i> to the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1092
              result of using the <a href="#iri-expansion">IRI Expansion algorithm</a>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1093
              passing <tref>active context</tref>, the value associated with
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1094
              the <code>@reverse</code> key for <i>value</i>, <tref>true</tref>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1095
              for <i>vocab</i>, <tref>false</tref> for <i>document relative</i>,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1096
              <tref>local context</tref>, and <i>defined</i>. If the result
1976
3e2a23e8c3eb Checks for colons not only accept absolute IRIs but also bnode IDs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 1955
diff changeset
  1097
              is neither an <tref>absolute IRI</tref> nor a <tref>blank node identifier</tref>,
3e2a23e8c3eb Checks for colons not only accept absolute IRIs but also bnode IDs
Markus Lanthaler <mark_lanthaler@gmx.net>
parents: 1955
diff changeset
  1098
              i.e., it contains no colon (<code>:</code>), an
1865
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1099
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping">invalid IRI mapping</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1100
              error has been detected and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1101
            <li>If <i>value</i> contains an <code>@container</code> member,
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1102
              set the <tref>container mapping</tref> of <i>definition</i>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1103
              to its value; if its value is neither <code>@set</code>, nor
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1104
              <code>@index</code>, nor <tref>null</tref>, an
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1105
              <code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-reverse-property">invalid reverse property</a></code>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1106
              error has been detected (reverse properties only support set- and
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1107
              index-containers) and processing is aborted.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1108
            <li>Set the <tref>reverse property</tref> flag of <i>definition</i>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1109
              to <tref>true</tref>.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1110
            <li>Set the <tref>term definition</tref> of <i>term</i> in
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1111
              <tref>active context</tref> to <i>definition</i> and the
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1112
              value associated with <i>defined</i>'s key <i>term</i> to
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1113
              <tref>true</tref> and return.</li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1114
          </ol>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1115
        </li>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com>
parents: 1864
diff changeset
  1116
        <li>Set the <tref>reverse property</tref> flag of <i>definition</i>
33deb807de53 CRLF to LF.
David I. Lehn <dlehn@digitalbazaar.com