@@ -506,18 +506,7 @@ api.createTermDefinition = ({
506506 'jsonld.SyntaxError' , { code : 'invalid IRI mapping' , context : localCtx } ) ;
507507 }
508508
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 ) ) {
521510 // FIXME: remove logging and use a handler
522511 console . warn ( 'WARNING: values beginning with "@" are reserved' +
523512 ' for future use and ignored' , { reverse} ) ;
@@ -529,6 +518,17 @@ api.createTermDefinition = ({
529518 return ;
530519 }
531520
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+
532532 mapping [ '@id' ] = id ;
533533 mapping . reverse = true ;
534534 } else if ( '@id' in value ) {
0 commit comments