anchor.diff:      TripleMap = lists:foldl(
           fun(#triple{} = Triple, Map) ->
               %% Replace id in RDF resource with that of the current object
  -            maps:merge(Map, triple_to_map(Triple, RdfResource#rdf_resource{id = Object}))
  +            merge_values(triple_to_map(Triple, RdfResource#rdf_resource{id = Object}), Map)
           end,
           #{<<"@id">> => Object},
           m_rdf:filter_subject(RdfResource, Object)
  
positive.code:                 undefined ->
                      Acc;
                  TripleJson ->
                      JsonKey = hd(maps:keys(TripleJson)),
                      #{JsonKey := JsonValue} = TripleJson,
  
                      case maps:get(JsonKey, Acc, undefined) of
                          undefined ->
                              maps:merge(Acc, TripleJson);
                          Value when is_list(Value) ->
                              Acc#{JsonKey => [JsonValue | Value]};
                          Value ->
                              Acc#{JsonKey => [JsonValue | [Value]]}
                      end
              end
          end,
          #{<<"@id">> => Id},
  
negative.code:     %% Ignore triples that belong to other subjects (they are found through the
      %% recursive call in the clause above).
      undefined.
  
  %% @doc Merge a key/value map into an accumulator map, combining multiple
  %% values for the same key.
  -spec merge_values(map(), map()) -> map().
  merge_values(KeyValue, Acc) ->
      %% Read current key from KeyValue pair
      Key = hd(maps:keys(KeyValue)),
      #{Key := NewValue} = KeyValue,
  
      case maps:get(Key, Acc, undefined) of
          undefined ->
              maps:merge(Acc, KeyValue);
          Value when is_list(Value) ->
              Acc#{Key => [NewValue | Value]};
          Value ->
              Acc#{Key => [NewValue | [Value]]}
      end.
  