Skip to content

Commit 8527ca0

Browse files
committed
Mark array properties as RDF list
This doesn't change anything for config users, except for the fact that passing an empty array will result in an actual empty array in the constructor, while this would become undefined before. This requires the use of the `--typeScopedContexts` flag during generation. Closes LinkedSoftwareDependencies/Components.js#47
1 parent f761113 commit 8527ca0

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

lib/serialize/ContextConstructor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export class ContextConstructor {
7575
typeScopedContext[parameter['@id'].slice(Math.max(0, component['@id'].length + 1))] = {
7676
'@id': parameter['@id'],
7777
...parameter.range === 'rdf:JSON' ? { '@type': '@json' } : {},
78+
...parameter.unique || parameter.range === 'rdf:JSON' ? {} : { '@container': '@list' },
7879
};
7980
}
8081
(<any> shortcuts[match[0]])['@context'] = typeScopedContext;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@types/semver": "^7.3.4",
7070
"@typescript-eslint/typescript-estree": "^4.6.1",
7171
"comment-parser": "^0.7.6",
72-
"componentsjs": "^4.3.0",
72+
"componentsjs": "^4.4.0",
7373
"jsonld-context-parser": "^2.0.2",
7474
"lru-cache": "^6.0.0",
7575
"minimist": "^1.2.5",

