anchor.diff:           case xqldb_path_table:lookup(DB, Name) of
               {xml,Stamp} ->
                  NodeId = {DBId, {Name,Stamp}, []},
  -               xqldb_nodes:get_doc(NodeId);
  +               Node = xqldb_nodes:get_doc(NodeId),
  +               _ = locks:end_transaction(Agent),
  +               Node;
               _ ->
  +               _ = locks:end_transaction(Agent),
                  {error, not_exists}
            end
      end;
  
positive.code: 
  select_doc(DocUri) when is_binary(DocUri) ->
     {DbUri,Name} = xqldb_uri:split_uri(DocUri),
     case xqldb_db:exists(DbUri) of
        false -> {error, not_exists};
        true ->
  
negative.code: 
  insert_doc(DocUri, Filename) when is_binary(DocUri) ->
     {DbUri,Name} = xqldb_uri:split_uri(DocUri),
     {Agent, _} = locks:begin_transaction([{[DbUri,Name], write}]),
     DB = xqldb_db:database(DbUri),
     case xqldb_path_table:lookup(DB, Name) of
        [] -> 
  