anchor.diff:     %?dbg("Variables",Variables),
      M1 = lists:foldl(fun({#qname{} = Nm,_,_,_,_}, Map) when IsLib ->
                           digraph:add_vertex(G, {0,sim_name(Nm)}),
  -                        add_edge(G, library,{0,sim_name(Nm)}),
  +                        add_edge(G,{0,sim_name(Nm)}, library),
                           maps:put(sim_name(Nm), 0, Map);
                          ({#qname{} = Nm,_,_,_,_}, Map) ->
                           digraph:add_vertex(G, {0,sim_name(Nm)}),
                           maps:put(sim_name(Nm), 0, Map);
                          (#xqVar{id = Id, name = Nm}, Map) when IsLib ->
                           digraph:add_vertex(G, {Id,sim_name(Nm)}),
  -                        add_edge(G, library,{Id,sim_name(Nm)}),
  +                        add_edge(G, {Id,sim_name(Nm)},library),
                           maps:put(sim_name(Nm), Id, Map);
                          (#xqVar{id = Id, name = Nm}, Map) ->
                           digraph:add_vertex(G, {Id,sim_name(Nm)}),
  
positive.code:    end;
  x(G, Map, [{'context-item',{_,_,Expr}}|T],_Data ) ->
     %?dbg("Adding context item",Expr),
     x(G, Map, context_item, Expr),
     x(G, Map, T, []);
  x(G, Map, Parent, Data) when is_list(Data) ->
  
negative.code:          end
     end.
  
  get_array_type(#xqFunTest{kind = array, type = any}) ->
     array;
  get_array_type(#xqFunTest{kind = array, type = #xqSeqType{type = AType}}) ->
     get_array_type(AType);
  get_array_type(#xqFunTest{kind = map}) ->
     map;
  get_array_type(O) ->
     ?dbg("O",O),
     O.
  
  % for now until other stuff fixed
  