@@ -506,18 +506,7 @@ api.createTermDefinition = ({
506
506
'jsonld.SyntaxError' , { code : 'invalid IRI mapping' , context : localCtx } ) ;
507
507
}
508
508
509
- // expand and add @id mapping
510
- const id = _expandIri (
511
- activeCtx , reverse , { vocab : true , base : false } , localCtx , defined ,
512
- options ) ;
513
- if ( ! _isAbsoluteIri ( id ) ) {
514
- throw new JsonLdError (
515
- 'Invalid JSON-LD syntax; a @context @reverse value must be an ' +
516
- 'absolute IRI or a blank node identifier.' ,
517
- 'jsonld.SyntaxError' , { code : 'invalid IRI mapping' , context : localCtx } ) ;
518
- }
519
-
520
- if ( reverse . match ( KEYWORD_PATTERN ) ) {
509
+ if ( ! api . isKeyword ( reverse ) && reverse . match ( KEYWORD_PATTERN ) ) {
521
510
// FIXME: remove logging and use a handler
522
511
console . warn ( 'WARNING: values beginning with "@" are reserved' +
523
512
' for future use and ignored' , { reverse} ) ;
@@ -529,6 +518,17 @@ api.createTermDefinition = ({
529
518
return ;
530
519
}
531
520
521
+ // expand and add @id mapping
522
+ const id = _expandIri (
523
+ activeCtx , reverse , { vocab : true , base : false } , localCtx , defined ,
524
+ options ) ;
525
+ if ( ! _isAbsoluteIri ( id ) ) {
526
+ throw new JsonLdError (
527
+ 'Invalid JSON-LD syntax; a @context @reverse value must be an ' +
528
+ 'absolute IRI or a blank node identifier.' ,
529
+ 'jsonld.SyntaxError' , { code : 'invalid IRI mapping' , context : localCtx } ) ;
530
+ }
531
+
532
532
mapping [ '@id' ] = id ;
533
533
mapping . reverse = true ;
534
534
} else if ( '@id' in value ) {
0 commit comments