anchor.diff:  
   -export([
       serialize/1,
  +    serialize_to_map/1,
       deserialize/1,
       open/1,
  -    open_file/1
  +    open_file/1,
  +    compact/1
   ]).
   
   -include("zotonic.hrl").
  
positive.code:         [{<<"@id">>, Id}],
          Triples
      )),
  
      %% We need to add a {struct, ...} tuple here so z_convert:to_json/1 won't
      %% prefix the data with an {array, ...} tuple.
      %% See https://github.com/zotonic/z_stdlib/pull/14
      z_convert:to_json({struct, Data}).
  
  %% @doc Deserialize a JSON-LD document into an RDF resource.
  -spec deserialize(tuple() | list()) -> #rdf_resource{}.
  
negative.code:     {Predicate, z_convert:to_json(Object)};
  triple_to_json(#triple{type = resource, predicate = Predicate, object = Object}) ->
      {Predicate, [{<<"@id">>, Object}]}.
  
  triple_to_map(#triple{predicate = <<?NS_RDF, "type">>, type = resource, object = Object}) ->
      #{<<"@type">> => Object};
  triple_to_map(#triple{type = literal, predicate = Predicate, object = #rdf_value{value = Object, language = undefined}}) ->
      #{Predicate => #{<<"@value">> => Object}};
  triple_to_map(#triple{type = literal, predicate = Predicate, object = #rdf_value{value = Object, language = Lang}}) ->
      %% z_convert:to_json to convert any date tuples to datetime string, which
      %% doesn't work if we pass {struct, Data} (see comment above).
      #{Predicate => #{<<"@value">> => Object, <<"language">> => Lang}};
  triple_to_map(#triple{type = literal, predicate = Predicate, object = Object}) ->
      %% z_convert:to_json to convert any date tuples to datetime string, which
      %% doesn't work if we pass {struct, Data} (see comment above).
      #{Predicate => Object};
  triple_to_map(#triple{type = resource, predicate = Predicate, object = Object}) ->
      #{Predicate => #{<<"@id">> => Object}}.