anchor.diff:  %% Internal functions
   %%----------------------------------------------------------------------------
   
  +%% @doc Converts a UTF-8 string to a query. Returns a query record plus the
  +%% depth of the corresponding tree.
  +-spec from_str(utf8_str()) -> {q(),pos_integer()}.
   from_str(Str) ->
       {ok,ParseTree} = dk_q_parser:parse(scan(Str)),
       tree_to_query(ParseTree).
  
positive.code: mv_and(Q) ->
      Q.
  
  and_subs({or_q,L,R}) ->
      and_subs(L) ++ and_subs(R);
  and_subs(Q) ->
      [Q].
  
  flatten({and_q,L,R}) ->
      lists:flatten([flatten(L),flatten(R)]);
  flatten(Q) ->
      [Q].
  
  partition(Qs) ->
      {Pos,Neg} = lists:partition(fun (Q) -> is_record(Q, term_q) end, Qs),
      {terms(Pos),terms(Neg)}.
  
negative.code: -spec execute(utf8_str()) -> gb_set(). %% TODO: might return an error
  execute(Str) ->
      %% parse and preprocess query
      Clauses = [partition(flatten(X)) || X <- clauses(dnf(from_str(Str)))],
      %% fetch data
      Data = plists:mapreduce(
               fun fetch/1, 
  