@@ -76,14 +76,20 @@ private void resolveValue(JsonObject value) {
7676 } else if (value .containsKey (JsonLd .LANGUAGE )) {
7777 assert value .containsKey (JsonLd .VALUE );
7878 instanceBuilder .addValue (
79- new LangString (ValueUtils .stringValue (ValueUtils .getValue (value )), ValueUtils .stringValue (value .get (JsonLd .LANGUAGE ))));
79+ new LangString (ValueUtils .stringValue (ValueUtils .getValue (value )),
80+ ValueUtils .stringValue (value .get (JsonLd .LANGUAGE ))));
8081 } else if (instanceBuilder .isCurrentCollectionProperties ()) {
81- // If we are deserializing an object into @Properties, just extract the identifier and put it into the map
82- if (!value .containsKey (JsonLd .ID )) {
82+ if (value .containsKey (JsonLd .TYPE ) && value .containsKey (JsonLd .VALUE )) {
83+ instanceBuilder .addValue (
84+ XSDTypeCoercer .coerceType (ValueUtils .stringValue (ValueUtils .getValue (value )),
85+ ValueUtils .stringValue (value .get (JsonLd .TYPE ))));
86+ } else if (!value .containsKey (JsonLd .ID )) {
8387 throw new MissingIdentifierException (
8488 "Cannot put an object without an identifier into @Properties. Object: " + value );
89+ } else {
90+ // If we are deserializing an object into @Properties, just extract the identifier and put it into the map
91+ instanceBuilder .addValue (URI .create (ValueUtils .stringValue (value .get (JsonLd .ID ))));
8592 }
86- instanceBuilder .addValue (URI .create (ValueUtils .stringValue (value .get (JsonLd .ID ))));
8793 } else {
8894 final Class <?> elementType = instanceBuilder .getCurrentCollectionElementType ();
8995 new ObjectDeserializer (instanceBuilder , config , elementType ).processValue (value );
@@ -126,9 +132,11 @@ private void extractLiteralValue(JsonObject value) {
126132 final JsonValue val = value .get (JsonLd .VALUE );
127133 if (value .containsKey (JsonLd .TYPE )) {
128134 instanceBuilder
129- .addValue (property , XSDTypeCoercer .coerceType (ValueUtils .stringValue (val ), ValueUtils .stringValue (value .get (JsonLd .TYPE ))));
135+ .addValue (property , XSDTypeCoercer .coerceType (ValueUtils .stringValue (val ),
136+ ValueUtils .stringValue (value .get (JsonLd .TYPE ))));
130137 } else if (value .containsKey (JsonLd .LANGUAGE )) {
131- instanceBuilder .addValue (property , new LangString (ValueUtils .stringValue (val ), ValueUtils .stringValue (value .get (JsonLd .LANGUAGE ))));
138+ instanceBuilder .addValue (property , new LangString (ValueUtils .stringValue (val ),
139+ ValueUtils .stringValue (value .get (JsonLd .LANGUAGE ))));
132140 } else {
133141 instanceBuilder .addValue (property , ValueUtils .literalValue (val ));
134142 }
0 commit comments