@@ -523,6 +523,11 @@ <h2>Syntax Tokens and Keywords</h2>
523
523
developers to express specific identifiers in a compact manner. The
524
524
<code>@context</code> keyword is described in detail in
525
525
<a class="sectionRef" href="#the-context"></a>.</dd>
526
+ <dt class="changed"><code>@direction</code></dt>
527
+ <dd class="changed">Used to set the <dfn>text direction</dfn> of a <a>JSON-LD value</a>,
528
+ which are not <a>typed values</a> (e.g. <a>strings</a>, or <a>language-tagged strings</a>).
529
+ This keyword is described in
530
+ <a class="sectionRef" href="#string-internationalization"></a>.</dd>
526
531
<dt><code>@id</code></dt>
527
532
<dd>Used to uniquely identify <a>node objects</a> that are being described in the document
528
533
with <a>IRIs</a> or
@@ -4461,7 +4466,7 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
4461
4466
4462
4467
<p>When transformed into RDF, the JSON literal will have a lexical form based on
4463
4468
a specific serialization of the JSON,
4464
- as described in <a data-cite="JSON-LD11-API#round-tripping ">Compaction algorithm</a> of [[JSON-LD11-API]]
4469
+ as described in <a data-cite="JSON-LD11-API#compaction-algorithm ">Compaction algorithm</a> of [[JSON-LD11-API]]
4465
4470
and <a href="#the-rdf-json-datatype" class="sectionRef">the JSON datatype</a>.</p>
4466
4471
4467
4472
<p>The following example shows an example of a <a>JSON Literal</a> contained as the
@@ -4945,7 +4950,6 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
4945
4950
</section>
4946
4951
4947
4952
<section class="informative"><h2>String Internationalization</h2>
4948
-
4949
4953
<p>At times, it is important to annotate a <a>string</a>
4950
4954
with its language. In JSON-LD this is possible in a variety of ways.
4951
4955
First, it is possible to define a <a>default language</a> for a JSON-LD document
@@ -5010,8 +5014,9 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
5010
5014
</aside>
5011
5015
5012
5016
<p>The example above would associate the <code>ja</code> language
5013
- code with the two <a>strings</a> <em>花澄</em> and <em>科学者</em>.
5014
- <a data-cite="BCP47#section-2">Languages codes</a> are defined in [[BCP47]]. The <a>default language</a> applies to all
5017
+ code with the two <a>strings</a> <em>花澄</em> and <em>科学者</em>
5018
+ <a data-cite="BCP47#section-2">Languages codes</a> are defined in [[BCP47]].
5019
+ The <a>default language</a> applies to all
5015
5020
<a>string</a> values that are not <a href="#type-coercion">type coerced</a>.</p>
5016
5021
5017
5022
<p>To clear the <a>default language</a> for a subtree, <code>@language</code> can
@@ -5157,6 +5162,204 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
5157
5162
5158
5163
<p>See <a href="#language-maps" class="sectionRef"></a> for a description
5159
5164
of using <a>language maps</a> to set the language of mapped values.</p>
5165
+
5166
+ <section class="changed informative"><h3>Text Direction</h3>
5167
+ <p>It is also possible to annotate a <a>string</a>, or <a>language-tagged string</a>,
5168
+ with its <a>text direction</a>.
5169
+ As with language, it is possible to define a <a>default text direction</a> for a JSON-LD document
5170
+ by setting the `@direction` key in the <a>context</a>:</p>
5171
+
5172
+ <aside class="example ds-selector-tabs changed"
5173
+ title="Setting the default text direction of a JSON-LD document">
5174
+ <div class="selectors">
5175
+ <button class="selected" data-selects="compacted">Compacted (Input)</button>
5176
+ <button data-selects="expanded">Expanded (Result)</button>
5177
+ <button data-selects="statements">Statements</button>
5178
+ <button data-selects="turtle">Turtle (drops direction)</button>
5179
+ <button data-selects="turtle-dt">Turtle (with datatype)</button>
5180
+ <button data-selects="turtle-bn">Turtle (with bnode structure)</button>
5181
+ <a class="playground" target="_blank"></a>
5182
+ </div>
5183
+ <pre class="compacted input selected nohighlight" data-transform="updateExample">
5184
+ <!--
5185
+ {
5186
+ "@context": {
5187
+ "title": "http://example.org/title",
5188
+ "publisher": "http://example.org/publisher",
5189
+ ####...####
5190
+ ****"@language": "ar",
5191
+ "@direction": "rtl"****
5192
+ },
5193
+ ****"title": "HTML و CSS: تصميم و إنشاء مواقع الويب"****,
5194
+ "publisher": "مكتبة"****
5195
+ }
5196
+ -->
5197
+ </pre>
5198
+ <pre class="expanded result nohighlight"
5199
+ data-transform="updateExample"
5200
+ data-result-for="Setting the default text direction of a JSON-LD document-compacted">
5201
+ <!--
5202
+ [{
5203
+ "http://example.org/title": [{"@value": ****"HTML و CSS: تصميم و إنشاء مواقع الويب"****, "@language": "ar", ****"@direction": "rtl"****}],
5204
+ "http://example.org/publisher": [{"@value": ****"مكتبة"****, "@language": "ar", ****"@direction": "rtl"****}]
5205
+ }]
5206
+ -->
5207
+ </pre>
5208
+ <table class="statements"
5209
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5210
+ data-to-rdf>
5211
+ <thead><tr><th>Subject</th><th>Property</th><th>Value</th><th>Language</th><th>Direction</th></tr></thead>
5212
+ <tbody>
5213
+ <tr><td>_:b0</td><td>http://example.org/title</td><td>HTML و CSS: تصميم و إنشاء مواقع الويب</td><td>ar</td><td>rtl</td></tr>
5214
+ <tr><td>_:b0</td><td>http://example.org/publisher</td><td>مكتبة</td><td>ar</td><td>rtl</td></tr>
5215
+ </tbody>
5216
+ </table>
5217
+ <pre class="turtle nohighlight"
5218
+ data-content-type="text/turtle"
5219
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5220
+ data-transform="updateExample"
5221
+ data-to-rdf>
5222
+ <!--
5223
+ @prefix ex: <http://example.org/> .
5224
+
5225
+ # Note that this version drops the text direction.
5226
+ [
5227
+ ex:title ****"HTML و CSS: تصميم و إنشاء مواقع الويب"****@ar;
5228
+ ex:publisher ****"مكتبة"****@ar
5229
+ ] .
5230
+ -->
5231
+ </pre>
5232
+ <pre class="turtle-dt nohighlight"
5233
+ data-content-type="text/turtle"
5234
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5235
+ data-transform="updateExample"
5236
+ data-to-rdf>
5237
+ <!--
5238
+ @prefix ex: <http://example.org/> .
5239
+ @prefix i18n: <https://www.w3.org/i18n#> .
5240
+
5241
+ # Note that this version preserves the text direction using a datatype.
5242
+ [
5243
+ ex:title ****"HTML و CSS: تصميم و إنشاء مواقع الويب"^^i18n:ar_rtl****;
5244
+ ex:publisher ****"مكتبة"^^i18n:ar_rtl****
5245
+ ] .
5246
+ -->
5247
+ </pre>
5248
+ <pre class="turtle-bn nohighlight"
5249
+ data-content-type="text/turtle"
5250
+ data-result-for="Setting the default text direction of a JSON-LD document-expanded"
5251
+ data-transform="updateExample"
5252
+ data-to-rdf>
5253
+ <!--
5254
+ @prefix ex: <http://example.org/> .
5255
+
5256
+ # Note that this version preserves the text direction using a bnode structure.
5257
+ [
5258
+ ex:title ****[
5259
+ rdf:value "HTML و CSS: تصميم و إنشاء مواقع الويب",
5260
+ rdf:language "ar",
5261
+ rdf:direction "rtl"
5262
+ ]****;
5263
+ ex:publisher ****[
5264
+ rdf:value "مكتبة",
5265
+ rdf:language "ar",
5266
+ rdf:direction "rtl"
5267
+ ]****
5268
+ ] .
5269
+ -->
5270
+ </pre>
5271
+ </aside>
5272
+
5273
+ <p>The example above would associate the <code>ar</code> language
5274
+ and "rtl" text direction
5275
+ code with the two <a>strings</a> <em>HTML و CSS: تصميم و إنشاء مواقع الويب</em> and <em>مكتبة</em>.
5276
+ The <a>default text direction</a> applies to all
5277
+ <a>string</a> values that are not <a href="#type-coercion">type coerced</a>.</p>
5278
+
5279
+ <p>To clear the <a>default text direction</a> for a subtree, <code>@direction</code> can
5280
+ be set to <code>null</code> in an intervening context, such as a <a>scoped context</a> as follows:</p>
5281
+
5282
+ <pre class="example nohighlight" data-transform="updateExample"
5283
+ title="Clearing default language">
5284
+ <!--
5285
+ {
5286
+ "@context": {
5287
+ ####...####
5288
+ ****"@version": 1.1,****
5289
+ "@vocab": "http://example.com/",
5290
+ "@language": "ar",
5291
+ "@direction": "rtl",
5292
+ "details": {
5293
+ ****"@context": {
5294
+ "@direction": null
5295
+ }****
5296
+ }
5297
+ },
5298
+ "title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
5299
+ "details": {"genre": "Technical Publication"}
5300
+ }
5301
+ -->
5302
+ </pre>
5303
+
5304
+ <p>Second, it is possible to associate a text direction with a specific <a>term</a>
5305
+ using an <a>expanded term definition</a>:</p>
5306
+
5307
+ <pre class="example nohighlight" data-transform="updateExample"
5308
+ title="Expanded term definition with language">
5309
+ <!--
5310
+ {
5311
+ "@context": {
5312
+ ####...####
5313
+ "ex": "http://example.com/vocab/",
5314
+ "@language": "ar",
5315
+ "@direction": "rtl",
5316
+ "publisher": { "@id": "ex:name", ****"@direction": null**** },
5317
+ "title": { "@id": "ex:title" },
5318
+ "title_en": { "@id": "ex:title", ****"@language": "en", "@direction": "ltr"**** }
5319
+ },
5320
+ ****"publisher": "مكتبة",
5321
+ "title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
5322
+ "title_en": "HTML and CSS: Design and Build Websites"****####,
5323
+ ...####
5324
+ }
5325
+ -->
5326
+ </pre>
5327
+
5328
+ <p>The example above would associate <em>مكتبة</em> with the specified default
5329
+ language code <code>ar</code> and no <a>text direction</a>,
5330
+ <em>HTML and CSS: Design and Build Websites</em> with the language code
5331
+ <code>en</code> and <a>text direction</a> `ltr`,
5332
+ and <em>HTML و CSS: تصميم و إنشاء مواقع الويب</em> with the language code <code>ar</code>
5333
+ and <a>text direction</a> `rtl`.</p>
5334
+
5335
+ <p class="note">Text direction associations are only applied to plain
5336
+ <a>strings</a> and <a>language-tagged strings</a>.
5337
+ <a>Typed values</a> or values that are subject to <a href="#type-coercion">type coercion</a>
5338
+ are not given a text direction.</p>
5339
+
5340
+ <p>Third, it is possible to override the <a>default text direction</a> by using a
5341
+ <a>value object</a>:</p>
5342
+
5343
+ <pre class="example nohighlight" data-transform="updateExample"
5344
+ title="Overriding default language using an expanded value">
5345
+ <!--
5346
+ {
5347
+ "@context": {
5348
+ ####...####
5349
+ "@language": "ar",
5350
+ "@direction": "rtl"
5351
+ },
5352
+ "title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
5353
+ "author": ****{
5354
+ "@value": "Jon Duckett",
5355
+ "@language": "en"
5356
+ }****
5357
+ }
5358
+ -->
5359
+ </pre>
5360
+
5361
+ <p>See [[[string-meta]]] [[string-meta]] for a deeper discussion of <a>text direction</a>.</p>
5362
+ </section>
5160
5363
</section>
5161
5364
5162
5365
</section>
@@ -11239,8 +11442,8 @@ <h1>Data Model</h1>
11239
11442
<p>JSON-LD is a serialization format for Linked Data based on JSON.
11240
11443
It is therefore important to distinguish between the syntax, which is
11241
11444
defined by JSON in [[RFC8259]], and the <dfn>data model</dfn> which is
11242
- an extension of the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a> [[RDF11-CONCEPTS]]. The precise
11243
- details of how JSON-LD relates to the RDF data model are given in
11445
+ an extension of the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a> [[RDF11-CONCEPTS]].
11446
+ The precise details of how JSON-LD relates to the RDF data model are given in
11244
11447
<a class="sectionRef" href="#relationship-to-rdf"></a>.</p>
11245
11448
11246
11449
<p>To ease understanding for developers unfamiliar with the RDF model, the
@@ -11321,6 +11524,9 @@ <h1>Data Model</h1>
11321
11524
The language tag MUST be well-formed according to section
11322
11525
<a data-cite="BCP47#section-2.2.9">2.2.9 Classes of Conformance</a>
11323
11526
of [[BCP47]].</li>
11527
+ <li class="changed">Either <a>strings</a>, or <a>language-tagged strings</a> may include
11528
+ a <a>text direction</a>, which represents an extension to the underlying
11529
+ <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a>.</li>
11324
11530
<li>A <a>list</a> is a sequence of zero or more <a>IRIs</a>,
11325
11531
<a>blank nodes</a>, and <a>JSON-LD values</a>.
11326
11532
<a>Lists</a> are interpreted as
@@ -11745,13 +11951,17 @@ <h2>Graph Objects</h2>
11745
11951
<h2>Value Objects</h2>
11746
11952
11747
11953
<p>A <a>value object</a> is used to explicitly associate a type or a
11748
- language with a value to create a <a>typed value</a> or a <a>language-tagged
11749
- string</a >.</p>
11954
+ language with a value to create a <a>typed value</a> or a <a>language-tagged string</a>
11955
+ <span class="changed">and possibly associate a <a>text direction</a></span >.</p>
11750
11956
11751
11957
<p>A <a>value object</a> MUST be a <a>map</a> containing the
11752
11958
<code>@value</code> key. It MAY also contain an <code>@type</code>,
11753
- an <code>@language</code>, an <code>@index</code>, or an <code>@context</code> key but MUST NOT contain
11754
- both an <code>@type</code> and an <code>@language</code> key at the same time.
11959
+ an <code>@language</code>,
11960
+ <span class="changed">an `@direction`,</span>
11961
+ an <code>@index</code>, or an <code>@context</code> key but MUST NOT contain
11962
+ both an <code>@type</code> and either <code>@language</code>
11963
+ <span class="changed">or `@direction`</span>
11964
+ keys at the same time.
11755
11965
A <a>value object</a> MUST NOT contain any other keys that expand to an
11756
11966
<a>absolute IRI</a> or <a>keyword</a>.</p>
11757
11967
@@ -11772,6 +11982,9 @@ <h2>Value Objects</h2>
11772
11982
<p>The value associated with the <code>@language</code> key MUST have the
11773
11983
<a data-cite="BCP47#section-2.1.1">lexical form</a> described in [[BCP47]], or be <a>null</a>.</p>
11774
11984
11985
+ <p>The value associated with the <code>@direction</code> key MUST be
11986
+ one of `ltr` or `rtl`, or be <a>null</a>.</p>
11987
+
11775
11988
<p>The value associated with the <code>@index</code> key MUST be a
11776
11989
<a>string</a>.</p>
11777
11990
@@ -11787,7 +12000,12 @@ <h2>Value Patterns</h2>
11787
12000
extends a <a>value object</a> to allow
11788
12001
<a>entries</a> used specifically for <a>framing</a>.</p>
11789
12002
<ul>
11790
- <li>The values of <code>@value</code>, <code>@language</code> and <code>@type</code> MAY additionally be
12003
+ <li>The values of
12004
+ <code>@value</code>,
12005
+ <code>@language</code>,
12006
+ <code class="changed">@direction</code> and
12007
+ <code>@type</code>
12008
+ MAY additionally be
11791
12009
an empty <a>map</a> (<a data-cite="JSON-LD11-FRAMING#dfn-wildcard">wildcard</a>),
11792
12010
an <a>array</a> containing only an empty <a>map</a>,
11793
12011
an empty <a>array</a> (<a data-cite="JSON-LD11-FRAMING#dfn-match-none">match none</a>)
@@ -12382,6 +12600,14 @@ <h2>Relationship to RDF</h2>
12382
12600
and <code>false</code>. The JSON-LD 1.1 Processing Algorithms and API specification [[JSON-LD11-API]]
12383
12601
defines the <a data-cite="JSON-LD11-API#data-round-tripping">conversion rules</a>
12384
12602
between JSON's native data types and RDF's counterparts to allow round-tripping.</li>
12603
+ <li class="changed">As an extension to the <a data-cite="RDF11-CONCEPTS#data-model">RDF data model</a>,
12604
+ <em>typed literals</em>, where the datatype is `xsd:string`, or <a>language-tagged strings</a>
12605
+ MAY include a <a>text direction</a>.
12606
+ As there is not yet any standardized mechanism for representing the text direction
12607
+ of <a>RDF literals</a>, the JSON-LD to RDF transformation can loose this direction.
12608
+ The <a data-cite="JSON-LD11-API#deserialize-json-ld-to-rdf-algorithm">Deserialize JSON-LD to RDF Algorithm</a>
12609
+ also provides a means of representing <a>text direction</a>
12610
+ using non-standardized mechanisms which will preserve round-tripping through RDF.</li>
12385
12611
</ul>
12386
12612
12387
12613
<p class="note">The use of <a>blank node identifiers</a> to label properties is obsolete,
0 commit comments