@@ -265,12 +265,13 @@ else if (context instanceof String) {
265265 }
266266 // jsonld 1.1: 5.8.3 in https://w3c.github.io/json-ld-api/#algorithm
267267 else if (value instanceof String ) {
268- if (((String ) value ). startsWith ( JsonLdConsts . BLANK_NODE_PREFIX )
268+ if (JsonLdUtils . isBlankNode ((String ) value )
269269 || JsonLdUtils .isAbsoluteIri ((String ) value ) || JsonLdUtils .isRelativeIri ((String ) value )) {
270270 result .put (JsonLdConsts .VOCAB ,
271271 expandIri ((String ) value , true , true , ((Map <String , Object >) result ), null ));
272272 } else {
273- throw new JsonLdError (Error .INVALID_VOCAB_MAPPING , value );
273+ throw new JsonLdError (Error .INVALID_VOCAB_MAPPING ,
274+ "@value must be an IRI or a blank node, but was: " +value );
274275 }
275276 } else {
276277 throw new JsonLdError (Error .INVALID_VOCAB_MAPPING ,
@@ -301,6 +302,7 @@ else if (value instanceof String) {
301302 .contains (key )) {
302303 continue ;
303304 }
305+ // TODO: passing result for active context and the value of the @protected entry from context, if any
304306 result .createTermDefinition ((Map <String , Object >) context , key , defined );
305307 }
306308 }
@@ -420,6 +422,7 @@ else if (!JsonLdConsts.ID.equals(type) && !JsonLdConsts.VOCAB.equals(type)
420422 "Non-absolute @reverse IRI: " + reverse );
421423 }
422424 definition .put (JsonLdConsts .ID , reverse );
425+ // jsonld 1.1: 14.5 in https://w3c.github.io/json-ld-api/#algorithm-0
423426 if (val .containsKey (JsonLdConsts .CONTAINER )) {
424427 final Object containerObject = val .get (JsonLdConsts .CONTAINER );
425428 final String container = selectContainer (checkValidContainerEntry (containerObject ));
@@ -447,10 +450,10 @@ else if (!JsonLdConsts.ID.equals(type) && !JsonLdConsts.VOCAB.equals(type)
447450 throw new JsonLdError (Error .INVALID_IRI_MAPPING ,
448451 "expected value of @id to be a string" );
449452 }
450-
453+ // jsonld 1.1: 16.4 in https://w3c.github.io/json-ld-api/#algorithm-0
451454 final String res = this .expandIri ((String ) val .get (JsonLdConsts .ID ), false , true ,
452455 context , defined );
453- if (JsonLdUtils .isKeyword (res ) || JsonLdUtils .isAbsoluteIri (res )) {
456+ if (JsonLdUtils .isKeyword (res ) || JsonLdUtils .isAbsoluteIri (res ) || JsonLdUtils . isBlankNode ( res ) ) {
454457 if (JsonLdConsts .CONTEXT .equals (res )) {
455458 throw new JsonLdError (Error .INVALID_KEYWORD_ALIAS , "cannot alias @context" );
456459 }
@@ -485,6 +488,7 @@ else if (term.indexOf(":") >= 0) {
485488 }
486489
487490 // 16)
491+ // jsonld 1.1: 21 in https://w3c.github.io/json-ld-api/#algorithm-0
488492 if (val .containsKey (JsonLdConsts .CONTAINER )) {
489493 Object containerObject = val .get (JsonLdConsts .CONTAINER );
490494 final List <?> allContainers = checkValidContainerEntry (containerObject );
@@ -494,7 +498,7 @@ else if (term.indexOf(":") >= 0) {
494498 String container = selectContainer (allContainers );
495499 if (container == null ) {
496500 throw new JsonLdError (Error .INVALID_CONTAINER_MAPPING ,
497- "@container must be either @list , @set , @index, or @language , but was: "
501+ "@container must be either @graph , @id , @index, @language, @list, @set or @type , but was: "
498502 + allContainers );
499503 }
500504 definition .put (JsonLdConsts .CONTAINER , container );
@@ -1264,4 +1268,4 @@ public Map<String, Object> serialize() {
12641268 return rval ;
12651269 }
12661270
1267- }
1271+ }
0 commit comments