Skip to content

Commit b2675a1

Browse files
committed
Make sure multiple objects with @container: @graph are maintained as multiple graphs.
1 parent 3293841 commit b2675a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/json/ld/expand.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ def expand_object(input, active_property, context, output_object, ordered:, fram
439439
#log_debug {" => #{expanded_value.inspect}"}
440440

441441
# convert expanded value to @graph if container specifies it
442-
# FIXME value may be a named graph, as well as a simple graph.
443-
if active_context.container(key) == %w(@graph) && !graph?(expanded_value)
442+
if active_context.container(key) == %w(@graph)
444443
#log_debug(" => ") { "convert #{expanded_value.inspect} to list"}
445-
expanded_value = [expanded_value] unless expanded_value.is_a?(Array)
446-
expanded_value = {'@graph' => expanded_value}
444+
expanded_value = as_array(expanded_value).map do |v|
445+
graph?(v) ? v : {'@graph' => as_array(v)}
446+
end
447447
end
448448

449449
# Otherwise, if the term definition associated to key indicates that it is a reverse property

0 commit comments

Comments
 (0)