@@ -194,7 +194,7 @@ api.process = async ({
194
194
195
195
// if not set explicitly, set processingMode to "json-ld-1.1"
196
196
rval . processingMode =
197
- rval . processingMode || activeCtx . processingMode || 'json-ld-1.1' ;
197
+ rval . processingMode || activeCtx . processingMode ;
198
198
199
199
// handle @base
200
200
if ( '@base' in ctx ) {
@@ -205,7 +205,7 @@ api.process = async ({
205
205
} else if ( _isAbsoluteIri ( base ) ) {
206
206
base = parseUrl ( base ) ;
207
207
} else if ( _isRelativeIri ( base ) ) {
208
- base = parseUrl ( prependBase ( activeCtx [ '@base' ] . href , base ) ) ;
208
+ base = parseUrl ( prependBase ( rval [ '@base' ] . href , base ) ) ;
209
209
} else {
210
210
throw new JsonLdError (
211
211
'Invalid JSON-LD syntax; the value of "@base" in a ' +
@@ -228,10 +228,14 @@ api.process = async ({
228
228
'@context must be a string or null.' ,
229
229
'jsonld.SyntaxError' , { code : 'invalid vocab mapping' , context : ctx } ) ;
230
230
} else if ( ! _isAbsoluteIri ( value ) ) {
231
- throw new JsonLdError (
232
- 'Invalid JSON-LD syntax; the value of "@vocab" in a ' +
233
- '@context must be an absolute IRI.' ,
234
- 'jsonld.SyntaxError' , { code : 'invalid vocab mapping' , context : ctx } ) ;
231
+ if ( api . processingMode ( rval , 1.0 ) ) {
232
+ throw new JsonLdError (
233
+ 'Invalid JSON-LD syntax; the value of "@vocab" in a ' +
234
+ '@context must be an absolute IRI.' ,
235
+ 'jsonld.SyntaxError' , { code : 'invalid vocab mapping' , context : ctx } ) ;
236
+ }
237
+ rval [ '@vocab' ] = _expandIri ( rval , value , { vocab : true , base : true } ,
238
+ undefined , undefined , options ) ;
235
239
} else {
236
240
rval [ '@vocab' ] = value ;
237
241
}
@@ -1086,11 +1090,10 @@ api.getAllContexts = async (input, options) => {
1086
1090
*/
1087
1091
api . processingMode = ( activeCtx , version ) => {
1088
1092
if ( version . toString ( ) >= '1.1' ) {
1089
- return activeCtx . processingMode &&
1093
+ return ! activeCtx . processingMode ||
1090
1094
activeCtx . processingMode >= 'json-ld-' + version . toString ( ) ;
1091
1095
} else {
1092
- return ! activeCtx . processingMode ||
1093
- activeCtx . processingMode === 'json-ld-1.0' ;
1096
+ return activeCtx . processingMode === 'json-ld-1.0' ;
1094
1097
}
1095
1098
} ;
1096
1099
0 commit comments