-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscep0105.html
More file actions
208 lines (167 loc) · 10.1 KB
/
scep0105.html
File metadata and controls
208 lines (167 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structured Commons :: SCEP0105 - Standard <span class="caps">JSON</span> representation method </title>
<meta charset="utf-8" />
<link href="http://www.structured-commons.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Structured Commons Full Atom Feed" />
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="http://www.structured-commons.org/theme/gumby.css" />
<link rel="stylesheet" type="text/css" href="http://www.structured-commons.org/theme/style.css" />
<link rel="stylesheet" type="text/css" href="http://www.structured-commons.org/theme/pygment.css" />
<script src="http://www.structured-commons.org/theme/js/libs/modernizr-2.6.2.min.js"></script>
</head>
<body id="index" class="home">
<div class="container">
<div class="row">
<header id="banner" class="body">
<h1><a href="http://www.structured-commons.org">Structured Commons <strong></strong></a></h1>
</header><!-- /#banner -->
<div id="navigation" class="navbar row">
<a href="#" gumby-trigger="#navigation > ul" class="toggle"><i class="icon-menu"></i></a>
<ul class="columns">
<li><a href="http://www.structured-commons.org/online-forum.html">Forum</a></li>
<li><a href="http://www.structured-commons.org/index.html">About</a></li>
<li><a href="http://www.structured-commons.org/mission.html">Mission statement</a></li>
<li><a href="http://www.structured-commons.org/org.html">Organization</a></li>
<li><a href="http://www.structured-commons.org/participating.html">Participating</a></li>
<li><a href="http://www.structured-commons.org/scep0000.html">SCEPs</a></li>
</ul>
</div>
<!--<h1>SCEP0105 – SCEP0105 - Standard <span class="caps">JSON</span> representation method</h1>-->
<table class="docinfo"><col class="docinfo-name" /><col class="docinfo-content" />
<tbody valign="top">
<tr class="field"><th class="docinfo-name">SCEP:</th><td class="field-body">105</td></tr>
<tr class="field"><th class="docinfo-name">Title:</th><td class="field-body">Standard <span class="caps">JSON</span> representation method</td></tr>
<tr class="field"><th class="docinfo-name">Version:</th><td class="field-body">d761e41df9005076ab9540ce64fc614b0c15bb2d</td></tr>
<tr class="field"><th class="docinfo-name">Last modified:</th><td class="field-body">2014-06-20 00:43:41 UTC (Fri, 20 June 2014)</td></tr>
<tr class="field"><th class="docinfo-name">Author:</th><td class="field-body">Raphael ‘kena’ Poss</td></tr>
<tr class="field"><th class="docinfo-name">Status:</th><td class="field-body">Draft</td></tr>
<tr class="field"><th class="docinfo-name">Type:</th><td class="field-body">Standards Track</td></tr>
<tr class="field"><th class="docinfo-name">Created:</th><td class="field-body">2014-06-20</td></tr>
<tr class="field"><th class="docinfo-name">Source:</th><td class="field-body"><a href="scep0105.rst">scep0105.rst</a> (<tt>fp:XGG0y0ufgpBGRxzHbY76hYuc8ysaVo5CF7YZv5RA73COLw</tt>)</td></tr>
</tbody></table>
<p>The Structured Commons object model is defined semantically in <span class="caps">SCEP</span>
101 <a class="footnote-reference" href="#scep-101" id="id1">[1]</a>, independently from its particular representation in a
computer system. Conversely, there may exist multiple valid
representations for an object.</p>
<p>This <span class="caps">SCEP</span> defines the canonical representation of Structured
Commons objects as a <span class="caps">JSON</span> object, with method name "<strong>json</strong>".</p>
<div class="section" id="overview">
<h2>Overview</h2>
<p>The <tt class="docutils literal">json</tt> representation maps objects to a <span class="caps">JSON</span> object <a class="footnote-reference" href="#json" id="id2">[2]</a>.</p>
<p>Object files are represented by <span class="caps">JSON</span> character strings.</p>
<p>Object dictionaries are represented by <span class="caps">JSON</span> associative arrays.</p>
<p>Dictionary names that map to objects are represented by
associative array entries that are the <span class="caps">JSON</span> representation
of the enclosed object.</p>
<p>Dictionary names that map to fingerprints are represented by a <span class="caps">JSON</span>
list containing one string entry containing the compact representation
of the fingerprint.</p>
</div>
<div class="section" id="example">
<h2>Example</h2>
<p>For example, the following Structured Commons object:</p>
<pre class="literal-block">
(root)
|
+-- hello.txt (file)
| hello, world!
|
+-- link (fingerprint reference)
(fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw)
</pre>
<p>can be represented by the following <span class="caps">JSON</span> text:</p>
<pre class="code json literal-block">
<span class="p">{</span>
<span class="nt">"hello.txt"</span> <span class="p">:</span> <span class="s2">"hello, world!"</span>
<span class="s2">"link"</span> <span class="p">:</span> <span class="p">[</span><span class="s2">"fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw"</span><span class="p">]</span>
<span class="p">}</span>
</pre>
</div>
<div class="section" id="alternate-representation">
<h2>Alternate representation</h2>
<p>When an object file contains many occurrences of byte codes outside of the
printable range, the "direct" <span class="caps">JSON</span> representation using Unicode escape sequences ("<tt class="docutils literal">\uXXXX</tt>")
can incur a large space overhead, up to 500% of the length of the original byte string.</p>
<p>For applications where binary data is common, this specification provides an
<em>alternate</em>, mutually compatible encoding for file objects: a
<span class="caps">JSON</span> list containing one string containing the Base64 encoding
of the object (using the special <span class="caps">URL</span> safe alphabet defined in <a class="footnote-reference" href="#base" id="id3">[3]</a>).</p>
<p>With this alternate representation, the example above can be encoded
as follows:</p>
<pre class="code json literal-block">
<span class="p">{</span>
<span class="nt">"hello.txt"</span> <span class="p">:</span> <span class="p">[</span><span class="s2">"aGVsbG8sIHdvcmxkIQ=="</span><span class="p">],</span>
<span class="nt">"link"</span> <span class="p">:</span> <span class="p">[</span><span class="s2">"fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw"</span><span class="p">]</span>
<span class="p">}</span>
</pre>
<p>The alternate encoding is not ambiguous with fingerprint references,
since the Base64 encoding of a file object can never start with the
three characters "<tt class="docutils literal">fp:</tt>".</p>
</div>
<div class="section" id="example-reference-implementation">
<h2>Example/reference implementation</h2>
<p>Example code in Python is provided separately:</p>
<p><a class="reference external" href="https://github.com/structured-commons/tools">https://github.com/structured-commons/tools</a></p>
</div>
<div class="section" id="references">
<h2>References</h2>
<table class="docutils footnote" frame="void" id="scep-101" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><span class="caps">SCEP</span> 101. "Structured Commons Object Model and Fingerprints".
(<a class="reference external" href="http://www.structured-commons.org/scep0101.html">http://www.structured-commons.org/scep0101.html</a>)</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="json" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td><span class="caps">RFC</span> 7159. "The JavaScript Object Notation (<span class="caps">JSON</span>) Data Interchange Format".
(<a class="reference external" href="https://tools.ietf.org/html/rfc7159">https://tools.ietf.org/html/rfc7159</a>)</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="base" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td><span class="caps">RFC</span> 4648. "The Base16, Base32, and Base64 Data Encodings".
(<a class="reference external" href="https://tools.ietf.org/html/rfc4648">https://tools.ietf.org/html/rfc4648</a>)</td></tr>
</tbody>
</table>
</div>
<div class="section" id="copyright">
<h2>Copyright</h2>
<p>This document has been placed in the public domain.</p>
<!-- Local Variables:
mode: rst
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
coding: utf-8
End: -->
</div>
</div><!-- /.row -->
</div><!-- /.container -->
<div class="container.nopad bg">
<footer id="credits" class="row">
<div class="seven columns left-center">
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>,
which takes great advantage of <a href="http://python.org">Python</a>.
<br />
Based on the <a target="_blank" href="http://gumbyframework.com">Gumby Framework</a>
</address>
</div>
<div class="seven columns">
<div class="row">
<ul class="socbtns">
</ul>
</div>
</div>
</footer>
</div>
<script src="http://www.structured-commons.org/theme/js/libs/jquery-1.9.1.min.js"></script>
<script src="http://www.structured-commons.org/theme/js/libs/gumby.min.js"></script>
<script src="http://www.structured-commons.org/theme/js/plugins.js"></script>
</body>
</html>