You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# If expanded property is @value and value is not a scalar or null, an invalid value object value error has been detected and processing is aborted. Otherwise, set expanded value to value. If expanded value is null, set the @value member of result to null and continue with the next key from element. Null values need to be preserved in this case as the meaning of an @type member depends on the existence of an @value member.
134
-
raiseJsonLdError::InvalidValueObjectValue,
135
-
"Value of #{expanded_property} must be a scalar or null: #{value.inspect}"ifvalue.is_a?(Hash) || value.is_a?(Array)
"@value value may not be an array unless framing: #{value.inspect}"unlessframing
144
+
value
145
+
whenHash
146
+
raiseJsonLdError::InvalidValueObjectValue,
147
+
"@value value must be a an empty object for framing: #{value.inspect}"unless
148
+
value.empty? && framing
149
+
[value]
150
+
else
151
+
raiseJsonLdError::InvalidValueObjectValue,
152
+
"Value of #{expanded_property} must be a scalar or null: #{value.inspect}"
139
153
end
140
-
value
141
154
when'@language'
142
155
# If expanded property is @language and value is not a string, an invalid language-tagged string error has been detected and processing is aborted. Otherwise, set expanded value to lowercased value.
143
-
raiseJsonLdError::InvalidLanguageTaggedString,
144
-
"Value of #{expanded_property} must be a string: #{value.inspect}"unlessvalue.is_a?(String)
"@language value may not be an array unless framing: #{value.inspect}"unlessframing
162
+
value.map(&:downcase)
163
+
whenHash
164
+
raiseJsonLdError::InvalidLanguageTaggedString,
165
+
"@language value must be a an empty object for framing: #{value.inspect}"unless
166
+
value.empty? && framing
167
+
[value]
168
+
else
169
+
raiseJsonLdError::InvalidLanguageTaggedString,
170
+
"Value of #{expanded_property} must be a string: #{value.inspect}"
171
+
end
146
172
when'@index'
147
173
# If expanded property is @index and value is not a string, an invalid @index value error has been detected and processing is aborted. Otherwise, set expanded value to value.
# If the value of result's @value key is null, then set result to null.
319
-
returnnilifoutput_object['@value'].nil?
345
+
returnnilifArray(output_object['@value']).empty?
320
346
321
-
if !output_object['@value'].is_a?(String) && output_object.has_key?('@language')
347
+
if !Array(output_object['@value']).all?{|v| v.is_a?(String) || v.is_a?(Hash) && v.empty?} && output_object.has_key?('@language')
322
348
# Otherwise, if the value of result's @value member is not a string and result contains the key @language, an invalid language-tagged value error has been detected (only strings can be language-tagged) and processing is aborted.
323
349
raiseJsonLdError::InvalidLanguageTaggedValue,
324
-
"when @language is used, @value must be a string: #{@value.inspect}"
# Value matches if it is a value, and matches the value pattern.
413
419
#
420
+
# * `pattern` is empty
414
421
# * @values are the same, or `pattern[@value]` is a wildcard, and
415
422
# * @types are the same or `value[@type]` is not null and `pattern[@type]` is `{}`, or `value[@type]` is null and `pattern[@type]` is null or `[]`, and
416
423
# * @languages are the same or `value[@language]` is not null and `pattern[@language]` is `{}`, or `value[@language]` is null and `pattern[@language]` is null or `[]`.
0 commit comments