anchor.diff:  
   select_doc(DocUri) when is_binary(DocUri) ->
      {DbUri,Name} = xqldb_uri:split_uri(DocUri),
  +   {Agent, _} = locks:begin_transaction([{[DbUri,Name], read}]),
      case xqldb_db:exists(DbUri) of
         false -> {error, not_exists};
         true ->
  
positive.code:          case xqldb_path_table:lookup(DB, Name) of
              {xml,Stamp} ->
                 NodeId = {DBId, {Name,Stamp}, []},
                 xqldb_nodes:get_doc(NodeId);
              _ ->
                 {error, not_exists}
           end
     end;
  
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
        [] -> 
  