@@ -522,6 +522,11 @@ <h2>Syntax Tokens and Keywords</h2>
522
522
developers to express specific identifiers in a compact manner. The
523
523
<code>@context</code> keyword is described in detail in
524
524
<a class="sectionRef" href="#the-context"></a>.</dd>
525
+ <dt class="changed"><code>@direction</code></dt>
526
+ <dd class="changed">Used to set the <dfn>text direction</dfn> of a <a>JSON-LD value</a>,
527
+ which are not <a>typed values</a> (e.g. <a>strings</a>, or <a>language-tagged strings</a>).
528
+ This keyword is described in
529
+ <a class="sectionRef" href="#string-internationalization"></a>.</dd>
525
530
<dt><code>@id</code></dt>
526
531
<dd>Used to uniquely identify <a>node objects</a> that are being described in the document
527
532
with <a>IRIs</a> or
@@ -4460,7 +4465,7 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
4460
4465
4461
4466
<p>When transformed into RDF, the JSON literal will have a lexical form based on
4462
4467
a specific serialization of the JSON,
4463
- as described in <a data-cite="JSON-LD11-API#round-tripping ">Compaction algorithm</a> of [[JSON-LD11-API]]
4468
+ as described in <a data-cite="JSON-LD11-API#compaction-algorithm ">Compaction algorithm</a> of [[JSON-LD11-API]]
4464
4469
and <a href="#the-rdf-json-datatype" class="sectionRef">the JSON datatype</a>.</p>
4465
4470
4466
4471
<p>The following example shows an example of a <a>JSON Literal</a> contained as the
@@ -4939,7 +4944,6 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
4939
4944
</section>
4940
4945
4941
4946
<section class="informative"><h2>String Internationalization</h2>
4942
-
4943
4947
<p>At times, it is important to annotate a <a>string</a>
4944
4948
with its language. In JSON-LD this is possible in a variety of ways.
4945
4949
First, it is possible to define a <a>default language</a> for a JSON-LD document
@@ -5004,8 +5008,9 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
5004
5008
</aside>
5005
5009
5006
5010
<p>The example above would associate the <code>ja</code> language
5007
- code with the two <a>strings</a> <em>花澄</em> and <em>科学者</em>.
5008
- <a data-cite="BCP47#section-2">Languages codes</a> are defined in [[BCP47]]. The <a>default language</a> applies to all
5011
+ code with the two <a>strings</a> <em>花澄</em> and <em>科学者</em>
5012
+ <a data-cite="BCP47#section-2">Languages codes</a> are defined in [[BCP47]].
5013
+ The <a>default language</a> applies to all
5009
5014
<a>string</a> values that are not <a href="#type-coercion">type coerced</a>.</p>
5010
5015
5011
5016
<p>To clear the <a>default language</a> for a subtree, <code>@language</code> can
@@ -5151,6 +5156,204 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
5151
5156
5152
5157
<p>See <a href="#language-maps" class="sectionRef"></a> for a description
5153
5158
of using <a>language maps</a> to set the language of mapped values.</p>
5159
+
5160
+ <section class="changed informative"><h3>Text Direction</h3>
5161
+ <p>It is also possible to annotate a <a>string</a>, or <a>language-tagged string</a>,
5162
+ with its <a>text direction</a>.
5163
+ As with language, it is possible to define a <a>default text direction</a> for a JSON-LD document
5164
+ by setting the `@direction` key in the <a>context</a>:</p>
5165
+
5166
+ <aside class="example ds-selector-tabs changed"
5167
+ title="Setting the default text direction of a JSON-LD document">
5168
+ <div class="selectors">
5169
+ <button class="selected" data-selects="compacted">Compacted (Input)</button>
5170
+ <button data-selects="expanded">Expanded (Result)</button>
5171
+ <button data-selects="statements">Statements</button>
5172
+ <button data-selects="turtle">Turtle (drops direction)</button>
5173
+ <button data-selects="turtle-dt">Turtle (with datatype)</button>
5174
+ <button data-selects="turtle-bn">Turtle (with bnode structure)</button>
5175
+ <a class="playground" target="_blank"></a>
5176
+ </div>
5177
+ <pre class="compacted input selected nohighlight" data-transform="updateExample">
5178
+ <!--
5179
+ {
5180
+ "@context": {
5181
+ "title": "http://example.org/title",
5182
+ "publisher": "http://example.org/publisher",
5183
+ ####...####
5184
+ ****"@language": "ar",
5185
+ "@direction": "rtl"****
5186
+ },
5187
+ ****"title": "HTML و CSS: تصميم و إنشاء مواقع الويب"****,
5188
+ "publisher": "مكتبة"****
5189
+ }
5190
+ -->
5191
+ </pre>
5192
+ <pre class="expanded result nohighlight"
5193
+ data-transform="updateExample"
5194
+ data-result-for="Setting the default text direction of a JSON-LD document-compacted">
5195
+ <!--
5196
+ [{
5197
+ "http://example.org/title": [{"@value": ****"HTML و CSS: تصميم و إنشاء مواقع الويب"****, "@language": "ar", ****"@direction": "rtl"****}],
5198
+ "http://example.org/publisher": [{"@value": ****"مكتبة"****, "@language": "ar", ****"@direction": "rtl"****}]
5199
+ }]
5200
+ -->
5201
+ </pre>
5202
+ <table class="statements"
5203
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5204
+ data-to-rdf>
5205
+ <thead><tr><th>Subject</th><th>Property</th><th>Value</th><th>Language</th><th>Direction</th></tr></thead>
5206
+ <tbody>
5207
+ <tr><td>_:b0</td><td>http://example.org/title</td><td>HTML و CSS: تصميم و إنشاء مواقع الويب</td><td>ar</td><td>rtl</td></tr>
5208
+ <tr><td>_:b0</td><td>http://example.org/publisher</td><td>مكتبة</td><td>ar</td><td>rtl</td></tr>
5209
+ </tbody>
5210
+ </table>
5211
+ <pre class="turtle nohighlight"
5212
+ data-content-type="text/turtle"
5213
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5214
+ data-transform="updateExample"
5215
+ data-to-rdf>
5216
+ <!--
5217
+ @prefix ex: <http://example.org/> .
5218
+
5219
+ # Note that this version drops the text direction.
5220
+ [
5221
+ ex:title ****"HTML و CSS: تصميم و إنشاء مواقع الويب"****@ar;
5222
+ ex:publisher ****"مكتبة"****@ar
5223
+ ] .
5224
+ -->
5225
+ </pre>
5226
+ <pre class="turtle-dt nohighlight"
5227
+ data-content-type="text/turtle"
5228
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5229
+ data-transform="updateExample"
5230
+ data-to-rdf>
5231
+ <!--
5232
+ @prefix ex: <http://example.org/> .
5233
+ @prefix i18n: <https://www.w3.org/i18n#> .
5234
+
5235
+ # Note that this version preserves the text direction using a datatype.
5236
+ [
5237
+ ex:title ****"HTML و CSS: تصميم و إنشاء مواقع الويب"^^i18n:ar_rtl****;
5238
+ ex:publisher ****"مكتبة"^^i18n:ar_rtl****
5239
+ ] .
5240
+ -->
5241
+ </pre>
5242
+ <pre class="turtle-bn nohighlight"
5243
+ data-content-type="text/turtle"
5244
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5245
+ data-transform="updateExample"
5246
+ data-to-rdf>
5247
+ <!--
5248
+ @prefix ex: <http://example.org/> .
5249
+
5250
+ # Note that this version preserves the text direction using a bnode structure.
5251
+ [
5252
+ ex:title ****[
5253
+ rdf:value "HTML و CSS: تصميم و إنشاء مواقع الويب",
5254
+ rdf:language "ar",
5255
+ rdf:direction "rtl"
5256
+ ]****;
5257
+ ex:publisher ****[
5258
+ rdf:value "مكتبة",
5259
+ rdf:language "ar",
5260
+ rdf:direction "rtl"
5261
+ ]****
5262
+ ] .
5263
+ -->
5264
+ </pre>
5265
+ </aside>
5266
+
5267
+ <p>The example above would associate the <code>ar</code> language
5268
+ and "rtl" text direction
5269
+ code with the two <a>strings</a> <em>HTML و CSS: تصميم و إنشاء مواقع الويب</em> and <em>مكتبة</em>.
5270
+ The <a>default text direction</a> applies to all
5271
+ <a>string</a> values that are not <a href="#type-coercion">type coerced</a>.</p>
5272
+
5273
+ <p>To clear the <a>default text direction</a> for a subtree, <code>@direction</code> can
5274
+ be set to <code>null</code> in an intervening context, such as a <a>scoped context</a> as follows:</p>
5275
+
5276
+ <pre class="example nohighlight" data-transform="updateExample"
5277
+ title="Clearing default language">
5278
+ <!--
5279
+ {
5280
+ "@context": {
5281
+ ####...####
5282
+ ****"@version": 1.1,****
5283
+ "@vocab": "http://example.com/",
5284
+ "@language": "ar",
5285
+ "@direction": "rtl",
5286
+ "details": {
5287
+ ****"@context": {
5288
+ "@direction": null
5289
+ }****
5290
+ }
5291
+ },
5292
+ "title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
5293
+ "details": {"genre": "Technical Publication"}
5294
+ }
5295
+ -->
5296
+ </pre>
5297
+
5298
+ <p>Second, it is possible to associate a text direction with a specific <a>term</a>
5299
+ using an <a>expanded term definition</a>:</p>
5300
+
5301
+ <pre class="example nohighlight" data-transform="updateExample"
5302
+ title="Expanded term definition with language">
5303
+ <!--
5304
+ {
5305
+ "@context": {
5306
+ ####...####
5307
+ "ex": "http://example.com/vocab/",
5308
+ "@language": "ar",
5309
+ "@direction": "rtl",
5310
+ "publisher": { "@id": "ex:name", ****"@direction": null**** },
5311
+ "title": { "@id": "ex:title" },
5312
+ "title_en": { "@id": "ex:title", ****"@language": "en", "@direction": "ltr"**** }
5313
+ },
5314
+ ****"publisher": "مكتبة",
5315
+ "title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
5316
+ "title_en": "HTML and CSS: Design and Build Websites"****####,
5317
+ ...####
5318
+ }
5319
+ -->
5320
+ </pre>
5321
+
5322
+ <p>The example above would associate <em>مكتبة</em> with the specified default
5323
+ language code <code>ar</code> and no <a>text direction</a>,
5324
+ <em>HTML and CSS: Design and Build Websites</em> with the language code
5325
+ <code>en</code> and <a>text direction</a> `ltr`,
5326
+ and <em>HTML و CSS: تصميم و إنشاء مواقع الويب</em> with the language code <code>ar</code>
5327
+ and <a>text direction</a> `rtl`.</p>
5328
+
5329
+ <p class="note">Text direction associations are only applied to plain
5330
+ <a>strings</a> and <a>language-tagged strings</a>.
5331
+ <a>Typed values</a> or values that are subject to <a href="#type-coercion">type coercion</a>
5332
+ are not given a text direction.</p>
5333
+
5334
+ <p>Third, it is possible to override the <a>default text direction</a> by using a
5335
+ <a>value object</a>:</p>
5336
+
5337
+ <pre class="example nohighlight" data-transform="updateExample"
5338
+ title="Overriding default language using an expanded value">
5339
+ <!--
5340
+ {
5341
+ "@context": {
5342
+ ####...####
5343
+ "@language": "ar",
5344
+ "@direction": "rtl"
5345
+ },
5346
+ "title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
5347
+ "author": ****{
5348
+ "@value": "Jon Duckett",
5349
+ "@language": "en"
5350
+ }****
5351
+ }
5352
+ -->
5353
+ </pre>
5354
+
5355
+ <p>See [[[string-meta]]] [[string-meta]] for a deeper discussion of <a>text direction</a>.</p>
5356
+ </section>
5154
5357
</section>
5155
5358
5156
5359
</section>
@@ -11233,8 +11436,8 @@ <h1>Data Model</h1>
11233
11436
<p>JSON-LD is a serialization format for Linked Data based on JSON.
11234
11437
It is therefore important to distinguish between the syntax, which is
11235
11438
defined by JSON in [[RFC8259]], and the <dfn>data model</dfn> which is
11236
- an extension of the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a> [[RDF11-CONCEPTS]]. The precise
11237
- details of how JSON-LD relates to the RDF data model are given in
11439
+ an extension of the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a> [[RDF11-CONCEPTS]].
11440
+ The precise details of how JSON-LD relates to the RDF data model are given in
11238
11441
<a class="sectionRef" href="#relationship-to-rdf"></a>.</p>
11239
11442
11240
11443
<p>To ease understanding for developers unfamiliar with the RDF model, the
@@ -11315,6 +11518,9 @@ <h1>Data Model</h1>
11315
11518
The language tag MUST be well-formed according to section
11316
11519
<a data-cite="BCP47#section-2.2.9">2.2.9 Classes of Conformance</a>
11317
11520
of [[BCP47]].</li>
11521
+ <li class="changed">Either <a>strings</a>, or <a>language-tagged strings</a> may include
11522
+ a <a>text direction</a>, which represents an extension to the underlying
11523
+ <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a>.</li>
11318
11524
<li>A <a>list</a> is a sequence of zero or more <a>IRIs</a>,
11319
11525
<a>blank nodes</a>, and <a>JSON-LD values</a>.
11320
11526
<a>Lists</a> are interpreted as
@@ -11739,13 +11945,17 @@ <h2>Graph Objects</h2>
11739
11945
<h2>Value Objects</h2>
11740
11946
11741
11947
<p>A <a>value object</a> is used to explicitly associate a type or a
11742
- language with a value to create a <a>typed value</a> or a <a>language-tagged
11743
- string</a >.</p>
11948
+ language with a value to create a <a>typed value</a> or a <a>language-tagged string</a>
11949
+ <span class="changed">and possibly associate a <a>text direction</a></span >.</p>
11744
11950
11745
11951
<p>A <a>value object</a> MUST be a <a>map</a> containing the
11746
11952
<code>@value</code> key. It MAY also contain an <code>@type</code>,
11747
- an <code>@language</code>, an <code>@index</code>, or an <code>@context</code> key but MUST NOT contain
11748
- both an <code>@type</code> and an <code>@language</code> key at the same time.
11953
+ an <code>@language</code>,
11954
+ <span class="changed">an `@direction`,</span>
11955
+ an <code>@index</code>, or an <code>@context</code> key but MUST NOT contain
11956
+ both an <code>@type</code> and either <code>@language</code>
11957
+ <span class="changed">or `@direction`</span>
11958
+ keys at the same time.
11749
11959
A <a>value object</a> MUST NOT contain any other keys that expand to an
11750
11960
<a>absolute IRI</a> or <a>keyword</a>.</p>
11751
11961
@@ -11766,6 +11976,9 @@ <h2>Value Objects</h2>
11766
11976
<p>The value associated with the <code>@language</code> key MUST have the
11767
11977
<a data-cite="BCP47#section-2.1.1">lexical form</a> described in [[BCP47]], or be <a>null</a>.</p>
11768
11978
11979
+ <p>The value associated with the <code>@direction</code> key MUST be
11980
+ one of `ltr` or `rtl`, or be <a>null</a>.</p>
11981
+
11769
11982
<p>The value associated with the <code>@index</code> key MUST be a
11770
11983
<a>string</a>.</p>
11771
11984
@@ -11781,7 +11994,12 @@ <h2>Value Patterns</h2>
11781
11994
extends a <a>value object</a> to allow
11782
11995
<a>entries</a> used specifically for <a>framing</a>.</p>
11783
11996
<ul>
11784
- <li>The values of <code>@value</code>, <code>@language</code> and <code>@type</code> MAY additionally be
11997
+ <li>The values of
11998
+ <code>@value</code>,
11999
+ <code>@language</code>,
12000
+ <code class="changed">@direction</code> and
12001
+ <code>@type</code>
12002
+ MAY additionally be
11785
12003
an empty <a>map</a> (<a data-cite="JSON-LD11-FRAMING#dfn-wildcard">wildcard</a>),
11786
12004
an <a>array</a> containing only an empty <a>map</a>,
11787
12005
an empty <a>array</a> (<a data-cite="JSON-LD11-FRAMING#dfn-match-none">match none</a>)
@@ -12376,6 +12594,14 @@ <h2>Relationship to RDF</h2>
12376
12594
and <code>false</code>. The JSON-LD 1.1 Processing Algorithms and API specification [[JSON-LD11-API]]
12377
12595
defines the <a data-cite="JSON-LD11-API#data-round-tripping">conversion rules</a>
12378
12596
between JSON's native data types and RDF's counterparts to allow round-tripping.</li>
12597
+ <li class="changed">As an extension to the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a>,
12598
+ <em>typed literals</em>, where the datatype is `xsd:string`, or <a>language-tagged strings</a>
12599
+ MAY include a <a>text direction</a>.
12600
+ As there is not yet any standardized mechanism for representing the text direction
12601
+ of <a>RDF literals</a>, the JSON-LD to RDF transformation can loose this direction.
12602
+ The <a data-cite="JSON-LD11-API#deserialize-json-ld-to-rdf-algorithm">Deserialize JSON-LD to RDF Algorithm</a>
12603
+ also provides a means of representing <a>text direction</a>
12604
+ using non-standardized mechanisms which will preserve round-tripping through RDF.</li>
12379
12605
</ul>
12380
12606
12381
12607
<p class="note">The use of <a>blank node identifiers</a> to label properties is obsolete,
0 commit comments