linked-rolls 0.23.0 → 0.25.0
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/lib/asJsonLd.js +2 -6
- package/lib/importJsonLd.js +2 -1
- package/lib/schema.json +554 -343
- package/package.json +3 -2
package/lib/asJsonLd.js
CHANGED
|
@@ -64,7 +64,7 @@ const withSystemContexts = (node) => {
|
|
|
64
64
|
};
|
|
65
65
|
export const asJsonLd = (edition) => {
|
|
66
66
|
// The context is the export's own; one carried in from an import must not override it.
|
|
67
|
-
const { base,
|
|
67
|
+
const { base, '@context': carried, ...rest } = withSystemContexts(asJsonLdEntity(edition));
|
|
68
68
|
return {
|
|
69
69
|
'@context': [
|
|
70
70
|
'https://w3id.org/reo/context.jsonld',
|
|
@@ -74,10 +74,6 @@ export const asJsonLd = (edition) => {
|
|
|
74
74
|
],
|
|
75
75
|
'@type': "Edition",
|
|
76
76
|
'@id': edition.base,
|
|
77
|
-
...rest
|
|
78
|
-
copies: copies?.map(copy => ({
|
|
79
|
-
...copy,
|
|
80
|
-
'@id': `copy/${copy['@id']}`
|
|
81
|
-
}))
|
|
77
|
+
...rest
|
|
82
78
|
};
|
|
83
79
|
};
|
package/lib/importJsonLd.js
CHANGED
|
@@ -36,7 +36,8 @@ const fromJsonLdEntity = (json) => {
|
|
|
36
36
|
entity.id = id;
|
|
37
37
|
return entity;
|
|
38
38
|
};
|
|
39
|
-
//
|
|
39
|
+
// Every entity is named by its id alone. Documents written before that was so
|
|
40
|
+
// prefixed a copy's with `copy/`, and are read here as though they had not.
|
|
40
41
|
const withPlainCopyIds = (json) => ({
|
|
41
42
|
...json,
|
|
42
43
|
copies: (json.copies ?? []).map((copy) => ({
|