anchor.diff:              NewTriples = lists:append(State#state.triples, ExtractedTriples),
               State#state{triples = NewTriples}
           end,
  -        ProcessingState,
  -        Props);
  +        StateWithSubject,
  +        Props).
  +
  +triples({struct, Props}, InitialState) ->
  +    %% Local Context: merge if exists
  +    StateWithLocalContext = process_local_context({struct, Props}, InitialState),
  +    %% Subject
  +    StateWithSubject = process_subject({struct, Props}, StateWithLocalContext),
  +    %% Everything else
  +    process_other({struct, Props}, StateWithSubject);
   
   triples([H|T], InitialState) ->
       [triples(H, InitialState) | triples(T, InitialState)];
  
positive.code:                     end,
                      case Value of
                          {struct, _V} ->
                              triples(Value, ProcessingState);
                          _ ->
                              [triple(State#state.subject, Property, Value, State#state.context)]
                      end
  
negative.code: %% Internal API
  %%
  
  %% TODO perhaps it should be a define instead
  get_json_prop(Key, {struct, Props}) ->
      lists:keyfind(Key, 1, Props).
  
  process_local_context({struct, _Props} = JsonObject, InitialState) ->
      %% Local Context: merge if exists
      LocalContextProp = get_json_prop(<<"#">>, JsonObject),
      case LocalContextProp of
          {<<"#">>, {struct, CtxProps}} -> 
              NewContext = merge_contexts(InitialState#state.context, CtxProps),
              InitialState#state{context = NewContext};
          false -> InitialState
      end.
  
  process_subject({struct, _Props} = JsonObject, StateWithLocalContext) ->
      %% Subject
      LocalSubjectProp = get_json_prop(<<"@">>, JsonObject),
      case LocalSubjectProp of
          {<<"@">>, SubjectValue} ->
              case SubjectValue of
                  %% Subject is an object
                  {struct, _SubjectProps} ->
                      TriplesFromObject = triples(SubjectValue, StateWithLocalContext),
                      CurrentSubject = get_json_prop(<<"@">>, SubjectValue),
                      StateWithLocalContext#state{
                          subject = CurrentSubject,
                          triples = lists:append(TriplesFromObject, StateWithLocalContext#state.triples)
                      };
                  %% Subject is an array
                  List when is_list(List) ->
                      TriplesFromList = triples(List, StateWithLocalContext),
                      %% TODO need a uuid module
                      Uuid = "1234",
                      CurrentSubject = list_to_binary(io_lib:format("_:~p", [Uuid])),
                      StateWithLocalContext#state{
                          subject = CurrentSubject,
                          triples = lists:append(TriplesFromList, StateWithLocalContext#state.triples)
                      };
                  %% regular subject
                  _ ->
                      CurrentSubject = resource(SubjectValue, StateWithLocalContext#state.context),
                      StateWithLocalContext#state{ subject = CurrentSubject }
              end;
          %% there is no subject
          false ->
              %% TODO need a uuid module
              Uuid = "1234",
              CurrentSubject = list_to_binary(io_lib:format("_:~p", [Uuid])),
              StateWithLocalContext#state{ subject = CurrentSubject }
      end.
  
  process_other({struct, Props}, StateWithSubject) ->
      lists:foldl(
          fun({Key, Value}, State) ->
              ExtractedTriples = case Key of
  