test/serialize/ContextConstructor.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,11 @@ describe('ContextConstructor', () => {
174174
parameters: [
175175
{
176176
'@id': 'mp:file1#MyClass1_param1',
177+
unique: false,
177178
},
178179
{
179180
'@id': 'mp:file1#MyClass1_param2',
181+
unique: true,
180182
},
181183
],
182184
requireElement: 'MyClass1',
@@ -205,6 +207,7 @@ describe('ContextConstructor', () => {
205207
'@context': {
206208
param1: {
207209
'@id': 'mp:file1#MyClass1_param1',
210+
'@container': '@list',
208211
},
209212
param2: {
210213
'@id': 'mp:file1#MyClass1_param2',

yarn.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,15 @@
559559
"@types/rdf-js" "*"
560560
htmlparser2 "^6.0.0"
561561

562-
"@comunica/actor-rdf-parse-jsonld@~1.21.1":
563-
version "1.21.1"
564-
resolved "https://registry.yarnpkg.com/@comunica/actor-rdf-parse-jsonld/-/actor-rdf-parse-jsonld-1.21.1.tgz#26eaf5f62fc6c4c242b538b44b3291836ee0641f"
565-
integrity sha512-0pnZJUQ5bhaUwM7pQNr1afmoVKMmnYhJHdub9j/l2jAJWJFbVWucZI9z/g7r9Tek4SBS6PcM2+2sx8U9+WiiIA==
562+
"@comunica/actor-rdf-parse-jsonld@~1.21.2":
563+
version "1.21.2"
564+
resolved "https://registry.yarnpkg.com/@comunica/actor-rdf-parse-jsonld/-/actor-rdf-parse-jsonld-1.21.2.tgz#f2fe479db3a5fba32154e4f1bf1eb2149459cf6a"
565+
integrity sha512-YUiYo2EJ9T1oUGgBwzzPRjXT+cd/xckWbtfYBzr7RugXeKjrVai8atnV1OsPc0u5iPZCTkiVCO9sI/Q6M7ig2w==
566566
dependencies:
567567
"@comunica/context-entries" "^1.21.1"
568568
"@types/rdf-js" "*"
569569
jsonld-context-parser "^2.1.2"
570-
jsonld-streaming-parser "^2.3.0"
570+
jsonld-streaming-parser "^2.3.2"
571571
stream-to-string "^1.2.0"
572572

573573
"@comunica/actor-rdf-parse-n3@~1.21.1":
@@ -2050,10 +2050,10 @@ component-emitter@^1.2.1:
20502050
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
20512051
integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==
20522052

2053-
componentsjs@^4.2.0:
2054-
version "4.2.0"
2055-
resolved "https://registry.yarnpkg.com/componentsjs/-/componentsjs-4.2.0.tgz#bb590c0f5b6066fb594fc9c9e6be5f889f84c16b"
2056-
integrity sha512-8C+LXmz6SrkWPLJXFu622hAikNJZahxDuNnP2eJdMiPOtef/oWB0yf9+bOB4Dectu96MFq9nlsm0q+hmRGpN/g==
2053+
componentsjs@^4.4.0:
2054+
version "4.4.0"
2055+
resolved "https://registry.yarnpkg.com/componentsjs/-/componentsjs-4.4.0.tgz#5f55c73cadf43de511eee11644241eadaea7ad89"
2056+
integrity sha512-lpceBsCYHG9QUuo+Hb0lAe7pAKi+E7JFr3qe5fbLhIcj92wu3kU822U4hYjE0u0JVYRDK6edEsoa6leEABWI2Q==
20572057
dependencies:
20582058
"@types/minimist" "^1.2.0"
20592059
"@types/node" "^14.14.7"
@@ -2063,7 +2063,7 @@ componentsjs@^4.2.0:
20632063
minimist "^1.2.0"
20642064
rdf-data-factory "^1.0.4"
20652065
rdf-object "^1.8.0"
2066-
rdf-parse "^1.8.0"
2066+
rdf-parse "^1.8.1"
20672067
rdf-quad "^1.5.0"
20682068
rdf-terms "^1.6.2"
20692069
semver "^7.3.2"
@@ -4460,10 +4460,10 @@ jsonld-context-parser@^2.1.2:
44604460
http-link-header "^1.0.2"
44614461
relative-to-absolute-iri "^1.0.5"
44624462

4463-
jsonld-streaming-parser@^2.3.0:
4464-
version "2.3.0"
4465-
resolved "https://registry.yarnpkg.com/jsonld-streaming-parser/-/jsonld-streaming-parser-2.3.0.tgz#7417fc867c9fefbf7452259f0b78e707e0c357fa"
4466-
integrity sha512-IJiFhX9GQ/uLugd3BSYgJDaisAc22fV2Ij7tH0yWG8KZpriSGadRVvxUkfglzRKSjqxYBsZ+qAQ+UR7YGwiHRQ==
4463+
jsonld-streaming-parser@^2.3.2:
4464+
version "2.3.2"
4465+
resolved "https://registry.yarnpkg.com/jsonld-streaming-parser/-/jsonld-streaming-parser-2.3.2.tgz#a3e1bd405a500186cc12b0f1fcee8a97b8392dd4"
4466+
integrity sha512-C9hyL5LRb2K0eaS5biP+ixUtMjr3UPJn9WInNYAmjX9tL7NzeSw3lY7nW3GEnKETxF3I3btvEPR1Nm/+tHMWZQ==
44674467
dependencies:
44684468
"@types/http-link-header" "^1.0.1"
44694469
"@types/rdf-js" "^4.0.0"
@@ -5502,17 +5502,17 @@ rdf-object@^1.8.0:
55025502
rdf-string "^1.5.0"
55035503
streamify-array "^1.0.1"
55045504

5505-
rdf-parse@^1.8.0:
5506-
version "1.8.0"
5507-
resolved "https://registry.yarnpkg.com/rdf-parse/-/rdf-parse-1.8.0.tgz#45ba35f78f6ee3f80589ba826013019f62c9dd6e"
5508-
integrity sha512-Pc6jvqjlJpY/ivVPbfbCJw372VhUx1dTMGLGGU/bHz6srjLL9Q4scn655afAuDI89KamDBRTDN+ZzlfiWfgbfg==
5505+
rdf-parse@^1.8.1:
5506+
version "1.8.1"
5507+
resolved "https://registry.yarnpkg.com/rdf-parse/-/rdf-parse-1.8.1.tgz#99658d13dc4cf0f7d8310b914439b40eb4665df7"
5508+
integrity sha512-sNcQ1Vc8hDf/hVjVHYS9CSHyFShVX8LVwBrFARKkGgGe+K9DZJRaZQI06VCwmEW027ZFjfxFgmjQlc09FLmI4A==
55095509
dependencies:
55105510
"@comunica/actor-http-native" "~1.21.1"
55115511
"@comunica/actor-rdf-parse-html" "~1.21.1"
55125512
"@comunica/actor-rdf-parse-html-microdata" "~1.21.1"
55135513
"@comunica/actor-rdf-parse-html-rdfa" "~1.21.1"
55145514
"@comunica/actor-rdf-parse-html-script" "~1.21.1"
5515-
"@comunica/actor-rdf-parse-jsonld" "~1.21.1"
5515+
"@comunica/actor-rdf-parse-jsonld" "~1.21.2"
55165516
"@comunica/actor-rdf-parse-n3" "~1.21.1"
55175517
"@comunica/actor-rdf-parse-rdfxml" "~1.21.1"
55185518
"@comunica/actor-rdf-parse-xml-rdfa" "~1.21.1"

0 commit comments

Comments
 (0)