@twin.org/data-json-ld 0.0.1-next.3 → 0.0.1-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +613 -350
- package/dist/esm/index.mjs +615 -353
- package/dist/types/index.d.ts +26 -0
- package/dist/types/models/IJsonLdContainerType.d.ts +8 -0
- package/dist/types/models/IJsonLdContainerTypeArray.d.ts +9 -0
- package/dist/types/models/IJsonLdContextDefinition.d.ts +25 -0
- package/dist/types/models/IJsonLdContextDefinitionElement.d.ts +9 -0
- package/dist/types/models/IJsonLdContextDefinitionRoot.d.ts +9 -0
- package/dist/types/models/IJsonLdDocument.d.ts +2 -189
- package/dist/types/models/IJsonLdExpandedTermDefinition.d.ts +28 -0
- package/dist/types/models/IJsonLdGraphObject.d.ts +16 -0
- package/dist/types/models/IJsonLdIdMap.d.ts +12 -0
- package/dist/types/models/IJsonLdIncludedBlock.d.ts +10 -0
- package/dist/types/models/IJsonLdIndexMap.d.ts +13 -0
- package/dist/types/models/IJsonLdIndexMapItem.d.ts +12 -0
- package/dist/types/models/IJsonLdJsonArray.d.ts +9 -0
- package/dist/types/models/IJsonLdJsonObject.d.ts +11 -0
- package/dist/types/models/IJsonLdJsonPrimitive.d.ts +8 -0
- package/dist/types/models/IJsonLdJsonValue.d.ts +11 -0
- package/dist/types/models/IJsonLdKeyword.d.ts +42 -0
- package/dist/types/models/IJsonLdLanguageMap.d.ts +11 -0
- package/dist/types/models/IJsonLdListObject.d.ts +13 -0
- package/dist/types/models/IJsonLdListOrSetItem.d.ts +10 -0
- package/dist/types/models/IJsonLdNodeObject.d.ts +19 -0
- package/dist/types/models/IJsonLdNodePrimitive.d.ts +13 -0
- package/dist/types/models/IJsonLdObject.d.ts +24 -0
- package/dist/types/models/IJsonLdSetObject.d.ts +13 -0
- package/dist/types/models/IJsonLdTypeMap.d.ts +12 -0
- package/dist/types/models/IJsonLdValueObject.d.ts +26 -0
- package/dist/types/models/jsonLdContexts.d.ts +13 -0
- package/dist/types/models/jsonLdTypes.d.ts +27 -23
- package/dist/types/utils/jsonLdProcessor.d.ts +82 -8
- package/docs/changelog.md +29 -1
- package/docs/reference/classes/JsonLdDataTypes.md +3 -3
- package/docs/reference/classes/JsonLdHelper.md +16 -8
- package/docs/reference/classes/JsonLdProcessor.md +312 -16
- package/docs/reference/index.md +20 -15
- package/docs/reference/interfaces/IJsonLdContextDefinition.md +1 -1
- package/docs/reference/interfaces/IJsonLdGraphObject.md +1 -1
- package/docs/reference/interfaces/IJsonLdIdMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdIndexMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdJsonObject.md +3 -1
- package/docs/reference/interfaces/IJsonLdLanguageMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdNodeObject.md +40 -4
- package/docs/reference/interfaces/IJsonLdObject.md +64 -0
- package/docs/reference/interfaces/IJsonLdTypeMap.md +1 -1
- package/docs/reference/type-aliases/IJsonLdContainerType.md +3 -1
- package/docs/reference/type-aliases/IJsonLdContainerTypeArray.md +3 -1
- package/docs/reference/type-aliases/IJsonLdContextDefinitionElement.md +5 -0
- package/docs/reference/type-aliases/IJsonLdContextDefinitionRoot.md +5 -0
- package/docs/reference/type-aliases/IJsonLdDocument.md +1 -1
- package/docs/reference/type-aliases/IJsonLdExpandedTermDefinition.md +1 -1
- package/docs/reference/type-aliases/IJsonLdIncludedBlock.md +1 -1
- package/docs/reference/type-aliases/IJsonLdIndexMapItem.md +1 -1
- package/docs/reference/type-aliases/IJsonLdJsonArray.md +3 -1
- package/docs/reference/type-aliases/IJsonLdJsonPrimitive.md +3 -1
- package/docs/reference/type-aliases/IJsonLdJsonValue.md +3 -1
- package/docs/reference/type-aliases/IJsonLdKeyword.md +51 -7
- package/docs/reference/type-aliases/IJsonLdListOrSetItem.md +1 -1
- package/docs/reference/type-aliases/IJsonLdNodePrimitive.md +1 -1
- package/docs/reference/type-aliases/IJsonLdValueObject.md +1 -1
- package/docs/reference/type-aliases/JsonLdContexts.md +5 -0
- package/docs/reference/type-aliases/JsonLdTypes.md +1 -1
- package/docs/reference/variables/JsonLdContexts.md +13 -0
- package/docs/reference/variables/JsonLdTypes.md +29 -23
- package/locales/en.json +8 -3
- package/package.json +7 -37
package/dist/cjs/index.cjs
CHANGED
|
@@ -5,6 +5,19 @@ var core = require('@twin.org/core');
|
|
|
5
5
|
var web = require('@twin.org/web');
|
|
6
6
|
var jsonLd = require('jsonld');
|
|
7
7
|
|
|
8
|
+
// Copyright 2024 IOTA Stiftung.
|
|
9
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
10
|
+
/**
|
|
11
|
+
* The contexts of JSON-LD data.
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
|
+
const JsonLdContexts = {
|
|
15
|
+
/**
|
|
16
|
+
* Context Root.
|
|
17
|
+
*/
|
|
18
|
+
ContextRoot: "https://schema.twindev.org/json-ld/"
|
|
19
|
+
};
|
|
20
|
+
|
|
8
21
|
// Copyright 2024 IOTA Stiftung.
|
|
9
22
|
// SPDX-License-Identifier: Apache-2.0.
|
|
10
23
|
/**
|
|
@@ -15,107 +28,113 @@ const JsonLdTypes = {
|
|
|
15
28
|
/**
|
|
16
29
|
* Represents JSON-LD Document.
|
|
17
30
|
*/
|
|
18
|
-
Document: "
|
|
31
|
+
Document: "JsonLdDocument",
|
|
32
|
+
/**
|
|
33
|
+
* Represents JSON-LD Object.
|
|
34
|
+
*/
|
|
35
|
+
Object: "JsonLdObject",
|
|
19
36
|
/**
|
|
20
37
|
* Represents JSON-LD Node Object.
|
|
21
38
|
*/
|
|
22
|
-
NodeObject: "
|
|
39
|
+
NodeObject: "JsonLdNodeObject",
|
|
23
40
|
/**
|
|
24
41
|
* Represents JSON-LD Node Primitive.
|
|
25
42
|
*/
|
|
26
|
-
NodePrimitive: "
|
|
43
|
+
NodePrimitive: "JsonLdNodePrimitive",
|
|
27
44
|
/**
|
|
28
45
|
* Represents JSON-LD Graph Object.
|
|
29
46
|
*/
|
|
30
|
-
GraphObject: "
|
|
47
|
+
GraphObject: "JsonLdGraphObject",
|
|
31
48
|
/**
|
|
32
49
|
* Represents JSON-LD Value Object.
|
|
33
50
|
*/
|
|
34
|
-
ValueObject: "
|
|
51
|
+
ValueObject: "JsonLdValueObject",
|
|
35
52
|
/**
|
|
36
53
|
* Represents JSON-LD List Object.
|
|
37
54
|
*/
|
|
38
|
-
ListObject: "
|
|
55
|
+
ListObject: "JsonLdListObject",
|
|
39
56
|
/**
|
|
40
57
|
* Represents JSON-LD Set Object.
|
|
41
58
|
*/
|
|
42
|
-
SetObject: "
|
|
59
|
+
SetObject: "JsonLdSetObject",
|
|
43
60
|
/**
|
|
44
61
|
* Represents JSON-LD Language Map.
|
|
45
62
|
*/
|
|
46
|
-
LanguageMap: "
|
|
63
|
+
LanguageMap: "JsonLdLanguageMap",
|
|
47
64
|
/**
|
|
48
65
|
* Represents JSON-LD Index Map.
|
|
49
66
|
*/
|
|
50
|
-
IndexMap: "
|
|
67
|
+
IndexMap: "JsonLdIndexMap",
|
|
51
68
|
/**
|
|
52
69
|
* Represents JSON-LD Index Map Item.
|
|
53
70
|
*/
|
|
54
|
-
IndexMapItem: "
|
|
71
|
+
IndexMapItem: "JsonLdIndexMapItem",
|
|
55
72
|
/**
|
|
56
73
|
* Represents JSON-LD Id Map.
|
|
57
74
|
*/
|
|
58
|
-
IdMap: "
|
|
75
|
+
IdMap: "JsonLdIdMap",
|
|
59
76
|
/**
|
|
60
77
|
* Represents JSON-LD Type Map.
|
|
61
78
|
*/
|
|
62
|
-
TypeMap: "
|
|
79
|
+
TypeMap: "JsonLdTypeMap",
|
|
63
80
|
/**
|
|
64
81
|
* Represents JSON-LD Included block.
|
|
65
82
|
*/
|
|
66
|
-
IncludedBlock: "
|
|
83
|
+
IncludedBlock: "JsonLdIncludedBlock",
|
|
67
84
|
/**
|
|
68
85
|
* Represents JSON-LD Context Definition.
|
|
69
86
|
*/
|
|
70
|
-
ContextDefinition: "
|
|
87
|
+
ContextDefinition: "JsonLdContextDefinition",
|
|
71
88
|
/**
|
|
72
89
|
* Represents JSON-LD Expanded Term Definition.
|
|
73
90
|
*/
|
|
74
|
-
ExpandedTermDefinition: "
|
|
91
|
+
ExpandedTermDefinition: "JsonLdExpandedTermDefinition",
|
|
75
92
|
/**
|
|
76
93
|
* Represents JSON-LD Keyword.
|
|
77
94
|
*/
|
|
78
|
-
Keyword: "
|
|
95
|
+
Keyword: "JsonLdKeyword",
|
|
79
96
|
/**
|
|
80
97
|
* Represents JSON-LD List or Set Item.
|
|
81
98
|
*/
|
|
82
|
-
ListOrSetItem: "
|
|
99
|
+
ListOrSetItem: "JsonLdListOrSetItem",
|
|
83
100
|
/**
|
|
84
101
|
* Represents JSON-LD Container Type.
|
|
85
102
|
*/
|
|
86
|
-
ContainerType: "
|
|
103
|
+
ContainerType: "JsonLdContainerType",
|
|
87
104
|
/**
|
|
88
105
|
* Represents JSON-LD Container Type Array.
|
|
89
106
|
*/
|
|
90
|
-
ContainerTypeArray: "
|
|
107
|
+
ContainerTypeArray: "JsonLdContainerTypeArray",
|
|
91
108
|
/**
|
|
92
109
|
* Represents JSON-LD JSON Primitive.
|
|
93
110
|
*/
|
|
94
|
-
JsonPrimitive: "
|
|
111
|
+
JsonPrimitive: "JsonLdJsonPrimitive",
|
|
95
112
|
/**
|
|
96
113
|
* Represents JSON-LD JSON Array.
|
|
97
114
|
*/
|
|
98
|
-
JsonArray: "
|
|
115
|
+
JsonArray: "JsonLdJsonArray",
|
|
99
116
|
/**
|
|
100
117
|
* Represents JSON-LD JSON Object.
|
|
101
118
|
*/
|
|
102
|
-
JsonObject: "
|
|
119
|
+
JsonObject: "JsonLdJsonObject",
|
|
103
120
|
/**
|
|
104
121
|
* Represents JSON-LD JSON Value.
|
|
105
122
|
*/
|
|
106
|
-
JsonValue: "
|
|
123
|
+
JsonValue: "JsonLdJsonValue"
|
|
107
124
|
};
|
|
108
125
|
|
|
109
|
-
var type$
|
|
126
|
+
var type$e = "string";
|
|
127
|
+
var description$n = "Helper Types";
|
|
110
128
|
var JsonLdContainerTypeSchema = {
|
|
111
|
-
type: type$
|
|
129
|
+
type: type$e,
|
|
112
130
|
"enum": [
|
|
113
131
|
"@language",
|
|
114
132
|
"@index",
|
|
115
133
|
"@id",
|
|
116
134
|
"@graph",
|
|
117
135
|
"@type"
|
|
118
|
-
]
|
|
136
|
+
],
|
|
137
|
+
description: description$n
|
|
119
138
|
};
|
|
120
139
|
|
|
121
140
|
var anyOf$8 = [
|
|
@@ -292,29 +311,42 @@ var anyOf$8 = [
|
|
|
292
311
|
maxItems: 2
|
|
293
312
|
}
|
|
294
313
|
];
|
|
314
|
+
var description$m = "Helper Types.";
|
|
295
315
|
var JsonLdContainerTypeArraySchema = {
|
|
296
|
-
anyOf: anyOf$8
|
|
316
|
+
anyOf: anyOf$8,
|
|
317
|
+
description: description$m
|
|
297
318
|
};
|
|
298
319
|
|
|
299
|
-
var type$
|
|
300
|
-
var properties$
|
|
320
|
+
var type$d = "object";
|
|
321
|
+
var properties$6 = {
|
|
301
322
|
"@base": {
|
|
302
|
-
|
|
323
|
+
type: [
|
|
324
|
+
"string",
|
|
325
|
+
"null"
|
|
326
|
+
]
|
|
303
327
|
},
|
|
304
328
|
"@direction": {
|
|
305
|
-
|
|
329
|
+
type: [
|
|
330
|
+
"string",
|
|
331
|
+
"null"
|
|
332
|
+
],
|
|
333
|
+
"enum": [
|
|
334
|
+
"ltr",
|
|
335
|
+
"rtl",
|
|
336
|
+
null
|
|
337
|
+
]
|
|
306
338
|
},
|
|
307
339
|
"@import": {
|
|
308
|
-
|
|
340
|
+
type: "string"
|
|
309
341
|
},
|
|
310
342
|
"@language": {
|
|
311
|
-
|
|
343
|
+
type: "string"
|
|
312
344
|
},
|
|
313
345
|
"@propagate": {
|
|
314
|
-
|
|
346
|
+
type: "boolean"
|
|
315
347
|
},
|
|
316
348
|
"@protected": {
|
|
317
|
-
|
|
349
|
+
type: "boolean"
|
|
318
350
|
},
|
|
319
351
|
"@type": {
|
|
320
352
|
type: "object",
|
|
@@ -324,7 +356,7 @@ var properties$5 = {
|
|
|
324
356
|
"const": "@set"
|
|
325
357
|
},
|
|
326
358
|
"@protected": {
|
|
327
|
-
|
|
359
|
+
type: "boolean"
|
|
328
360
|
}
|
|
329
361
|
},
|
|
330
362
|
required: [
|
|
@@ -333,13 +365,17 @@ var properties$5 = {
|
|
|
333
365
|
additionalProperties: false
|
|
334
366
|
},
|
|
335
367
|
"@version": {
|
|
336
|
-
|
|
368
|
+
type: "string",
|
|
369
|
+
"const": "1.1"
|
|
337
370
|
},
|
|
338
371
|
"@vocab": {
|
|
339
|
-
|
|
372
|
+
type: [
|
|
373
|
+
"string",
|
|
374
|
+
"null"
|
|
375
|
+
]
|
|
340
376
|
}
|
|
341
377
|
};
|
|
342
|
-
var additionalProperties$
|
|
378
|
+
var additionalProperties$b = {
|
|
343
379
|
anyOf: [
|
|
344
380
|
{
|
|
345
381
|
type: "null"
|
|
@@ -352,12 +388,12 @@ var additionalProperties$a = {
|
|
|
352
388
|
}
|
|
353
389
|
]
|
|
354
390
|
};
|
|
355
|
-
var description$
|
|
391
|
+
var description$l = "A context definition defines a local context in a node object.";
|
|
356
392
|
var JsonLdContextDefinitionSchema = {
|
|
357
|
-
type: type$
|
|
358
|
-
properties: properties$
|
|
359
|
-
additionalProperties: additionalProperties$
|
|
360
|
-
description: description$
|
|
393
|
+
type: type$d,
|
|
394
|
+
properties: properties$6,
|
|
395
|
+
additionalProperties: additionalProperties$b,
|
|
396
|
+
description: description$l
|
|
361
397
|
};
|
|
362
398
|
|
|
363
399
|
var anyOf$7 = [
|
|
@@ -374,33 +410,7 @@ var anyOf$7 = [
|
|
|
374
410
|
type: "object",
|
|
375
411
|
properties: {
|
|
376
412
|
"@context": {
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
type: "null"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
type: "string"
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
type: "array",
|
|
389
|
-
items: {
|
|
390
|
-
anyOf: [
|
|
391
|
-
{
|
|
392
|
-
type: "null"
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
type: "string"
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
]
|
|
413
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionRoot"
|
|
404
414
|
},
|
|
405
415
|
"@graph": {
|
|
406
416
|
anyOf: [
|
|
@@ -429,10 +439,10 @@ var anyOf$7 = [
|
|
|
429
439
|
additionalProperties: false
|
|
430
440
|
}
|
|
431
441
|
];
|
|
432
|
-
var description$
|
|
442
|
+
var description$k = "A JSON-LD document MUST be valid JSON text as described in [RFC8259], or some format that can be represented in the JSON-LD internal representation that is equivalent to valid JSON text.";
|
|
433
443
|
var JsonLdDocumentSchema = {
|
|
434
444
|
anyOf: anyOf$7,
|
|
435
|
-
description: description$
|
|
445
|
+
description: description$k
|
|
436
446
|
};
|
|
437
447
|
|
|
438
448
|
var anyOf$6 = [
|
|
@@ -443,7 +453,13 @@ var anyOf$6 = [
|
|
|
443
453
|
"@id": {
|
|
444
454
|
anyOf: [
|
|
445
455
|
{
|
|
446
|
-
|
|
456
|
+
type: "string"
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
type: "array",
|
|
460
|
+
items: {
|
|
461
|
+
type: "string"
|
|
462
|
+
}
|
|
447
463
|
},
|
|
448
464
|
{
|
|
449
465
|
type: "null"
|
|
@@ -454,28 +470,64 @@ var anyOf$6 = [
|
|
|
454
470
|
type: "string"
|
|
455
471
|
},
|
|
456
472
|
"@container": {
|
|
457
|
-
|
|
473
|
+
anyOf: [
|
|
474
|
+
{
|
|
475
|
+
type: "string",
|
|
476
|
+
"const": "@list"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
type: "string",
|
|
480
|
+
"const": "@set"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContainerType"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
type: "array",
|
|
487
|
+
items: {
|
|
488
|
+
anyOf: [
|
|
489
|
+
{
|
|
490
|
+
type: "string",
|
|
491
|
+
"const": "@list"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
type: "string",
|
|
495
|
+
"const": "@set"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContainerType"
|
|
499
|
+
}
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContainerTypeArray"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
type: "null"
|
|
508
|
+
}
|
|
509
|
+
]
|
|
458
510
|
},
|
|
459
511
|
"@type": {
|
|
460
512
|
type: "string"
|
|
461
513
|
},
|
|
462
514
|
"@language": {
|
|
463
|
-
|
|
515
|
+
type: "string"
|
|
464
516
|
},
|
|
465
517
|
"@index": {
|
|
466
|
-
|
|
518
|
+
type: "string"
|
|
467
519
|
},
|
|
468
520
|
"@context": {
|
|
469
521
|
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
470
522
|
},
|
|
471
523
|
"@prefix": {
|
|
472
|
-
|
|
524
|
+
type: "boolean"
|
|
473
525
|
},
|
|
474
526
|
"@propagate": {
|
|
475
|
-
|
|
527
|
+
type: "boolean"
|
|
476
528
|
},
|
|
477
529
|
"@protected": {
|
|
478
|
-
|
|
530
|
+
type: "boolean"
|
|
479
531
|
}
|
|
480
532
|
}
|
|
481
533
|
},
|
|
@@ -484,7 +536,7 @@ var anyOf$6 = [
|
|
|
484
536
|
additionalProperties: false,
|
|
485
537
|
properties: {
|
|
486
538
|
"@reverse": {
|
|
487
|
-
|
|
539
|
+
type: "string"
|
|
488
540
|
},
|
|
489
541
|
"@container": {
|
|
490
542
|
type: [
|
|
@@ -501,22 +553,22 @@ var anyOf$6 = [
|
|
|
501
553
|
type: "string"
|
|
502
554
|
},
|
|
503
555
|
"@language": {
|
|
504
|
-
|
|
556
|
+
type: "string"
|
|
505
557
|
},
|
|
506
558
|
"@index": {
|
|
507
|
-
|
|
559
|
+
type: "string"
|
|
508
560
|
},
|
|
509
561
|
"@context": {
|
|
510
562
|
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
511
563
|
},
|
|
512
564
|
"@prefix": {
|
|
513
|
-
|
|
565
|
+
type: "boolean"
|
|
514
566
|
},
|
|
515
567
|
"@propagate": {
|
|
516
|
-
|
|
568
|
+
type: "boolean"
|
|
517
569
|
},
|
|
518
570
|
"@protected": {
|
|
519
|
-
|
|
571
|
+
type: "boolean"
|
|
520
572
|
}
|
|
521
573
|
},
|
|
522
574
|
required: [
|
|
@@ -524,14 +576,14 @@ var anyOf$6 = [
|
|
|
524
576
|
]
|
|
525
577
|
}
|
|
526
578
|
];
|
|
527
|
-
var description$
|
|
579
|
+
var description$j = "An expanded term definition is used to describe the mapping between a term and its expanded identifier, as well as other properties of the value associated with the term when it is used as key in a node object.";
|
|
528
580
|
var JsonLdExpandedTermDefinitionSchema = {
|
|
529
581
|
anyOf: anyOf$6,
|
|
530
|
-
description: description$
|
|
582
|
+
description: description$j
|
|
531
583
|
};
|
|
532
584
|
|
|
533
|
-
var type$
|
|
534
|
-
var properties$
|
|
585
|
+
var type$c = "object";
|
|
586
|
+
var properties$5 = {
|
|
535
587
|
"@graph": {
|
|
536
588
|
anyOf: [
|
|
537
589
|
{
|
|
@@ -546,73 +598,37 @@ var properties$4 = {
|
|
|
546
598
|
]
|
|
547
599
|
},
|
|
548
600
|
"@index": {
|
|
549
|
-
|
|
601
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
550
602
|
},
|
|
551
603
|
"@id": {
|
|
552
|
-
|
|
553
|
-
{
|
|
554
|
-
type: "string"
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
type: "array",
|
|
558
|
-
items: {
|
|
559
|
-
type: "string"
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
]
|
|
604
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
563
605
|
},
|
|
564
606
|
"@context": {
|
|
565
|
-
|
|
566
|
-
{
|
|
567
|
-
type: "null"
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
type: "string"
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
type: "array",
|
|
577
|
-
items: {
|
|
578
|
-
anyOf: [
|
|
579
|
-
{
|
|
580
|
-
type: "null"
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
type: "string"
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
587
|
-
}
|
|
588
|
-
]
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
]
|
|
607
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
592
608
|
}
|
|
593
609
|
};
|
|
594
610
|
var required$3 = [
|
|
595
611
|
"@graph"
|
|
596
612
|
];
|
|
597
|
-
var additionalProperties$
|
|
598
|
-
var description$
|
|
613
|
+
var additionalProperties$a = false;
|
|
614
|
+
var description$i = "A graph object represents a named graph, which MAY include an explicit graph name.";
|
|
599
615
|
var JsonLdGraphObjectSchema = {
|
|
600
|
-
type: type$
|
|
601
|
-
properties: properties$
|
|
616
|
+
type: type$c,
|
|
617
|
+
properties: properties$5,
|
|
602
618
|
required: required$3,
|
|
603
|
-
additionalProperties: additionalProperties$
|
|
604
|
-
description: description$
|
|
619
|
+
additionalProperties: additionalProperties$a,
|
|
620
|
+
description: description$i
|
|
605
621
|
};
|
|
606
622
|
|
|
607
|
-
var type$
|
|
608
|
-
var additionalProperties$
|
|
623
|
+
var type$b = "object";
|
|
624
|
+
var additionalProperties$9 = {
|
|
609
625
|
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
|
|
610
626
|
};
|
|
611
|
-
var description$
|
|
627
|
+
var description$h = "An id map is used to associate an IRI with a value that allows easy programmatic access.";
|
|
612
628
|
var JsonLdIdMapSchema = {
|
|
613
|
-
type: type$
|
|
614
|
-
additionalProperties: additionalProperties$
|
|
615
|
-
description: description$
|
|
629
|
+
type: type$b,
|
|
630
|
+
additionalProperties: additionalProperties$9,
|
|
631
|
+
description: description$h
|
|
616
632
|
};
|
|
617
633
|
|
|
618
634
|
var anyOf$5 = [
|
|
@@ -626,14 +642,14 @@ var anyOf$5 = [
|
|
|
626
642
|
}
|
|
627
643
|
}
|
|
628
644
|
];
|
|
629
|
-
var description$
|
|
645
|
+
var description$g = "An included block is used to provide a set of node objects.";
|
|
630
646
|
var JsonLdIncludedBlockSchema = {
|
|
631
647
|
anyOf: anyOf$5,
|
|
632
|
-
description: description$
|
|
648
|
+
description: description$g
|
|
633
649
|
};
|
|
634
650
|
|
|
635
|
-
var type$
|
|
636
|
-
var additionalProperties$
|
|
651
|
+
var type$a = "object";
|
|
652
|
+
var additionalProperties$8 = {
|
|
637
653
|
anyOf: [
|
|
638
654
|
{
|
|
639
655
|
$ref: "https://schema.twindev.org/json-ld/JsonLdIndexMapItem"
|
|
@@ -646,11 +662,11 @@ var additionalProperties$7 = {
|
|
|
646
662
|
}
|
|
647
663
|
]
|
|
648
664
|
};
|
|
649
|
-
var description$
|
|
665
|
+
var description$f = "An index map allows keys that have no semantic meaning, but should be preserved regardless, to be used in JSON-LD documents.";
|
|
650
666
|
var JsonLdIndexMapSchema = {
|
|
651
|
-
type: type$
|
|
652
|
-
additionalProperties: additionalProperties$
|
|
653
|
-
description: description$
|
|
667
|
+
type: type$a,
|
|
668
|
+
additionalProperties: additionalProperties$8,
|
|
669
|
+
description: description$f
|
|
654
670
|
};
|
|
655
671
|
|
|
656
672
|
var anyOf$4 = [
|
|
@@ -679,23 +695,25 @@ var anyOf$4 = [
|
|
|
679
695
|
$ref: "https://schema.twindev.org/json-ld/JsonLdSetObject"
|
|
680
696
|
}
|
|
681
697
|
];
|
|
682
|
-
var description$
|
|
698
|
+
var description$e = "The items that can be stored in an index map.";
|
|
683
699
|
var JsonLdIndexMapItemSchema = {
|
|
684
700
|
anyOf: anyOf$4,
|
|
685
|
-
description: description$
|
|
701
|
+
description: description$e
|
|
686
702
|
};
|
|
687
703
|
|
|
688
|
-
var type$
|
|
704
|
+
var type$9 = "array";
|
|
689
705
|
var items = {
|
|
690
706
|
$ref: "https://schema.twindev.org/json-ld/JsonLdJsonValue"
|
|
691
707
|
};
|
|
708
|
+
var description$d = "JSON Type for array.";
|
|
692
709
|
var JsonLdJsonArraySchema = {
|
|
693
|
-
type: type$
|
|
694
|
-
items: items
|
|
710
|
+
type: type$9,
|
|
711
|
+
items: items,
|
|
712
|
+
description: description$d
|
|
695
713
|
};
|
|
696
714
|
|
|
697
|
-
var type$
|
|
698
|
-
var additionalProperties$
|
|
715
|
+
var type$8 = "object";
|
|
716
|
+
var additionalProperties$7 = {
|
|
699
717
|
anyOf: [
|
|
700
718
|
{
|
|
701
719
|
$ref: "https://schema.twindev.org/json-ld/JsonLdJsonValue"
|
|
@@ -706,19 +724,23 @@ var additionalProperties$6 = {
|
|
|
706
724
|
}
|
|
707
725
|
]
|
|
708
726
|
};
|
|
727
|
+
var description$c = "JSON Type for object.";
|
|
709
728
|
var JsonLdJsonObjectSchema = {
|
|
710
|
-
type: type$
|
|
711
|
-
additionalProperties: additionalProperties$
|
|
729
|
+
type: type$8,
|
|
730
|
+
additionalProperties: additionalProperties$7,
|
|
731
|
+
description: description$c
|
|
712
732
|
};
|
|
713
733
|
|
|
714
|
-
var type$
|
|
734
|
+
var type$7 = [
|
|
715
735
|
"string",
|
|
716
736
|
"number",
|
|
717
737
|
"boolean",
|
|
718
738
|
"null"
|
|
719
739
|
];
|
|
740
|
+
var description$b = "JSON Primitive.";
|
|
720
741
|
var JsonLdJsonPrimitiveSchema = {
|
|
721
|
-
type: type$
|
|
742
|
+
type: type$7,
|
|
743
|
+
description: description$b
|
|
722
744
|
};
|
|
723
745
|
|
|
724
746
|
var anyOf$3 = [
|
|
@@ -732,12 +754,14 @@ var anyOf$3 = [
|
|
|
732
754
|
$ref: "https://schema.twindev.org/json-ld/JsonLdJsonObject"
|
|
733
755
|
}
|
|
734
756
|
];
|
|
757
|
+
var description$a = "JSON Value.";
|
|
735
758
|
var JsonLdJsonValueSchema = {
|
|
736
|
-
anyOf: anyOf$3
|
|
759
|
+
anyOf: anyOf$3,
|
|
760
|
+
description: description$a
|
|
737
761
|
};
|
|
738
762
|
|
|
739
|
-
var type$
|
|
740
|
-
var properties$
|
|
763
|
+
var type$6 = "object";
|
|
764
|
+
var properties$4 = {
|
|
741
765
|
"@base": {
|
|
742
766
|
type: [
|
|
743
767
|
"string",
|
|
@@ -784,33 +808,7 @@ var properties$3 = {
|
|
|
784
808
|
]
|
|
785
809
|
},
|
|
786
810
|
"@context": {
|
|
787
|
-
|
|
788
|
-
{
|
|
789
|
-
type: "null"
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
type: "string"
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
796
|
-
},
|
|
797
|
-
{
|
|
798
|
-
type: "array",
|
|
799
|
-
items: {
|
|
800
|
-
anyOf: [
|
|
801
|
-
{
|
|
802
|
-
type: "null"
|
|
803
|
-
},
|
|
804
|
-
{
|
|
805
|
-
type: "string"
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
809
|
-
}
|
|
810
|
-
]
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
]
|
|
811
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionRoot"
|
|
814
812
|
},
|
|
815
813
|
"@direction": {
|
|
816
814
|
type: [
|
|
@@ -967,18 +965,18 @@ var required$2 = [
|
|
|
967
965
|
"@version",
|
|
968
966
|
"@vocab"
|
|
969
967
|
];
|
|
970
|
-
var additionalProperties$
|
|
971
|
-
var description$
|
|
968
|
+
var additionalProperties$6 = false;
|
|
969
|
+
var description$9 = "A list of keywords and their types. Only used for internal reference; not an actual interface. Not for export.";
|
|
972
970
|
var JsonLdKeywordSchema = {
|
|
973
|
-
type: type$
|
|
974
|
-
properties: properties$
|
|
971
|
+
type: type$6,
|
|
972
|
+
properties: properties$4,
|
|
975
973
|
required: required$2,
|
|
976
|
-
additionalProperties: additionalProperties$
|
|
977
|
-
description: description$
|
|
974
|
+
additionalProperties: additionalProperties$6,
|
|
975
|
+
description: description$9
|
|
978
976
|
};
|
|
979
977
|
|
|
980
|
-
var type$
|
|
981
|
-
var additionalProperties$
|
|
978
|
+
var type$5 = "object";
|
|
979
|
+
var additionalProperties$5 = {
|
|
982
980
|
anyOf: [
|
|
983
981
|
{
|
|
984
982
|
type: "null"
|
|
@@ -994,43 +992,33 @@ var additionalProperties$4 = {
|
|
|
994
992
|
}
|
|
995
993
|
]
|
|
996
994
|
};
|
|
997
|
-
var description$
|
|
995
|
+
var description$8 = "A language map is used to associate a language with a value in a way that allows easy programmatic access.";
|
|
998
996
|
var JsonLdLanguageMapSchema = {
|
|
999
|
-
type: type$
|
|
1000
|
-
additionalProperties: additionalProperties$
|
|
1001
|
-
description: description$
|
|
997
|
+
type: type$5,
|
|
998
|
+
additionalProperties: additionalProperties$5,
|
|
999
|
+
description: description$8
|
|
1002
1000
|
};
|
|
1003
1001
|
|
|
1004
|
-
var type$
|
|
1005
|
-
var properties$
|
|
1002
|
+
var type$4 = "object";
|
|
1003
|
+
var properties$3 = {
|
|
1006
1004
|
"@list": {
|
|
1007
|
-
|
|
1008
|
-
{
|
|
1009
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdListOrSetItem"
|
|
1010
|
-
},
|
|
1011
|
-
{
|
|
1012
|
-
type: "array",
|
|
1013
|
-
items: {
|
|
1014
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdListOrSetItem"
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
]
|
|
1005
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1018
1006
|
},
|
|
1019
1007
|
"@index": {
|
|
1020
|
-
|
|
1008
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1021
1009
|
}
|
|
1022
1010
|
};
|
|
1023
1011
|
var required$1 = [
|
|
1024
1012
|
"@list"
|
|
1025
1013
|
];
|
|
1026
|
-
var additionalProperties$
|
|
1027
|
-
var description$
|
|
1014
|
+
var additionalProperties$4 = false;
|
|
1015
|
+
var description$7 = "A list represents an ordered set of values.";
|
|
1028
1016
|
var JsonLdListObjectSchema = {
|
|
1029
|
-
type: type$
|
|
1030
|
-
properties: properties$
|
|
1017
|
+
type: type$4,
|
|
1018
|
+
properties: properties$3,
|
|
1031
1019
|
required: required$1,
|
|
1032
|
-
additionalProperties: additionalProperties$
|
|
1033
|
-
description: description$
|
|
1020
|
+
additionalProperties: additionalProperties$4,
|
|
1021
|
+
description: description$7
|
|
1034
1022
|
};
|
|
1035
1023
|
|
|
1036
1024
|
var anyOf$2 = [
|
|
@@ -1053,58 +1041,47 @@ var anyOf$2 = [
|
|
|
1053
1041
|
$ref: "https://schema.twindev.org/json-ld/JsonLdValueObject"
|
|
1054
1042
|
}
|
|
1055
1043
|
];
|
|
1056
|
-
var description$
|
|
1044
|
+
var description$6 = "A list or set item can be a null, boolean, number, string, node object, or value object.";
|
|
1057
1045
|
var JsonLdListOrSetItemSchema = {
|
|
1058
1046
|
anyOf: anyOf$2,
|
|
1059
|
-
description: description$
|
|
1047
|
+
description: description$6
|
|
1060
1048
|
};
|
|
1061
1049
|
|
|
1062
|
-
var type$
|
|
1063
|
-
var
|
|
1050
|
+
var type$3 = "object";
|
|
1051
|
+
var additionalProperties$3 = {
|
|
1052
|
+
anyOf: [
|
|
1053
|
+
{
|
|
1054
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodePrimitive"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdLanguageMap"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdIndexMap"
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdIncludedBlock"
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdIdMap"
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdTypeMap"
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
type: "array"
|
|
1073
|
+
}
|
|
1074
|
+
]
|
|
1075
|
+
};
|
|
1076
|
+
var properties$2 = {
|
|
1064
1077
|
"@context": {
|
|
1065
|
-
|
|
1066
|
-
{
|
|
1067
|
-
type: "null"
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
type: "string"
|
|
1071
|
-
},
|
|
1072
|
-
{
|
|
1073
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
type: "array",
|
|
1077
|
-
items: {
|
|
1078
|
-
anyOf: [
|
|
1079
|
-
{
|
|
1080
|
-
type: "null"
|
|
1081
|
-
},
|
|
1082
|
-
{
|
|
1083
|
-
type: "string"
|
|
1084
|
-
},
|
|
1085
|
-
{
|
|
1086
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
|
|
1087
|
-
}
|
|
1088
|
-
]
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
]
|
|
1078
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1092
1079
|
},
|
|
1093
1080
|
"@id": {
|
|
1094
|
-
|
|
1095
|
-
{
|
|
1096
|
-
type: "string"
|
|
1097
|
-
},
|
|
1098
|
-
{
|
|
1099
|
-
type: "array",
|
|
1100
|
-
items: {
|
|
1101
|
-
type: "string"
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
]
|
|
1081
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1105
1082
|
},
|
|
1106
1083
|
"@included": {
|
|
1107
|
-
$ref: "https://schema.twindev.org/json-ld/
|
|
1084
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1108
1085
|
},
|
|
1109
1086
|
"@graph": {
|
|
1110
1087
|
anyOf: [
|
|
@@ -1135,12 +1112,12 @@ var properties$1 = {
|
|
|
1135
1112
|
"@type": {
|
|
1136
1113
|
anyOf: [
|
|
1137
1114
|
{
|
|
1138
|
-
|
|
1115
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1139
1116
|
},
|
|
1140
1117
|
{
|
|
1141
1118
|
type: "array",
|
|
1142
1119
|
items: {
|
|
1143
|
-
|
|
1120
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1144
1121
|
}
|
|
1145
1122
|
}
|
|
1146
1123
|
]
|
|
@@ -1148,47 +1125,19 @@ var properties$1 = {
|
|
|
1148
1125
|
"@reverse": {
|
|
1149
1126
|
type: "object",
|
|
1150
1127
|
additionalProperties: {
|
|
1151
|
-
|
|
1128
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1152
1129
|
}
|
|
1153
1130
|
},
|
|
1154
1131
|
"@index": {
|
|
1155
|
-
|
|
1132
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1156
1133
|
}
|
|
1157
1134
|
};
|
|
1158
|
-
var
|
|
1159
|
-
anyOf: [
|
|
1160
|
-
{
|
|
1161
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodePrimitive"
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
type: "array",
|
|
1165
|
-
items: {
|
|
1166
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdNodePrimitive"
|
|
1167
|
-
}
|
|
1168
|
-
},
|
|
1169
|
-
{
|
|
1170
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdLanguageMap"
|
|
1171
|
-
},
|
|
1172
|
-
{
|
|
1173
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdIndexMap"
|
|
1174
|
-
},
|
|
1175
|
-
{
|
|
1176
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdIncludedBlock"
|
|
1177
|
-
},
|
|
1178
|
-
{
|
|
1179
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdIdMap"
|
|
1180
|
-
},
|
|
1181
|
-
{
|
|
1182
|
-
$ref: "https://schema.twindev.org/json-ld/JsonLdTypeMap"
|
|
1183
|
-
}
|
|
1184
|
-
]
|
|
1185
|
-
};
|
|
1186
|
-
var description$4 = "A node object represents zero or more properties of a node in the graph serialized by the JSON-LD document.";
|
|
1135
|
+
var description$5 = "A node object represents zero or more properties of a node in the graph serialized by the JSON-LD document.";
|
|
1187
1136
|
var JsonLdNodeObjectSchema = {
|
|
1188
|
-
type: type$
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
description: description$
|
|
1137
|
+
type: type$3,
|
|
1138
|
+
additionalProperties: additionalProperties$3,
|
|
1139
|
+
properties: properties$2,
|
|
1140
|
+
description: description$5
|
|
1192
1141
|
};
|
|
1193
1142
|
|
|
1194
1143
|
var anyOf$1 = [
|
|
@@ -1220,29 +1169,88 @@ var anyOf$1 = [
|
|
|
1220
1169
|
$ref: "https://schema.twindev.org/json-ld/JsonLdSetObject"
|
|
1221
1170
|
}
|
|
1222
1171
|
];
|
|
1223
|
-
var description$
|
|
1172
|
+
var description$4 = "A node primitive is a JSON-LD value which is not one of the defined NodeObject properties.";
|
|
1224
1173
|
var JsonLdNodePrimitiveSchema = {
|
|
1225
1174
|
anyOf: anyOf$1,
|
|
1226
|
-
description: description$
|
|
1175
|
+
description: description$4
|
|
1227
1176
|
};
|
|
1228
1177
|
|
|
1229
|
-
var type$
|
|
1230
|
-
var properties = {
|
|
1231
|
-
"@
|
|
1178
|
+
var type$2 = "object";
|
|
1179
|
+
var properties$1 = {
|
|
1180
|
+
"@context": {
|
|
1181
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1182
|
+
},
|
|
1183
|
+
"@id": {
|
|
1184
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1185
|
+
},
|
|
1186
|
+
"@included": {
|
|
1187
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1188
|
+
},
|
|
1189
|
+
"@graph": {
|
|
1232
1190
|
anyOf: [
|
|
1233
1191
|
{
|
|
1234
|
-
$ref: "https://schema.twindev.org/json-ld/
|
|
1192
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
|
|
1235
1193
|
},
|
|
1236
1194
|
{
|
|
1237
1195
|
type: "array",
|
|
1238
1196
|
items: {
|
|
1239
|
-
$ref: "https://schema.twindev.org/json-ld/
|
|
1197
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
|
|
1240
1198
|
}
|
|
1241
1199
|
}
|
|
1242
1200
|
]
|
|
1243
1201
|
},
|
|
1202
|
+
"@nest": {
|
|
1203
|
+
anyOf: [
|
|
1204
|
+
{
|
|
1205
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdJsonObject"
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
type: "array",
|
|
1209
|
+
items: {
|
|
1210
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdJsonObject"
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
]
|
|
1214
|
+
},
|
|
1215
|
+
"@type": {
|
|
1216
|
+
anyOf: [
|
|
1217
|
+
{
|
|
1218
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
type: "array",
|
|
1222
|
+
items: {
|
|
1223
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
]
|
|
1227
|
+
},
|
|
1228
|
+
"@reverse": {
|
|
1229
|
+
type: "object",
|
|
1230
|
+
additionalProperties: {
|
|
1231
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1244
1234
|
"@index": {
|
|
1245
|
-
|
|
1235
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
var additionalProperties$2 = false;
|
|
1239
|
+
var description$3 = "An object represents the pre-defined properties of the node object in the graph serialized by the JSON-LD document.";
|
|
1240
|
+
var JsonLdObjectSchema = {
|
|
1241
|
+
type: type$2,
|
|
1242
|
+
properties: properties$1,
|
|
1243
|
+
additionalProperties: additionalProperties$2,
|
|
1244
|
+
description: description$3
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
var type$1 = "object";
|
|
1248
|
+
var properties = {
|
|
1249
|
+
"@set": {
|
|
1250
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1251
|
+
},
|
|
1252
|
+
"@index": {
|
|
1253
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
|
|
1246
1254
|
}
|
|
1247
1255
|
};
|
|
1248
1256
|
var required = [
|
|
@@ -1373,99 +1381,103 @@ class JsonLdDataTypes {
|
|
|
1373
1381
|
* Register all the data types.
|
|
1374
1382
|
*/
|
|
1375
1383
|
static registerTypes() {
|
|
1376
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.Document
|
|
1384
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Document}`, () => ({
|
|
1377
1385
|
type: JsonLdTypes.Document,
|
|
1378
1386
|
jsonSchema: async () => JsonLdDocumentSchema
|
|
1379
1387
|
}));
|
|
1380
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.
|
|
1388
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Object}`, () => ({
|
|
1389
|
+
type: JsonLdTypes.Object,
|
|
1390
|
+
jsonSchema: async () => JsonLdObjectSchema
|
|
1391
|
+
}));
|
|
1392
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodeObject}`, () => ({
|
|
1381
1393
|
type: JsonLdTypes.NodeObject,
|
|
1382
1394
|
jsonSchema: async () => JsonLdNodeObjectSchema
|
|
1383
1395
|
}));
|
|
1384
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.NodePrimitive
|
|
1396
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.NodePrimitive}`, () => ({
|
|
1385
1397
|
type: JsonLdTypes.NodePrimitive,
|
|
1386
1398
|
jsonSchema: async () => JsonLdNodePrimitiveSchema
|
|
1387
1399
|
}));
|
|
1388
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.GraphObject
|
|
1400
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.GraphObject}`, () => ({
|
|
1389
1401
|
type: JsonLdTypes.GraphObject,
|
|
1390
1402
|
jsonSchema: async () => JsonLdGraphObjectSchema
|
|
1391
1403
|
}));
|
|
1392
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ValueObject
|
|
1404
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ValueObject}`, () => ({
|
|
1393
1405
|
type: JsonLdTypes.ValueObject,
|
|
1394
1406
|
jsonSchema: async () => JsonLdValueObjectSchema
|
|
1395
1407
|
}));
|
|
1396
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ListObject
|
|
1408
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1397
1409
|
type: JsonLdTypes.ListObject,
|
|
1398
1410
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1399
1411
|
}));
|
|
1400
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ListObject
|
|
1412
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListObject}`, () => ({
|
|
1401
1413
|
type: JsonLdTypes.ListObject,
|
|
1402
1414
|
jsonSchema: async () => JsonLdListObjectSchema
|
|
1403
1415
|
}));
|
|
1404
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.SetObject
|
|
1416
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.SetObject}`, () => ({
|
|
1405
1417
|
type: JsonLdTypes.SetObject,
|
|
1406
1418
|
jsonSchema: async () => JsonLdSetObjectSchema
|
|
1407
1419
|
}));
|
|
1408
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.LanguageMap
|
|
1420
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.LanguageMap}`, () => ({
|
|
1409
1421
|
type: JsonLdTypes.LanguageMap,
|
|
1410
1422
|
jsonSchema: async () => JsonLdLanguageMapSchema
|
|
1411
1423
|
}));
|
|
1412
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.IndexMap
|
|
1424
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMap}`, () => ({
|
|
1413
1425
|
type: JsonLdTypes.IndexMap,
|
|
1414
1426
|
jsonSchema: async () => JsonLdIndexMapSchema
|
|
1415
1427
|
}));
|
|
1416
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.IndexMapItem
|
|
1428
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IndexMapItem}`, () => ({
|
|
1417
1429
|
type: JsonLdTypes.IndexMapItem,
|
|
1418
1430
|
jsonSchema: async () => JsonLdIndexMapItemSchema
|
|
1419
1431
|
}));
|
|
1420
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.IdMap
|
|
1432
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IdMap}`, () => ({
|
|
1421
1433
|
type: JsonLdTypes.IdMap,
|
|
1422
1434
|
jsonSchema: async () => JsonLdIdMapSchema
|
|
1423
1435
|
}));
|
|
1424
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.TypeMap
|
|
1436
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.TypeMap}`, () => ({
|
|
1425
1437
|
type: JsonLdTypes.TypeMap,
|
|
1426
1438
|
jsonSchema: async () => JsonLdTypeMapSchema
|
|
1427
1439
|
}));
|
|
1428
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.IncludedBlock
|
|
1440
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.IncludedBlock}`, () => ({
|
|
1429
1441
|
type: JsonLdTypes.IncludedBlock,
|
|
1430
1442
|
jsonSchema: async () => JsonLdIncludedBlockSchema
|
|
1431
1443
|
}));
|
|
1432
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ContextDefinition
|
|
1444
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContextDefinition}`, () => ({
|
|
1433
1445
|
type: JsonLdTypes.ContextDefinition,
|
|
1434
1446
|
jsonSchema: async () => JsonLdContextDefinitionSchema
|
|
1435
1447
|
}));
|
|
1436
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ExpandedTermDefinition
|
|
1448
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ExpandedTermDefinition}`, () => ({
|
|
1437
1449
|
type: JsonLdTypes.ExpandedTermDefinition,
|
|
1438
1450
|
jsonSchema: async () => JsonLdExpandedTermDefinitionSchema
|
|
1439
1451
|
}));
|
|
1440
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.Keyword
|
|
1452
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.Keyword}`, () => ({
|
|
1441
1453
|
type: JsonLdTypes.Keyword,
|
|
1442
1454
|
jsonSchema: async () => JsonLdKeywordSchema
|
|
1443
1455
|
}));
|
|
1444
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ListOrSetItem
|
|
1456
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ListOrSetItem}`, () => ({
|
|
1445
1457
|
type: JsonLdTypes.ListOrSetItem,
|
|
1446
1458
|
jsonSchema: async () => JsonLdListOrSetItemSchema
|
|
1447
1459
|
}));
|
|
1448
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ContainerType
|
|
1460
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerType}`, () => ({
|
|
1449
1461
|
type: JsonLdTypes.ContainerType,
|
|
1450
1462
|
jsonSchema: async () => JsonLdContainerTypeSchema
|
|
1451
1463
|
}));
|
|
1452
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.ContainerTypeArray
|
|
1464
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.ContainerTypeArray}`, () => ({
|
|
1453
1465
|
type: JsonLdTypes.ContainerTypeArray,
|
|
1454
1466
|
jsonSchema: async () => JsonLdContainerTypeArraySchema
|
|
1455
1467
|
}));
|
|
1456
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.JsonPrimitive
|
|
1468
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonPrimitive}`, () => ({
|
|
1457
1469
|
type: JsonLdTypes.JsonPrimitive,
|
|
1458
1470
|
jsonSchema: async () => JsonLdJsonPrimitiveSchema
|
|
1459
1471
|
}));
|
|
1460
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.JsonArray
|
|
1472
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonArray}`, () => ({
|
|
1461
1473
|
type: JsonLdTypes.JsonArray,
|
|
1462
1474
|
jsonSchema: async () => JsonLdJsonArraySchema
|
|
1463
1475
|
}));
|
|
1464
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.JsonObject
|
|
1476
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonObject}`, () => ({
|
|
1465
1477
|
type: JsonLdTypes.JsonObject,
|
|
1466
1478
|
jsonSchema: async () => JsonLdJsonObjectSchema
|
|
1467
1479
|
}));
|
|
1468
|
-
dataCore.DataTypeHandlerFactory.register(JsonLdTypes.JsonValue
|
|
1480
|
+
dataCore.DataTypeHandlerFactory.register(`${JsonLdContexts.ContextRoot}${JsonLdTypes.JsonValue}`, () => ({
|
|
1469
1481
|
type: JsonLdTypes.JsonValue,
|
|
1470
1482
|
jsonSchema: async () => JsonLdJsonValueSchema
|
|
1471
1483
|
}));
|
|
@@ -1521,26 +1533,95 @@ class JsonLdProcessor {
|
|
|
1521
1533
|
*/
|
|
1522
1534
|
static _CLASS_NAME = "JsonLdProcessor";
|
|
1523
1535
|
/**
|
|
1524
|
-
*
|
|
1536
|
+
* The document loader to use.
|
|
1537
|
+
* @param documentLoader The document loader to use.
|
|
1525
1538
|
*/
|
|
1526
|
-
static
|
|
1539
|
+
static setDocumentLoader(documentLoader) {
|
|
1540
|
+
core.SharedStore.set("jsonLdDocumentLoader", documentLoader);
|
|
1541
|
+
}
|
|
1527
1542
|
/**
|
|
1528
|
-
* The document loader to use.
|
|
1543
|
+
* The document loader to use for retrieving JSON-LD documents.
|
|
1544
|
+
* @returns The document loader.
|
|
1545
|
+
*/
|
|
1546
|
+
static getDocumentLoader() {
|
|
1547
|
+
let documentLoader = core.SharedStore.get("jsonLdDocumentLoader");
|
|
1548
|
+
if (core.Is.empty(documentLoader)) {
|
|
1549
|
+
documentLoader = async (url) => JsonLdProcessor.documentLoader(url);
|
|
1550
|
+
}
|
|
1551
|
+
return documentLoader;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Set the cache time limit for documents.
|
|
1555
|
+
* @param cacheLimitMs The cache limit in milliseconds.
|
|
1529
1556
|
*/
|
|
1530
|
-
static
|
|
1557
|
+
static setCacheLimit(cacheLimitMs) {
|
|
1558
|
+
core.SharedStore.set("jsonLdDocumentCacheLimit", cacheLimitMs);
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Get the cache limit for documents.
|
|
1562
|
+
* @returns The document loader.
|
|
1563
|
+
*/
|
|
1564
|
+
static getCacheLimit() {
|
|
1565
|
+
let cacheLimitMs = core.SharedStore.get("jsonLdDocumentCacheLimit");
|
|
1566
|
+
if (core.Is.empty(cacheLimitMs)) {
|
|
1567
|
+
cacheLimitMs = 3600000;
|
|
1568
|
+
core.SharedStore.set("jsonLdDocumentCacheLimit", cacheLimitMs);
|
|
1569
|
+
}
|
|
1570
|
+
return cacheLimitMs;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Set the global redirects for JSON-LD, use addRedirect for default handling.
|
|
1574
|
+
* @param redirects The redirects to use.
|
|
1575
|
+
*/
|
|
1576
|
+
static setRedirects(redirects) {
|
|
1577
|
+
core.SharedStore.set("jsonLdRedirects", redirects);
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Get the global redirects for JSON-LD.
|
|
1581
|
+
* @returns The registered redirects.
|
|
1582
|
+
*/
|
|
1583
|
+
static getRedirects() {
|
|
1584
|
+
let redirects = core.SharedStore.get("jsonLdRedirects");
|
|
1585
|
+
if (core.Is.empty(redirects)) {
|
|
1586
|
+
redirects = [];
|
|
1587
|
+
core.SharedStore.set("jsonLdRedirects", redirects);
|
|
1588
|
+
}
|
|
1589
|
+
return redirects;
|
|
1590
|
+
}
|
|
1531
1591
|
/**
|
|
1532
1592
|
* Compact a document according to a particular context.
|
|
1533
1593
|
* @param document The JSON-LD document to compact.
|
|
1534
|
-
* @param context The context to compact the document to.
|
|
1594
|
+
* @param context The context to compact the document to, if not provided will try and gather from the object.
|
|
1535
1595
|
* @returns The compacted JSON-LD document.
|
|
1536
1596
|
*/
|
|
1537
1597
|
static async compact(document, context) {
|
|
1538
1598
|
try {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1599
|
+
if (core.Is.object(document)) {
|
|
1600
|
+
if (core.Is.empty(context)) {
|
|
1601
|
+
context = {};
|
|
1602
|
+
if (core.Is.array(document)) {
|
|
1603
|
+
for (const node of document) {
|
|
1604
|
+
context = JsonLdProcessor.gatherContexts(node, context);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
else if (core.Is.array(document["@graph"])) {
|
|
1608
|
+
for (const node of document["@graph"]) {
|
|
1609
|
+
context = JsonLdProcessor.gatherContexts(node, context);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
else if (core.Is.object(document)) {
|
|
1613
|
+
context = JsonLdProcessor.gatherContexts(document, context);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
const compacted = await jsonLd.compact(core.ObjectHelper.removeEmptyProperties(document), context, {
|
|
1617
|
+
documentLoader: JsonLdProcessor.getDocumentLoader()
|
|
1618
|
+
});
|
|
1619
|
+
return compacted;
|
|
1620
|
+
}
|
|
1621
|
+
return document;
|
|
1542
1622
|
}
|
|
1543
1623
|
catch (err) {
|
|
1624
|
+
JsonLdProcessor.handleCommonErrors(err);
|
|
1544
1625
|
throw new core.GeneralError(JsonLdProcessor._CLASS_NAME, "compact", undefined, err);
|
|
1545
1626
|
}
|
|
1546
1627
|
}
|
|
@@ -1551,24 +1632,189 @@ class JsonLdProcessor {
|
|
|
1551
1632
|
*/
|
|
1552
1633
|
static async expand(compacted) {
|
|
1553
1634
|
try {
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1635
|
+
if (core.Is.object(compacted)) {
|
|
1636
|
+
const expanded = await jsonLd.expand(core.ObjectHelper.removeEmptyProperties(compacted), {
|
|
1637
|
+
documentLoader: JsonLdProcessor.getDocumentLoader()
|
|
1638
|
+
});
|
|
1639
|
+
return expanded;
|
|
1640
|
+
}
|
|
1641
|
+
return [];
|
|
1557
1642
|
}
|
|
1558
1643
|
catch (err) {
|
|
1644
|
+
JsonLdProcessor.handleCommonErrors(err);
|
|
1559
1645
|
throw new core.GeneralError(JsonLdProcessor._CLASS_NAME, "expand", undefined, err);
|
|
1560
1646
|
}
|
|
1561
1647
|
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Canonize a document.
|
|
1650
|
+
* @param document The document to canonize.
|
|
1651
|
+
* @param options The options for canonization.
|
|
1652
|
+
* @param options.algorithm The algorithm to use for canonization, defaults to URDNA2015.
|
|
1653
|
+
* @returns The canonized document.
|
|
1654
|
+
*/
|
|
1655
|
+
static async canonize(document, options) {
|
|
1656
|
+
try {
|
|
1657
|
+
const normalized = await jsonLd.canonize(core.ObjectHelper.removeEmptyProperties(document), {
|
|
1658
|
+
algorithm: options?.algorithm ?? "URDNA2015",
|
|
1659
|
+
format: "application/n-quads",
|
|
1660
|
+
documentLoader: JsonLdProcessor.getDocumentLoader()
|
|
1661
|
+
});
|
|
1662
|
+
return normalized;
|
|
1663
|
+
}
|
|
1664
|
+
catch (err) {
|
|
1665
|
+
JsonLdProcessor.handleCommonErrors(err);
|
|
1666
|
+
throw new core.GeneralError(JsonLdProcessor._CLASS_NAME, "canonize", undefined, err);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1562
1669
|
/**
|
|
1563
1670
|
* Add a redirect to use during document resolution.
|
|
1564
1671
|
* @param from The URL to redirect from.
|
|
1565
1672
|
* @param to The URL to redirect to.
|
|
1566
1673
|
*/
|
|
1567
1674
|
static addRedirect(from, to) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1675
|
+
const redirects = JsonLdProcessor.getRedirects();
|
|
1676
|
+
if (!redirects.some(r => r.from === from)) {
|
|
1677
|
+
redirects.push({ from, to });
|
|
1570
1678
|
}
|
|
1571
1679
|
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Combine contexts.
|
|
1682
|
+
* @param context1 The first JSON-LD context to combine.
|
|
1683
|
+
* @param context2 The second JSON-LD context to combine.
|
|
1684
|
+
* @returns The combined context.
|
|
1685
|
+
*/
|
|
1686
|
+
static combineContexts(context1, context2) {
|
|
1687
|
+
const combinedContext = [];
|
|
1688
|
+
if (core.Is.string(context1)) {
|
|
1689
|
+
if (!combinedContext.includes(context1)) {
|
|
1690
|
+
combinedContext.push(context1);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
else if (core.Is.array(context1)) {
|
|
1694
|
+
for (const context of context1) {
|
|
1695
|
+
const hasMatch = combinedContext.some(c => core.ObjectHelper.equal(c, context));
|
|
1696
|
+
if (!hasMatch) {
|
|
1697
|
+
combinedContext.push(context);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
else if (core.Is.object(context1)) {
|
|
1702
|
+
const hasMatch = combinedContext.some(c => core.ObjectHelper.equal(c, context1));
|
|
1703
|
+
if (!hasMatch) {
|
|
1704
|
+
combinedContext.push(context1);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
if (core.Is.string(context2)) {
|
|
1708
|
+
if (!combinedContext.includes(context2)) {
|
|
1709
|
+
combinedContext.push(context2);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
else if (core.Is.array(context2)) {
|
|
1713
|
+
for (const context of context2) {
|
|
1714
|
+
const hasMatch = combinedContext.some(c => core.ObjectHelper.equal(c, context));
|
|
1715
|
+
if (!hasMatch) {
|
|
1716
|
+
combinedContext.push(context);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
else if (core.Is.object(context2)) {
|
|
1721
|
+
const hasMatch = combinedContext.some(c => core.ObjectHelper.equal(c, context2));
|
|
1722
|
+
if (!hasMatch) {
|
|
1723
|
+
combinedContext.push(context2);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
if (combinedContext.length === 0) {
|
|
1727
|
+
return null;
|
|
1728
|
+
}
|
|
1729
|
+
if (combinedContext.length === 1) {
|
|
1730
|
+
return combinedContext[0];
|
|
1731
|
+
}
|
|
1732
|
+
return combinedContext;
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* Gather all the contexts from the element and it's children.
|
|
1736
|
+
* @param element The element to gather the contexts from.
|
|
1737
|
+
* @param initial The initial context.
|
|
1738
|
+
* @returns The combined contexts.
|
|
1739
|
+
*/
|
|
1740
|
+
static gatherContexts(element, initial) {
|
|
1741
|
+
let combinedContexts = initial;
|
|
1742
|
+
if (core.Is.object(element)) {
|
|
1743
|
+
if (!core.Is.empty(element["@context"])) {
|
|
1744
|
+
combinedContexts = JsonLdProcessor.combineContexts(initial, element["@context"]);
|
|
1745
|
+
}
|
|
1746
|
+
for (const prop of Object.keys(element)) {
|
|
1747
|
+
const value = element[prop];
|
|
1748
|
+
if (core.Is.object(value)) {
|
|
1749
|
+
combinedContexts = this.gatherContexts(value, combinedContexts);
|
|
1750
|
+
}
|
|
1751
|
+
else if (core.Is.array(value)) {
|
|
1752
|
+
for (const item of value) {
|
|
1753
|
+
if (core.Is.object(item)) {
|
|
1754
|
+
combinedContexts = this.gatherContexts(item, combinedContexts);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
return combinedContexts;
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Remove all the contexts that match the pattern.
|
|
1764
|
+
* @param context The context to remove the entries from.
|
|
1765
|
+
* @param match The element to try and match.
|
|
1766
|
+
* @returns The updated contexts.
|
|
1767
|
+
*/
|
|
1768
|
+
static removeContexts(context, match) {
|
|
1769
|
+
if (!core.Is.arrayValue(match)) {
|
|
1770
|
+
return context;
|
|
1771
|
+
}
|
|
1772
|
+
let finalContext;
|
|
1773
|
+
if (core.Is.string(context)) {
|
|
1774
|
+
for (const m of match) {
|
|
1775
|
+
if (context === m) {
|
|
1776
|
+
break;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
else if (core.Is.array(context)) {
|
|
1781
|
+
for (const item of context) {
|
|
1782
|
+
const hasMatch = match.some(m => core.ObjectHelper.equal(m, item));
|
|
1783
|
+
if (!hasMatch) {
|
|
1784
|
+
finalContext ??= [];
|
|
1785
|
+
if (core.Is.array(finalContext)) {
|
|
1786
|
+
finalContext.push(item);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
else if (core.Is.object(context)) {
|
|
1792
|
+
const hasMatch = match.some(m => core.ObjectHelper.equal(m, context));
|
|
1793
|
+
if (!hasMatch) {
|
|
1794
|
+
finalContext = context;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return core.Is.arrayValue(finalContext) && finalContext.length === 1
|
|
1798
|
+
? finalContext[0]
|
|
1799
|
+
: finalContext;
|
|
1800
|
+
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Add a context directly to the document loader cache.
|
|
1803
|
+
* @param url The url the ld context is for.
|
|
1804
|
+
* @param ldContext The context to add.
|
|
1805
|
+
* @returns Nothing.
|
|
1806
|
+
*/
|
|
1807
|
+
static async documentCacheAdd(url, ldContext) {
|
|
1808
|
+
await web.FetchHelper.setCacheEntry(url, ldContext);
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Remove a context from the document loader cache.
|
|
1812
|
+
* @param url The url the ld context is for.
|
|
1813
|
+
* @returns Nothing.
|
|
1814
|
+
*/
|
|
1815
|
+
static async documentCacheRemove(url) {
|
|
1816
|
+
await web.FetchHelper.removeCacheEntry(url);
|
|
1817
|
+
}
|
|
1572
1818
|
/**
|
|
1573
1819
|
* Document loader which uses a caching mechanism.
|
|
1574
1820
|
* @param url The document url to load.
|
|
@@ -1576,7 +1822,8 @@ class JsonLdProcessor {
|
|
|
1576
1822
|
* @internal
|
|
1577
1823
|
*/
|
|
1578
1824
|
static async documentLoader(url) {
|
|
1579
|
-
|
|
1825
|
+
const redirects = JsonLdProcessor.getRedirects();
|
|
1826
|
+
for (const redirect of redirects) {
|
|
1580
1827
|
if (redirect.from.test(url)) {
|
|
1581
1828
|
url = redirect.to;
|
|
1582
1829
|
break;
|
|
@@ -1584,9 +1831,9 @@ class JsonLdProcessor {
|
|
|
1584
1831
|
}
|
|
1585
1832
|
// Cache the results for an hour
|
|
1586
1833
|
const response = await web.FetchHelper.fetchJson(JsonLdProcessor._CLASS_NAME, url, web.HttpMethod.GET, undefined, {
|
|
1587
|
-
cacheTtlMs:
|
|
1834
|
+
cacheTtlMs: JsonLdProcessor.getCacheLimit(),
|
|
1588
1835
|
headers: {
|
|
1589
|
-
Accept: `${web.MimeTypes.JsonLd},${web.MimeTypes.Json}`
|
|
1836
|
+
[web.HeaderTypes.Accept]: `${web.MimeTypes.JsonLd},${web.MimeTypes.Json}`
|
|
1590
1837
|
}
|
|
1591
1838
|
});
|
|
1592
1839
|
return {
|
|
@@ -1594,8 +1841,24 @@ class JsonLdProcessor {
|
|
|
1594
1841
|
document: response
|
|
1595
1842
|
};
|
|
1596
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Handle common errors.
|
|
1846
|
+
* @param err The error to handle.
|
|
1847
|
+
* @internal
|
|
1848
|
+
*/
|
|
1849
|
+
static handleCommonErrors(err) {
|
|
1850
|
+
if (core.Is.object(err) &&
|
|
1851
|
+
err.name === "jsonld.InvalidUrl") {
|
|
1852
|
+
throw new core.GeneralError(JsonLdProcessor._CLASS_NAME, "invalidUrl", { url: err.details?.url }, err);
|
|
1853
|
+
}
|
|
1854
|
+
else if (core.Is.object(err) &&
|
|
1855
|
+
err.name.startsWith("jsonld.")) {
|
|
1856
|
+
throw new core.GeneralError(JsonLdProcessor._CLASS_NAME, "jsonLdError", err.details, err);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1597
1859
|
}
|
|
1598
1860
|
|
|
1861
|
+
exports.JsonLdContexts = JsonLdContexts;
|
|
1599
1862
|
exports.JsonLdDataTypes = JsonLdDataTypes;
|
|
1600
1863
|
exports.JsonLdHelper = JsonLdHelper;
|
|
1601
1864
|
exports.JsonLdProcessor = JsonLdProcessor;
|