anchor.diff:  
   load_object_t(Node, Type, Id) ->
       case mnesia:wread({Type, Id}) of
  -	[] ->
  -	    mnesia:abort({unknown_object, {Type, Id}});
  -	[Data] ->
  -	    Node#occi_node{data=Data}
  +		[] ->
  +			mnesia:abort({unknown_object, {Type, Id}});
  +		[Data] ->
  +			Node#occi_node{data=Data}
       end.
   
   
  
positive.code: 
  add_to_collection_t(#uri{path=Path}=Parent, Child) ->
      case mnesia:wread({occi_node, Parent}) of
  	[] ->
  	    mnesia:write(occi_node:new(Parent, occi_collection:new(Parent, [Child])));
  	[#occi_node{type=occi_collection, data=#occi_collection{}=Coll}=Node] ->
  	    mnesia:write(Node#occi_node{data=occi_collection:add_entity(Coll, Child)});
  	[#occi_node{}] ->
  	    mnesia:abort({unknown_collection, Parent})
      end,
      if Path == [] -> ok;
         true -> add_to_collection_t(occi_uri:get_parent(Parent), {collection, Parent})
  
negative.code: 
  get_inline_link_t(Id) ->
      case mnesia:wread({occi_node, Id}) of
  		[] -> 
  			mnesia:abort({unknown_node, Id});
  		[#occi_node{objid=ObjId}] ->
  			case mnesia:wread({occi_link, ObjId}) of
  				[] ->
  					mnesia:abort({unknown_object, ObjId});
  				[Link] ->
  					Link#occi_link{id=Id}
  			end
      end.
  
  
  get_collection_qh(#occi_cid{class=kind}=Cid, NodeFilters, EntityFilters, true) ->
      EntityType = get_category_parent_t(Cid),
      Q1 = qlc:q([ N#occi_node{data=E} || N <- mnesia:table(occi_node), 
  										E <- mnesia:table(EntityType),
  										N#occi_node.type =:= EntityType,
  										element(3, E) =:= Cid,
  										N#occi_node.objid =:= element(2, E),
  										apply_node_filters(NodeFilters, N),
  										apply_entity_filters(EntityFilters, E)]),
      case EntityType of
  		occi_resource ->
  			qlc:fold(fun (E, Acc) -> 
  							 [load_resource_node_t(E) | Acc] 
  					 end, [], Q1);
  		occi_link ->
  			Q1
      end;
  
  get_collection_qh(#occi_cid{class=kind}=Cid, NodeFilters, EntityFilters, false) ->
      EntityType = get_category_parent_t(Cid),
      qlc:q([ element(2, N) || N <- mnesia:table(occi_node), 
  							 E <- mnesia:table(EntityType),
  							 N#occi_node.type =:= EntityType,
  							 element(3, E) =:= Cid,
  							 N#occi_node.objid =:= element(2, E),
  							 apply_node_filters(NodeFilters, N),
  							 apply_entity_filters(EntityFilters, E)]);
  
  get_collection_qh(#occi_cid{class=mixin}=Cid, NodeFilters, EntityFilters, true) ->
      Q1 = qlc:q([ N#occi_node{data=R} || N <- mnesia:table(occi_node), 
  										R <- mnesia:table(occi_resource),
  										N#occi_node.objid =:= element(2, R),
  										N#occi_node.type =:= occi_resource,
  										occi_resource:has_category(R, Cid),
  										apply_node_filters(NodeFilters, N),
  										apply_entity_filters(EntityFilters, R)]),
      Q2 = qlc:fold(fun (E, Acc) -> [load_resource_node_t(E) | Acc] end, [], Q1),
      Q3 = qlc:q([ N#occi_node{data=L} || N <- mnesia:table(occi_node), 
  										L <- mnesia:table(occi_link),
  										N#occi_node.objid =:= element(2, L),
  										N#occi_node.type =:= occi_link,
  										occi_link:has_category(L, Cid),
  										apply_node_filters(NodeFilters, N),
  										apply_entity_filters(EntityFilters, L)]),
      qlc:append(Q2, Q3);
  
  get_collection_qh(#occi_cid{class=mixin}=Cid, NodeFilters, EntityFilters, false) ->
      Q1 = qlc:q([ element(2, N) || N <- mnesia:table(occi_node), 
  								  R <- mnesia:table(occi_resource),
  								  N#occi_node.objid =:= element(2, R),
  								  N#occi_node.type =:= occi_resource,
  								  occi_resource:has_category(R, Cid),
  								  apply_node_filters(NodeFilters, N),
  								  apply_entity_filters(EntityFilters, R)]),
      Q2 = qlc:q([ element(2, L) || N <- mnesia:table(occi_node), 
  								  L <- mnesia:table(occi_link),
  								  N#occi_node.objid =:= element(2, L),
  								  N#occi_node.type =:= occi_link,
  								  occi_link:has_category(L, Cid),
  								  apply_node_filters(NodeFilters, N),
  								  apply_entity_filters(EntityFilters, L)]),
      qlc:append(Q1, Q2);
  
  get_collection_qh(#uri{}=CollId, NodeFilters, EntityFilters, Deep) ->
      case mnesia:wread({occi_node, CollId}) of
  		[] ->
  			mnesia:abort({unknown_node, CollId});
  		[#occi_node{data=#occi_collection{entities=Entities}}] ->
  			F = fun ({entity, Id}, Acc) -> 
  						case get_filtered_node_t(Id, NodeFilters, EntityFilters, Deep) of
  							none -> Acc;
  							Node -> 
  								case Deep of 
  									true -> [Acc, Node];
  									false -> [Acc, Node#occi_node.id]
  								end
  						end;
  					({collection, Id}, Acc) ->
  						[Acc, get_collection_qh(Id, NodeFilters, EntityFilters, Deep) ]
  				end,
  			lists:flatten(ordsets:fold(F, [], Entities))
      end.
  
  
  get_filtered_node_t(Id, NodeFilters, [], false) ->
      case mnesia:wread({occi_node, Id}) of
  		[] -> mnesia:abort({unknown_node, Id});
  		[Node] ->
  			case apply_node_filters(NodeFilters, Node) of
  				true -> Node;
  				false -> none
  			end
      end;
  
  get_filtered_node_t(Id, NodeFilters, EntityFilters, _) ->
      case mnesia:wread({occi_node, Id}) of
  		[] -> mnesia:abort({unknown_node, Id});
  		[Node] ->
  			case apply_node_filters(NodeFilters, Node) of
  				true -> get_filtered_entity_t(Node, EntityFilters);
  				false -> none
  			end
      end.    
  
  
  get_filtered_entity_t(#occi_node{type=Type, objid=ObjId}=Node, EntityFilters) ->
      case mnesia:wread({Type, ObjId}) of
  		[] -> mnesia:abort({unknown_entity, ObjId});
  		[#occi_link{}=L] ->
  			case apply_entity_filters(EntityFilters, L) of
  				true -> Node#occi_node{data=L};
  				false -> none
  			end;
  		[#occi_resource{}=R] ->
  			case apply_entity_filters(EntityFilters, R) of
  				true -> load_resource_node_t(Node#occi_node{data=R});
  				false -> none
  			end
      end.
  
  
  